gdb/
authorYao Qi <yao@codesourcery.com>
Wed, 26 Jun 2013 08:01:57 +0000 (08:01 +0000)
committerYao Qi <yao@codesourcery.com>
Wed, 26 Jun 2013 08:01:57 +0000 (08:01 +0000)
2013-06-26  Pedro Alves  <pedro@codesourcery.com>
    Yao Qi  <yao@codesourcery.com>

* ctf.c (ctf_traceframe_info): Push trace state variables
present in the trace data into the traceframe info object.
* breakpoint.c (DEF_VEC_I): Remove.
* common/filestuff.c (DEF_VEC_I): Likewise.
* dwarf2loc.c (DEF_VEC_I): Likewise.
* mi/mi-main.c (DEF_VEC_I): Likewise.
* common/gdb_vecs.h (DEF_VEC_I): Define vector for int.
* features/traceframe-info.dtd: Add tvar element and its
attributes.
* tracepoint.c (free_traceframe_info): Free vector 'tvars'.
(build_traceframe_info): Push trace state variables present in the
trace data into the traceframe info object.
(traceframe_info_start_tvar): New function.
(tvar_attributes): New.
(traceframe_info_children): Add "tvar" element.
* tracepoint.h (struct traceframe_info) <tvars>: New field.

* NEWS: Mention the change in GDB and GDBserver.

gdb/doc:

2013-06-26  Pedro Alves  <pedro@codesourcery.com>

* gdb.texinfo (Traceframe Info Format): Document tvar element and
its attributes.

gdb/gdbserver:

2013-06-26  Pedro Alves  <pedro@codesourcery.com>

* tracepoint.c (build_traceframe_info_xml): Output trace state
variables present in the trace buffer.

15 files changed:
gdb/ChangeLog
gdb/NEWS
gdb/breakpoint.c
gdb/common/filestuff.c
gdb/common/gdb_vecs.h
gdb/ctf.c
gdb/doc/ChangeLog
gdb/doc/gdb.texinfo
gdb/dwarf2loc.c
gdb/features/traceframe-info.dtd
gdb/gdbserver/ChangeLog
gdb/gdbserver/tracepoint.c
gdb/mi/mi-main.c
gdb/tracepoint.c
gdb/tracepoint.h

index 1397e73..0b0ff73 100644 (file)
@@ -1,6 +1,28 @@
 2013-06-26  Pedro Alves  <pedro@codesourcery.com>
            Yao Qi  <yao@codesourcery.com>
 
+       * ctf.c (ctf_traceframe_info): Push trace state variables
+       present in the trace data into the traceframe info object.
+       * breakpoint.c (DEF_VEC_I): Remove.
+       * common/filestuff.c (DEF_VEC_I): Likewise.
+       * dwarf2loc.c (DEF_VEC_I): Likewise.
+       * mi/mi-main.c (DEF_VEC_I): Likewise.
+       * common/gdb_vecs.h (DEF_VEC_I): Define vector for int.
+       * features/traceframe-info.dtd: Add tvar element and its
+       attributes.
+       * tracepoint.c (free_traceframe_info): Free vector 'tvars'.
+       (build_traceframe_info): Push trace state variables present in
+       the trace data into the traceframe info object.
+       (traceframe_info_start_tvar): New function.
+       (tvar_attributes): New.
+       (traceframe_info_children): Add "tvar" element.
+       * tracepoint.h (struct traceframe_info) <tvars>: New field.
+
+       * NEWS: Mention the change in GDB and GDBserver.
+
+2013-06-26  Pedro Alves  <pedro@codesourcery.com>
+           Yao Qi  <yao@codesourcery.com>
+
        * tracepoint.c (trace_dump_command): Move code to ...
        (get_traceframe_location): ... here.  New.
 
index b86e8d8..ab8f283 100644 (file)
--- a/gdb/NEWS
+++ b/gdb/NEWS
@@ -92,6 +92,9 @@ show range-stepping
   the number of control packets from/to GDB.  See "New remote packets"
   below.
 
+* GDB now understands the element 'tvar' in the XML traceframe info.
+  It has the id of the collected trace state variables.
+
 * New remote packets
 
 vCont;r
@@ -113,6 +116,10 @@ qXfer:libraries-svr4:read's annex
   ** GDBserver now supports target-assisted range stepping.  Currently
      enabled on x86/x86_64 GNU/Linux targets.
 
+  ** GDBserver now adds element 'tvar' in the XML in the reply to
+     'qXfer:traceframe-info:read'.  It has the id of the collected
+     trace state variables.
+
 *** Changes in GDB 7.6
 
 * Target record has been renamed to record-full.
index ccd05d9..af6a42a 100644 (file)
@@ -5799,8 +5799,6 @@ bptype_string (enum bptype type)
   return bptypes[(int) type].description;
 }
 
-DEF_VEC_I(int);
-
 /* For MI, output a field named 'thread-groups' with a list as the value.
    For CLI, prefix the list with the string 'inf'. */
 
index daf96d9..7d1a69a 100644 (file)
@@ -157,8 +157,6 @@ fdwalk (int (*func) (void *, int), void *arg)
    don't use a hashtab because libiberty isn't linked into gdbserver;
    and anyway we don't expect there to be many open fds.  */
 
-DEF_VEC_I (int);
-
 static VEC (int) *open_fds;
 
 /* An fdwalk callback function used by notice_open_fds.  It puts the
index 1b05b0c..7df3001 100644 (file)
@@ -29,6 +29,8 @@ DEF_VEC_P (char_ptr);
 
 DEF_VEC_P (const_char_ptr);
 
+DEF_VEC_I (int);
+
 extern void free_char_ptr_vec (VEC (char_ptr) *char_ptr_vec);
 
 extern struct cleanup *
index 278f950..23ee36d 100644 (file)
--- a/gdb/ctf.c
+++ b/gdb/ctf.c
@@ -1778,6 +1778,18 @@ ctf_traceframe_info (void)
          def = bt_ctf_get_field (event, scope, "length");
          r->length = (uint16_t) bt_ctf_get_uint64 (def);
        }
+      else if (strcmp (name, "tsv") == 0)
+       {
+         int vnum;
+         const struct bt_definition *scope
+           = bt_ctf_get_top_level_scope (event,
+                                         BT_EVENT_FIELDS);
+         const struct bt_definition *def;
+
+         def = bt_ctf_get_field (event, scope, "num");
+         vnum = (int) bt_ctf_get_int64 (def);
+         VEC_safe_push (int, info->tvars, vnum);
+       }
       else
        {
          warning (_("Unhandled trace block type (%s) "
index 41ccea2..5090ae9 100644 (file)
@@ -1,3 +1,8 @@
+2013-06-26  Pedro Alves  <pedro@codesourcery.com>
+
+       * gdb.texinfo (Traceframe Info Format): Document tvar element
+       and its attributes.
+
 2013-06-25  Yao Qi  <yao@codesourcery.com>
 
        * gdbint.texinfo (Testsuite): Document 'gdb,predefined_tsv'.
index d25cdae..3992704 100644 (file)
@@ -41789,17 +41789,27 @@ A region of collected memory starting at @var{addr} and extending for
 <memory start="@var{addr}" length="@var{length}"/>
 @end smallexample
 
+@item
+A block indicating trace state variable numbered @var{number} has been
+collected:
+
+@smallexample
+<tvar id="@var{number}"/>
+@end smallexample
+
 @end itemize
 
 The formal DTD for the traceframe info format is given below:
 
 @smallexample
-<!ELEMENT traceframe-info  (memory)* >
+<!ELEMENT traceframe-info  (memory | tvar)* >
 <!ATTLIST traceframe-info  version CDATA   #FIXED  "1.0">
 
 <!ELEMENT memory        EMPTY>
 <!ATTLIST memory        start   CDATA   #REQUIRED
                         length  CDATA   #REQUIRED>
+<!ELEMENT tvar>
+<!ATTLIST tvar          id      CDATA   #REQUIRED>
 @end smallexample
 
 @node Branch Trace Format
index bb600d1..02afcdf 100644 (file)
@@ -42,8 +42,6 @@
 #include "gdb_string.h"
 #include "gdb_assert.h"
 
-DEF_VEC_I(int);
-
 extern int dwarf2_always_disassemble;
 
 static void dwarf_expr_frame_base_1 (struct symbol *framefunc, CORE_ADDR pc,
index 0da2bec..b811122 100644 (file)
@@ -5,9 +5,12 @@
      notice and this notice are preserved.  -->
 
 <!-- traceframe-info: Root element with versioning -->
-<!ELEMENT traceframe-info  (memory)* >
+<!ELEMENT traceframe-info  (memory | tvar)* >
 <!ATTLIST traceframe-info  version CDATA   #FIXED  "1.0">
 
 <!ELEMENT memory        EMPTY>
 <!ATTLIST memory        start   CDATA   #REQUIRED
                         length  CDATA   #REQUIRED>
+
+<!ELEMENT tvar          EMPTY>
+<!ATTLIST tvar          id   CDATA   #REQUIRED>
index 31e71c4..ec79b1a 100644 (file)
@@ -1,3 +1,8 @@
+2013-06-26  Pedro Alves  <pedro@codesourcery.com>
+
+       * tracepoint.c (build_traceframe_info_xml): Output trace state
+       variables present in the trace buffer.
+
 2013-06-24  Tom Tromey  <tromey@redhat.com>
 
        * Makefile.in (version.c): Use bfd/version.h, common/version.in,
index d237e7f..6492b5a 100644 (file)
@@ -5401,6 +5401,13 @@ build_traceframe_info_xml (char blocktype, unsigned char *dataptr, void *data)
        break;
       }
     case 'V':
+      {
+       int vnum;
+
+       memcpy (&vnum, dataptr, sizeof (vnum));
+       buffer_xml_printf (buffer, "<tvar id=\"%d\"/>\n", vnum);
+       break;
+      }
     case 'R':
     case 'S':
       {
index 127f6ff..430d530 100644 (file)
@@ -513,8 +513,6 @@ mi_cmd_thread_info (char *command, char **argv, int argc)
   print_thread_info (current_uiout, argv[0], -1);
 }
 
-DEF_VEC_I(int);
-
 struct collect_cores_data
 {
   int pid;
index 61e9efa..62b1a2c 100644 (file)
@@ -235,6 +235,7 @@ free_traceframe_info (struct traceframe_info *info)
   if (info != NULL)
     {
       VEC_free (mem_range_s, info->memory);
+      VEC_free (int, info->tvars);
 
       xfree (info);
     }
@@ -5224,6 +5225,12 @@ build_traceframe_info (char blocktype, void *data)
        break;
       }
     case 'V':
+      {
+       int vnum;
+
+       tfile_read ((gdb_byte *) &vnum, 4);
+       VEC_safe_push (int, info->tvars, vnum);
+      }
     case 'R':
     case 'S':
       {
@@ -5581,6 +5588,21 @@ traceframe_info_start_memory (struct gdb_xml_parser *parser,
   r->length = *length_p;
 }
 
+/* Handle the start of a <tvar> element.  */
+
+static void
+traceframe_info_start_tvar (struct gdb_xml_parser *parser,
+                            const struct gdb_xml_element *element,
+                            void *user_data,
+                            VEC(gdb_xml_value_s) *attributes)
+{
+  struct traceframe_info *info = user_data;
+  const char *id_attrib = xml_find_attribute (attributes, "id")->value;
+  int id = gdb_xml_parse_ulongest (parser, id_attrib);
+
+  VEC_safe_push (int, info->tvars, id);
+}
+
 /* Discard the constructed trace frame info (if an error occurs).  */
 
 static void
@@ -5599,10 +5621,18 @@ static const struct gdb_xml_attribute memory_attributes[] = {
   { NULL, GDB_XML_AF_NONE, NULL, NULL }
 };
 
+static const struct gdb_xml_attribute tvar_attributes[] = {
+  { "id", GDB_XML_AF_NONE, NULL, NULL },
+  { NULL, GDB_XML_AF_NONE, NULL, NULL }
+};
+
 static const struct gdb_xml_element traceframe_info_children[] = {
   { "memory", memory_attributes, NULL,
     GDB_XML_EF_REPEATABLE | GDB_XML_EF_OPTIONAL,
     traceframe_info_start_memory, NULL },
+  { "tvar", tvar_attributes, NULL,
+    GDB_XML_EF_REPEATABLE | GDB_XML_EF_OPTIONAL,
+    traceframe_info_start_tvar, NULL },
   { NULL, NULL, NULL, GDB_XML_EF_NONE, NULL, NULL }
 };
 
index 3b09ca8..350ab5e 100644 (file)
@@ -30,6 +30,9 @@ struct traceframe_info
 {
   /* Collected memory.  */
   VEC(mem_range_s) *memory;
+
+  /* Collected trace state variables.  */
+  VEC(int) *tvars;
 };
 
 /* A trace state variable is a value managed by a target being