This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH/commit] Handle errors in tracepoint target agent


On Friday 26 March 2010 12:40:42, Stan Shebs wrote:

> My interest in the subject is now totally exhausted, 
> we'll just do the hex strings here.

Thanks.  I've applied the patch below.

-- 
Pedro Alves

2010-03-26  Pedro Alves  <pedro@codesourcery.com>

	gdb/
	* tracepoint.c (parse_trace_status): Don't allow plain strings in
	the terror description.  Don't expect an X prefix.

	gdb/doc/
	* gdb.texinfo (Tracepoint Packets): Remove mention that
	terror:string may be plain text, and drop mention of X prefix.

---
 gdb/doc/gdb.texinfo |    5 +----
 gdb/tracepoint.c    |   15 +++------------
 2 files changed, 4 insertions(+), 16 deletions(-)

Index: src/gdb/doc/gdb.texinfo
===================================================================
--- src.orig/gdb/doc/gdb.texinfo	2010-03-26 12:54:25.000000000 +0000
+++ src/gdb/doc/gdb.texinfo	2010-03-26 12:54:30.000000000 +0000
@@ -31366,10 +31366,7 @@ The trace stopped because tracepoint @va
 The trace stopped because tracepoint @var{tpnum} had an error.  The
 string @var{text} is available to describe the nature of the error
 (for instance, a divide by zero in the condition expression).
-@var{text} may take either of two forms; it may be plain text, but
-with the restriction that no colons or other special characters are
-allowed, or it may be an @code{X} followed by hex digits encoding the
-text string.
+@var{text} is hex encoded.
 
 @item tunknown:0
 The trace stopped for some other reason.
Index: src/gdb/tracepoint.c
===================================================================
--- src.orig/gdb/tracepoint.c	2010-03-26 12:54:33.000000000 +0000
+++ src/gdb/tracepoint.c	2010-03-26 12:57:00.000000000 +0000
@@ -3197,18 +3197,9 @@ Status line: '%s'\n"), p, line);
 	  if (p2 != p1)
 	    {
 	      int end;
-	      ts->error_desc = (char *) xmalloc (p2 - p1 + 1);
-	      /* See if we're doing plain text or hex encoding.  */
-	      if (*p1 == 'X')
-		{
-		  ++p1;
-		  end = hex2bin (p1, ts->error_desc, (p2 - p1) / 2);
-		}
-	      else
-		{
-		  memcpy (ts->error_desc, p1, p2 - p1);
-		  end = p2 - p1;
-		}
+
+	      ts->error_desc = xmalloc ((p2 - p1) / 2 + 1);
+	      end = hex2bin (p1, ts->error_desc, (p2 - p1) / 2);
 	      ts->error_desc[end] = '\0';
 	    }
 	  p = unpack_varlen_hex (++p2, &val);


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]