diff options
author | Pedro Alves <palves@redhat.com> | 2010-03-26 14:31:48 +0000 |
---|---|---|
committer | Pedro Alves <palves@redhat.com> | 2010-03-26 14:31:48 +0000 |
commit | 610197fd468b01ed5bc653b19e7c720f2a8d1f8d (patch) | |
tree | 8e1a6864e663bacb879a483bf1fa8ed43aabe26c /gdb/testsuite/gdb.trace | |
parent | 99b5e152aad13580d6a3b7feda87ad40de7ec7d2 (diff) | |
download | gdb-610197fd468b01ed5bc653b19e7c720f2a8d1f8d.zip gdb-610197fd468b01ed5bc653b19e7c720f2a8d1f8d.tar.gz gdb-610197fd468b01ed5bc653b19e7c720f2a8d1f8d.tar.bz2 |
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.
Diffstat (limited to 'gdb/testsuite/gdb.trace')
-rw-r--r-- | gdb/testsuite/gdb.trace/tfile.c | 36 |
1 files changed, 35 insertions, 1 deletions
diff --git a/gdb/testsuite/gdb.trace/tfile.c b/gdb/testsuite/gdb.trace/tfile.c index 5d4c797..4deba06 100644 --- a/gdb/testsuite/gdb.trace/tfile.c +++ b/gdb/testsuite/gdb.trace/tfile.c @@ -105,10 +105,38 @@ write_basic_trace_file (void) 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 write_error_trace_file (void) { 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"); @@ -120,8 +148,14 @@ write_error_trace_file (void) snprintf (spbuf, sizeof spbuf, "R %x\n", 500 /* FIXME get from arch */); write (fd, spbuf, strlen (spbuf)); + bin2hex (made_up, hex, len); + /* 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)); /* Dump tracepoint definitions, in syntax similar to that used |