gdb/
* tracepoint.c (trace_save): Remove X from tracepoint error description. gdb/testsuite/ * gdb.trace/tfile.c (tohex, bin2hex): New. (write_error_trace_file): Hexify error description.
This commit is contained in:
parent
99b5e152aa
commit
610197fd46
|
@ -1,3 +1,8 @@
|
||||||
|
2010-03-26 Pedro Alves <pedro@codesourcery.com>
|
||||||
|
|
||||||
|
* tracepoint.c (trace_save): Remove X from tracepoint error
|
||||||
|
description.
|
||||||
|
|
||||||
2010-03-26 Pedro Alves <pedro@codesourcery.com>
|
2010-03-26 Pedro Alves <pedro@codesourcery.com>
|
||||||
|
|
||||||
* tracepoint.c (parse_trace_status): Don't allow plain strings in
|
* tracepoint.c (parse_trace_status): Don't allow plain strings in
|
||||||
|
|
|
@ -1,3 +1,8 @@
|
||||||
|
2010-03-26 Pedro Alves <pedro@codesourcery.com>
|
||||||
|
|
||||||
|
* gdb.trace/tfile.c (tohex, bin2hex): New.
|
||||||
|
(write_error_trace_file): Hexify error description.
|
||||||
|
|
||||||
2010-03-25 Stan Shebs <stan@codesourcery.com>
|
2010-03-25 Stan Shebs <stan@codesourcery.com>
|
||||||
|
|
||||||
* gdb.trace/tfile.c: Generate an additional trace file, improve
|
* gdb.trace/tfile.c: Generate an additional trace file, improve
|
||||||
|
|
|
@ -105,10 +105,38 @@ write_basic_trace_file (void)
|
||||||
finish_trace_file (fd);
|
finish_trace_file (fd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Convert number NIB to a hex digit. */
|
||||||
|
|
||||||
|
static int
|
||||||
|
tohex (int nib)
|
||||||
|
{
|
||||||
|
if (nib < 10)
|
||||||
|
return '0' + nib;
|
||||||
|
else
|
||||||
|
return 'a' + nib - 10;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
bin2hex (const char *bin, char *hex, int count)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
*hex++ = tohex ((*bin >> 4) & 0xf);
|
||||||
|
*hex++ = tohex (*bin++ & 0xf);
|
||||||
|
}
|
||||||
|
*hex = 0;
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
write_error_trace_file (void)
|
write_error_trace_file (void)
|
||||||
{
|
{
|
||||||
int fd;
|
int fd;
|
||||||
|
const char made_up[] = "made-up error";
|
||||||
|
int len = sizeof (made_up) - 1;
|
||||||
|
char *hex = alloca (len * 2 + 1);
|
||||||
|
|
||||||
fd = start_trace_file ("error.tf");
|
fd = start_trace_file ("error.tf");
|
||||||
|
|
||||||
|
@ -120,8 +148,14 @@ write_error_trace_file (void)
|
||||||
snprintf (spbuf, sizeof spbuf, "R %x\n", 500 /* FIXME get from arch */);
|
snprintf (spbuf, sizeof spbuf, "R %x\n", 500 /* FIXME get from arch */);
|
||||||
write (fd, spbuf, strlen (spbuf));
|
write (fd, spbuf, strlen (spbuf));
|
||||||
|
|
||||||
|
bin2hex (made_up, hex, len);
|
||||||
|
|
||||||
/* Dump trace status, in the general form of the qTstatus reply. */
|
/* Dump trace status, in the general form of the qTstatus reply. */
|
||||||
snprintf (spbuf, sizeof spbuf, "status 0;terror:made-up error:1;tframes:0;tcreated:0;tfree:100;tsize:1000\n");
|
snprintf (spbuf, sizeof spbuf,
|
||||||
|
"status 0;"
|
||||||
|
"terror:%s:1;"
|
||||||
|
"tframes:0;tcreated:0;tfree:100;tsize:1000\n",
|
||||||
|
hex);
|
||||||
write (fd, spbuf, strlen (spbuf));
|
write (fd, spbuf, strlen (spbuf));
|
||||||
|
|
||||||
/* Dump tracepoint definitions, in syntax similar to that used
|
/* Dump tracepoint definitions, in syntax similar to that used
|
||||||
|
|
|
@ -2484,12 +2484,11 @@ trace_save (const char *filename, int target_does_save)
|
||||||
/* Write out status of the tracing run (aka "tstatus" info). */
|
/* Write out status of the tracing run (aka "tstatus" info). */
|
||||||
fprintf (fp, "status %c;%s",
|
fprintf (fp, "status %c;%s",
|
||||||
(ts->running ? '1' : '0'), stop_reason_names[ts->stop_reason]);
|
(ts->running ? '1' : '0'), stop_reason_names[ts->stop_reason]);
|
||||||
/* Encode the error message in hex, might have weird chars. */
|
|
||||||
if (ts->stop_reason == tracepoint_error)
|
if (ts->stop_reason == tracepoint_error)
|
||||||
{
|
{
|
||||||
char *buf = (char *) alloca (strlen (ts->error_desc) * 2 + 1);
|
char *buf = (char *) alloca (strlen (ts->error_desc) * 2 + 1);
|
||||||
bin2hex ((gdb_byte *) ts->error_desc, buf, 0);
|
bin2hex ((gdb_byte *) ts->error_desc, buf, 0);
|
||||||
fprintf (fp, ":X%s", buf);
|
fprintf (fp, ":%s", buf);
|
||||||
}
|
}
|
||||||
fprintf (fp, ":%x", ts->stopping_tracepoint);
|
fprintf (fp, ":%x", ts->stopping_tracepoint);
|
||||||
if (ts->traceframe_count >= 0)
|
if (ts->traceframe_count >= 0)
|
||||||
|
|
Loading…
Reference in New Issue