]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Create inferior for tfile target
authorYao Qi <yao@codesourcery.com>
Thu, 30 Jan 2014 00:37:05 +0000 (08:37 +0800)
committerYao Qi <yao@codesourcery.com>
Wed, 5 Feb 2014 12:08:26 +0000 (04:08 -0800)
When a trace file is loaded in Eclipse, it is expected to see thread
and process (=thread-group-started and =thread-created).  Create an
inferior and add a thread for this purpose.

This patch just reverts my previous patch.

gdb/testsuite:

2014-02-05  Yao Qi  <yao@codesourcery.com>

Revert this patch:

2013-05-24  Yao Qi  <yao@codesourcery.com>

* gdb.trace/tfile.exp: Test inferior and thread.

gdb:

2014-02-05  Yao Qi  <yao@codesourcery.com>

Revert this patch:

2013-05-24  Yao Qi  <yao@codesourcery.com>

* tracepoint.c (TFILE_PID): Remove.
(tfile_open): Don't add thread and inferior.
(tfile_close): Don't set 'inferior_ptid'.  Don't call
exit_inferior_silent.
(tfile_thread_alive): Remove.
(init_tfile_ops): Don't set field 'to_thread_alive' of
tfile_ops.

gdb/ChangeLog
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.trace/tfile.exp
gdb/tracepoint.c

index f6241455ea3f85eab08583aebe55219f53693d9b..18b9b0bd2b5d05a97855fe2d67f7ff323fafba17 100644 (file)
@@ -1,3 +1,17 @@
+2014-02-05  Yao Qi  <yao@codesourcery.com>
+
+       Revert this patch:
+
+       2013-05-24  Yao Qi  <yao@codesourcery.com>
+
+       * tracepoint.c (TFILE_PID): Remove.
+       (tfile_open): Don't add thread and inferior.
+       (tfile_close): Don't set 'inferior_ptid'.  Don't call
+       exit_inferior_silent.
+       (tfile_thread_alive): Remove.
+       (init_tfile_ops): Don't set field 'to_thread_alive' of
+       tfile_ops.
+
 2014-01-28  Ulrich Weigand  <uweigand@de.ibm.com>
 
        * ppc64-tdep.c (ppc64_standard_linkage7): Fix typo.
index 95f8cd22fa15c6eeb3950c60c75ec82a516259b8..c52d8c4ff55aafe81b5e6d44bcac1b3ceb91dbd1 100644 (file)
@@ -1,3 +1,11 @@
+2014-02-05  Yao Qi  <yao@codesourcery.com>
+
+       Revert this patch:
+
+       2013-05-24  Yao Qi  <yao@codesourcery.com>
+
+       * gdb.trace/tfile.exp: Test inferior and thread.
+
 2014-01-28  Edjunior Barbosa Machado  <emachado@linux.vnet.ibm.com>
 
        * gdb.base/info-shared.exp: Expect leading `.' on ppc64's symbols.
index 35d9c2c97b95b2094707abcf1bc1b8547a7b6093..634c2fc41930dd25482edda961ee101e2787af69 100644 (file)
@@ -136,9 +136,6 @@ Trace buffer has 256 bytes of 4096 bytes free \\(93% full\\).*
 Not looking at any trace frame.*" \
     "tstatus on error trace file"
 
-gdb_test "info threads" "No threads\..*"
-gdb_test "info inferiors" "\\* 1    <null>\[ \t\]+${binfile}.*"
-
 # Make sure we can reopen without error.
 gdb_test \
     "interpreter-exec mi \"-target-select tfile $tfile_basic\"" \
index 582c284db26b3f1ca524be59410a89b587da15b0..5bb091f31c8c6d689369d4cf1dba0bbbac299f29 100644 (file)
@@ -79,6 +79,8 @@
    large.  (400 - 31)/2 == 184 */
 #define MAX_AGENT_EXPR_LEN     184
 
+#define TFILE_PID (1)
+
 /* A hook used to notify the UI of tracepoint operations.  */
 
 void (*deprecated_trace_find_hook) (char *arg, int from_tty);
@@ -4372,6 +4374,10 @@ tfile_open (char *filename, int from_tty)
       throw_exception (ex);
     }
 
+  inferior_appeared (current_inferior (), TFILE_PID);
+  inferior_ptid = pid_to_ptid (TFILE_PID);
+  add_thread_silent (inferior_ptid);
+
   if (ts->traceframe_count <= 0)
     warning (_("No traceframes present in this file."));
 
@@ -4382,6 +4388,8 @@ tfile_open (char *filename, int from_tty)
   merge_uploaded_trace_state_variables (&uploaded_tsvs);
 
   merge_uploaded_tracepoints (&uploaded_tps);
+
+  post_create_inferior (&tfile_ops, from_tty);
 }
 
 /* Interpret the given line from the definitions part of the trace
@@ -4754,6 +4762,10 @@ tfile_close (void)
   if (trace_fd < 0)
     return;
 
+  pid = ptid_get_pid (inferior_ptid);
+  inferior_ptid = null_ptid;   /* Avoid confusion from thread stuff.  */
+  exit_inferior_silent (pid);
+
   close (trace_fd);
   trace_fd = -1;
   xfree (trace_filename);
@@ -5240,6 +5252,12 @@ tfile_has_registers (struct target_ops *ops)
   return traceframe_number != -1;
 }
 
+static int
+tfile_thread_alive (struct target_ops *ops, ptid_t ptid)
+{
+  return 1;
+}
+
 /* Callback for traceframe_walk_blocks.  Builds a traceframe_info
    object for the tfile target's current traceframe.  */
 
@@ -5326,6 +5344,7 @@ init_tfile_ops (void)
   tfile_ops.to_has_stack = tfile_has_stack;
   tfile_ops.to_has_registers = tfile_has_registers;
   tfile_ops.to_traceframe_info = tfile_traceframe_info;
+  tfile_ops.to_thread_alive = tfile_thread_alive;
   tfile_ops.to_magic = OPS_MAGIC;
 }