aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Snyder <msnyder@vmware.com>2008-06-24 03:05:27 +0000
committerMichael Snyder <msnyder@vmware.com>2008-06-24 03:05:27 +0000
commitadfb1a08ec7cfaf7d992b3f9410598698641f016 (patch)
tree1e66474088a2957dbf6dde4c95168375dd45fd93
parentbce625cd0d23ff90391d3866a86e4cf401f5d4f3 (diff)
downloadgdb-adfb1a08ec7cfaf7d992b3f9410598698641f016.zip
gdb-adfb1a08ec7cfaf7d992b3f9410598698641f016.tar.gz
gdb-adfb1a08ec7cfaf7d992b3f9410598698641f016.tar.bz2
2008-06-23 Michael Snyder <msnyder@specifix.com>
* gdbfreeplay.h: Replace all address values with unsigned long long. * gdbfreeplay-i386.c: Ditto. * gdbfreeplay-mips64.c: Ditto. * gdbfreeplay-back.c: Ditto. * remote-break.c: Ditto. * remote-break.h: Ditto.
-rw-r--r--gdb/gdbserver/ChangeLog8
-rw-r--r--gdb/gdbserver/Makefile.in7
-rw-r--r--gdb/gdbserver/gdbfreeplay-back.c23
-rw-r--r--gdb/gdbserver/gdbfreeplay-i386.c32
-rw-r--r--gdb/gdbserver/gdbfreeplay-mips64.c24
-rw-r--r--gdb/gdbserver/gdbfreeplay.h8
-rw-r--r--gdb/gdbserver/remote-breakpoint.c10
-rw-r--r--gdb/gdbserver/remote-breakpoint.h8
8 files changed, 68 insertions, 52 deletions
diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog
index bee26c9..70b3306 100644
--- a/gdb/gdbserver/ChangeLog
+++ b/gdb/gdbserver/ChangeLog
@@ -1,7 +1,15 @@
2008-06-23 Michael Snyder <msnyder@specifix.com>
+ * gdbfreeplay.h: Replace all address values with unsigned long long.
+ * gdbfreeplay-i386.c: Ditto.
+ * gdbfreeplay-mips64.c: Ditto.
+ * gdbfreeplay-back.c: Ditto.
+ * remote-break.c: Ditto.
+ * remote-break.h: Ditto.
+
* configure.srv: Add configuration for mips64-linux.
* gdbfreeplay-mips64.c: New file, back-end for mips64.
+ * Makefile.in: Add rules for mips and intel back-ends.
2008-06-21 Michael Snyder <msnyder@specifix.com>
diff --git a/gdb/gdbserver/Makefile.in b/gdb/gdbserver/Makefile.in
index fdf40a1..8039bba 100644
--- a/gdb/gdbserver/Makefile.in
+++ b/gdb/gdbserver/Makefile.in
@@ -299,8 +299,11 @@ target.o: target.c $(server_h)
thread-db.o: thread-db.c $(server_h) $(gdb_proc_service_h)
utils.o: utils.c $(server_h)
gdbreplay.o: gdbreplay.c config.h
-gdbfreeplay-front.o: gdbfreeplay-front.c gdbfreeplay.h
-gdbfreeplay-back.o: gdbfreeplay-back.c gdbfreeplay.h
+gdbfreeplay-front.o: gdbfreeplay-front.c gdbfreeplay.h
+gdbfreeplay-back.o: gdbfreeplay-back.c gdbfreeplay.h remote-breakpoint.h
+gdbfreeplay-i386.o: gdbfreeplay-i386.c gdbfreeplay.h remote-breakpoint.h
+gdbfreeplay-mips64.o: gdbfreeplay-mips64.c gdbfreeplay.h remote-breakpoint.h
+remote-breakpoint.o: remote-breakpoint.c remote-breakpoint.h
signals.o: ../signals/signals.c $(server_h)
$(CC) -c $(CPPFLAGS) $(INTERNAL_CFLAGS) $< -DGDBSERVER
diff --git a/gdb/gdbserver/gdbfreeplay-back.c b/gdb/gdbserver/gdbfreeplay-back.c
index a270d1c..bcfe49b 100644
--- a/gdb/gdbserver/gdbfreeplay-back.c
+++ b/gdb/gdbserver/gdbfreeplay-back.c
@@ -21,11 +21,11 @@ typedef struct STOPFRAME {
/* frame_id -- a unique identifier per stop frame. */
unsigned int frame_id;
/* pc -- address of the next instruction to be "executed". */
- unsigned long pc;
- /* predecr_pc -- address that will be reported by a breakpoint.
+ unsigned long long pc;
+ /* FIXME remove! predecr_pc -- address that will be reported by a breakpoint.
These two are different on some targets, see gdb source code,
DECR_PC_AFTER_BREAK. */
- unsigned long predecr_pc;
+ unsigned long long predecr_pc;
unsigned long eventpos;
unsigned long Opos;
} StopFrame;
@@ -58,7 +58,7 @@ scan_gdbreplay_file (FILE *infile)
/* Make a pass over the entire file -- cache the record positions. */
char *line, *p;
unsigned long nextpos;
- unsigned long GPC;
+ unsigned long long GPC;
/* First skip empty lines. */
do {
@@ -79,7 +79,7 @@ scan_gdbreplay_file (FILE *infile)
{
/* See if we need to grab the PC from this packet. */
if (stopframe[last_cached_frame].pc == 0 ||
- stopframe[last_cached_frame].pc == (unsigned long) -1)
+ stopframe[last_cached_frame].pc == (unsigned long long) -1)
{
nextpos = ftell (infile);
line = fgets (inbuf, sizeof (inbuf), infile);
@@ -92,13 +92,14 @@ scan_gdbreplay_file (FILE *infile)
{
GPC = target_pc_from_G (p);
if (stopframe[last_cached_frame].pc == 0 ||
- stopframe[last_cached_frame].pc == (unsigned long) -1)
+ stopframe[last_cached_frame].pc == (unsigned long long) -1)
{
/* Unlikely, but if we need to, we can just grab this PC. */
stopframe[last_cached_frame].pc = GPC;
}
else if (stopframe[last_cached_frame].pc == GPC + 1)
{
+ /* FIXME remove! */
/* OK, this is gdb decrementing the PC after a breakpoint. */
stopframe[last_cached_frame].predecr_pc =
stopframe[last_cached_frame].pc;
@@ -640,6 +641,10 @@ add_checksum (char *inbuf)
int cksum = 0;
char *p = inbuf;
+ /* Sanity check. */
+ if (inbuf == NULL)
+ return NULL;
+
/* If the string doesn't start with a '$', it's broken. */
if (*p++ != '$')
return inbuf;
@@ -708,7 +713,7 @@ static char E01[8] = "$E01#a6";
static char *
handle_special_case (FILE *infile, int fd, char *request)
{
- unsigned long addr;
+ unsigned long long addr;
unsigned long len;
int next_event_frame;
char *p;
@@ -932,7 +937,7 @@ handle_special_case (FILE *infile, int fd, char *request)
{
if (p[3] == ',')
{
- addr = strtoul (p + 4, &p, 16);
+ addr = strtoull (p + 4, &p, 16);
if (p[0] == ',')
{
len = strtoul (p + 1, NULL, 16);
@@ -947,7 +952,7 @@ handle_special_case (FILE *infile, int fd, char *request)
{
if (p[3] == ',')
{
- addr = strtoul (p + 4, &p, 16);
+ addr = strtoull (p + 4, &p, 16);
if (p[0] == ',')
{
len = strtoul (p + 1, NULL, 16);
diff --git a/gdb/gdbserver/gdbfreeplay-i386.c b/gdb/gdbserver/gdbfreeplay-i386.c
index aaeb8cf..f2ae4ba 100644
--- a/gdb/gdbserver/gdbfreeplay-i386.c
+++ b/gdb/gdbserver/gdbfreeplay-i386.c
@@ -79,10 +79,10 @@ ix86_unsigned_long_to_hex (unsigned long value)
* target_pc_from_T
*
* Extract the PC value from the gdb protocol 'T' packet.
- * Returns PC as host unsigned long.
+ * Returns PC as host unsigned long long.
*/
-unsigned long
+unsigned long long
target_pc_from_T (char *tpacket)
{
char *p;
@@ -90,43 +90,43 @@ target_pc_from_T (char *tpacket)
if (tpacket[0] == '$' && tpacket[1] == 'T' &&
(p = strstr (tpacket, ";08:")) != NULL)
{
- return ix86_hex_to_unsigned_long (p + 4);
+ return (unsigned long long) ix86_hex_to_unsigned_long (p + 4);
}
/* Fail -- just assume no legitimate PC will ever be -1... */
- return (unsigned long) -1;
+ return (unsigned long long) -1;
}
/*
* ix86_pc_from_registers
*
* Extract the PC value from a gdb protocol registers file.
- * Returns PC as host unsigned long.
+ * Returns PC as host unsigned long long.
*/
-static unsigned long
+static unsigned long long
ix86_pc_from_registers (char *regs)
{
- return ix86_hex_to_unsigned_long (regs + 64);
+ return (unsigned long long) ix86_hex_to_unsigned_long (regs + 64);
}
/*
* target_pc_from_G
*
* Extract the PC value from the gdb protocol 'G' packet.
- * Returns PC as host unsigned long.
+ * Returns PC as host unsigned long long.
*/
-unsigned long
+unsigned long long
target_pc_from_G (char *gpacket)
{
if (gpacket[0] == '$' && gpacket[1] == 'G')
{
- return ix86_pc_from_registers (gpacket + 2);
+ return (unsigned long long) ix86_pc_from_registers (gpacket + 2);
}
/* Fail -- just assume no legitimate PC will ever be -1... */
- return (unsigned long) -1;
+ return (unsigned long long) -1;
}
/*
@@ -202,10 +202,10 @@ expand_rle (char *input)
* Unlike the two above, this function accepts a FILE pointer
* rather than a char pointer, and must read data from the file.
*
- * Returns PC as host unsigned long.
+ * Returns PC as host unsigned long long.
*/
-unsigned long
+unsigned long long
target_pc_from_g (char *gpacket)
{
if (gpacket[0] == 'r' && gpacket[1] == ' ')
@@ -217,7 +217,7 @@ target_pc_from_g (char *gpacket)
gpacket++;
}
- return ix86_pc_from_registers (expand_rle (gpacket));
+ return (unsigned long long) ix86_pc_from_registers (expand_rle (gpacket));
}
/*
@@ -248,10 +248,10 @@ target_pc_from_g (char *gpacket)
char *
target_compose_T_packet (char *origTpacket,
- unsigned long instruction_pc,
+ unsigned long long instruction_pc,
int breakpoint_p)
{
- unsigned long origTpacket_pc = target_pc_from_T (origTpacket);
+ unsigned long long origTpacket_pc = target_pc_from_T (origTpacket);
static char reply_buf[128];
char *p;
diff --git a/gdb/gdbserver/gdbfreeplay-mips64.c b/gdb/gdbserver/gdbfreeplay-mips64.c
index 3e3978a..3a9ce1b 100644
--- a/gdb/gdbserver/gdbfreeplay-mips64.c
+++ b/gdb/gdbserver/gdbfreeplay-mips64.c
@@ -14,37 +14,37 @@
* target_pc_from_T
*
* Extract the PC value from the gdb protocol 'T' packet.
- * Returns PC as host unsigned long.
+ * Returns PC as host unsigned long long.
*/
-unsigned long
+unsigned long long
target_pc_from_T (char *tpacket)
{
/* Unimplimented -- make caller fall back to using g packet. */
- return -1;
+ return (unsigned long long) -1;
}
/*
* target_pc_from_G
*
* Extract the PC value from the gdb protocol 'G' packet.
- * Returns PC as host unsigned long.
+ * Returns PC as host unsigned long long.
*/
-unsigned long
+unsigned long long
target_pc_from_G (char *gpacket)
{
char localbuf [24];
if (gpacket[0] == '$' && gpacket[1] == 'G')
{
- strncpy (localbuf, gpacket + 592, 8);
+ strncpy (localbuf, gpacket + 592, 16);
localbuf[16] = '\0';
return strtoul (localbuf, NULL, 16);
}
/* Fail -- just assume no legitimate PC will ever be -1... */
- return (unsigned long) -1;
+ return (unsigned long long) -1;
}
/*
@@ -55,10 +55,10 @@ target_pc_from_G (char *gpacket)
* Unlike the two above, this function accepts a FILE pointer
* rather than a char pointer, and must read data from the file.
*
- * Returns PC as host unsigned long.
+ * Returns PC as host unsigned long long.
*/
-unsigned long
+unsigned long long
target_pc_from_g (char *gpacket)
{
char localbuf [24];
@@ -72,9 +72,9 @@ target_pc_from_g (char *gpacket)
gpacket++;
}
- strncpy (localbuf, gpacket + 592, 8);
+ strncpy (localbuf, gpacket + 592, 16);
localbuf[16] = '\0';
- return strtoul (localbuf, NULL, 16);
+ return strtoull (localbuf, NULL, 16);
}
@@ -89,7 +89,7 @@ target_pc_from_g (char *gpacket)
char *
target_compose_T_packet (char *origTpacket,
- unsigned long instruction_pc,
+ unsigned long long instruction_pc,
int breakpoint_p)
{
return origTpacket;
diff --git a/gdb/gdbserver/gdbfreeplay.h b/gdb/gdbserver/gdbfreeplay.h
index d9c70c5..7d38651 100644
--- a/gdb/gdbserver/gdbfreeplay.h
+++ b/gdb/gdbserver/gdbfreeplay.h
@@ -12,12 +12,12 @@ extern int verbose;
extern enum successcode gdbfreeplay_open (char *filename);
extern void gdbfreeplay (int socket_fd);
-extern unsigned long target_pc_from_T (char *tpacket);
-extern unsigned long target_pc_from_G (char *gpacket);
-extern unsigned long target_pc_from_g (char *gpacket);
+extern unsigned long long target_pc_from_T (char *tpacket);
+extern unsigned long long target_pc_from_G (char *gpacket);
+extern unsigned long long target_pc_from_g (char *gpacket);
extern char *target_compose_T_packet (char *origTpacket,
- unsigned long pc,
+ unsigned long long pc,
int breakpoint_p);
extern char *target_compose_g_packet (char *origTpacket);
diff --git a/gdb/gdbserver/remote-breakpoint.c b/gdb/gdbserver/remote-breakpoint.c
index 5308932..adebf9f 100644
--- a/gdb/gdbserver/remote-breakpoint.c
+++ b/gdb/gdbserver/remote-breakpoint.c
@@ -23,7 +23,7 @@ extern int verbose;
static enum successcode
insert_breakpoint (enum breakpoint_type bptype,
- unsigned long addr,
+ unsigned long long addr,
unsigned long len)
{
breakpoint *this_bp;
@@ -55,7 +55,7 @@ insert_breakpoint (enum breakpoint_type bptype,
static int
unlink_breakpoint (enum breakpoint_type bptype,
- unsigned long addr,
+ unsigned long long addr,
unsigned long len)
{
breakpoint *this_bp, *tmp;
@@ -104,7 +104,7 @@ unlink_breakpoint (enum breakpoint_type bptype,
extern enum successcode
remote_remove_breakpoint (enum breakpoint_type bptype,
- unsigned long addr,
+ unsigned long long addr,
unsigned long len)
{
if (verbose)
@@ -120,7 +120,7 @@ remote_remove_breakpoint (enum breakpoint_type bptype,
extern enum successcode
remote_set_breakpoint (enum breakpoint_type bptype,
- unsigned long addr,
+ unsigned long long addr,
unsigned long len)
{
if (verbose)
@@ -145,7 +145,7 @@ remote_set_breakpoint (enum breakpoint_type bptype,
enum successcode
remote_breakpoint_here_p (enum breakpoint_type bptype,
- unsigned long addr)
+ unsigned long long addr)
{
breakpoint *bp = bplist[bptype];
diff --git a/gdb/gdbserver/remote-breakpoint.h b/gdb/gdbserver/remote-breakpoint.h
index d98a659..10d746a 100644
--- a/gdb/gdbserver/remote-breakpoint.h
+++ b/gdb/gdbserver/remote-breakpoint.h
@@ -6,7 +6,7 @@
#define REMOTE_BREAKPOINT_H
typedef struct BREAKPOINT {
- unsigned long addr;
+ unsigned long long addr;
unsigned long len;
struct BREAKPOINT *next;
} breakpoint;
@@ -31,15 +31,15 @@ enum direction_code {
};
extern enum successcode remote_remove_breakpoint (enum breakpoint_type,
- unsigned long,
+ unsigned long long,
unsigned long);
extern enum successcode remote_set_breakpoint (enum breakpoint_type,
- unsigned long,
+ unsigned long long,
unsigned long);
extern enum successcode remote_breakpoint_here_p (enum breakpoint_type,
- unsigned long);
+ unsigned long long);
#endif