2008-06-21 Michael Snyder <msnyder@specifix.com>
+ * gdbfreeplay-i386.c (target_pc_from_g): Accept a char * instead
+ of a FILE *.
+ * gdbfreeplay.h (target_pc_from_g): Change prototype.
+ * gdbfreeplay-back.c (scan_gdbreplay_file): Change call.
+
* gdbfreeplay-i386.c (target_compose_T_packet): Add default return.
(target_compose_g_packet): New function.
* gdbfreeplay.h (target_compose_g_packet): Export.
/* 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 = target_pc_from_g (infile);
+ {
+ nextpos = ftell (infile);
+ line = fgets (inbuf, sizeof (inbuf), infile);
+ stopframe[last_cached_frame].pc = target_pc_from_g (line);
+ }
}
/* Reset PC after breakpoint? */
* Returns PC as host unsigned long.
*/
-#define INBUF_SIZE 1024
-static char inbuf [INBUF_SIZE];
-
unsigned long
-target_pc_from_g (FILE *infile)
+target_pc_from_g (char *gpacket)
{
- char *line = fgets (inbuf, sizeof (inbuf), infile);
-
- if (line[0] == 'r' && line[1] == ' ')
+ if (gpacket[0] == 'r' && gpacket[1] == ' ')
{
- line += 2;
- if (line[0] == '+')
- line++;
- if (line[0] == '$')
- line++;
+ gpacket += 2;
+ if (gpacket[0] == '+')
+ gpacket++;
+ if (gpacket[0] == '$')
+ gpacket++;
}
- return ix86_pc_from_registers (expand_rle (line));
+ return ix86_pc_from_registers (expand_rle (gpacket));
}
/*
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 (FILE *infile);
+extern unsigned long target_pc_from_g (char *gpacket);
+
extern char *target_compose_T_packet (char *origTpacket,
unsigned long pc,
int breakpoint_p);