Create inferior for tfile target

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.
This commit is contained in:
Yao Qi 2014-01-30 08:37:05 +08:00
parent ba74cf67e6
commit 66d032ac62
4 changed files with 41 additions and 3 deletions

View 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-02-04 Christian Eggers <ceggers@gmx.de> (tiny change)
* remote.c (remote_start_remote): Call remote_check_symbols even

View 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-02-04 Ulrich Weigand <uweigand@de.ibm.com>
* gdb.base/sigbpt.exp: Do not use "*" when setting breakpoint

View 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\"" \

View 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);
@ -5250,6 +5262,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. */
@ -5336,6 +5354,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;
}