binutils-gdb/gdb/testsuite/gdb.trace
Yao Qi a880623024 Initialize target description early in IPA
Target descriptions are allocated lazily, that is fine in GDBserver,
but it is not safe to call malloc in gdb_collect in IPA, because we
can set a fast tracepoint in malloc, and when the tracepoint is hit,
gdb_collect/malloc is called, deadlock or memory corruption may be
triggered.

 #0  0xf7cfc200 in malloc ()
 #1  0xf7efdc07 in operator new(unsigned int) ()
 #2  0xf7ef7636 in allocate_target_description() ()
 #3  0xf7efcbe1 in i386_create_target_description(unsigned long long, bool) ()
 #4  0xf7efb474 in i386_linux_read_description(unsigned long long) ()
 #5  0xf7efb190 in get_ipa_tdesc(int) ()
 #6  0xf7ef9baa in gdb_collect ()

The fix is to initialize all target descriptions earlier, when the
IPA is loaded.  In order to guarantee malloc is not called in IPA
in gdb_collect, I change the test to set a breakpoint on malloc, if
IPA gdb_collect calls malloc, program will hit the breakpoint, and
test fail.

continue
Continuing.

Thread 1 "" hit Breakpoint 5, 0xf7cfc200 in malloc ()
(gdb) FAIL: gdb.trace/ftrace.exp: advance through tracing

gdb/gdbserver:

2017-12-07  Yao Qi  <yao.qi@linaro.org>

	* linux-aarch64-ipa.c (initialize_low_tracepoint): Call
	aarch64_linux_read_description.
	* linux-amd64-ipa.c (idx2mask): New array.
	(get_ipa_tdesc): Move idx2mask out.
	(initialize_low_tracepoint): Initialize target descriptions.
	* linux-i386-ipa.c (idx2mask): New array.
	(get_ipa_tdesc): Move idx2mask out.
	(initialize_low_tracepoint): Initialize target descriptions.

gdb/testsuite:

2017-12-07  Yao Qi  <yao.qi@linaro.org>

	* gdb.trace/ftrace.exp (run_trace_experiment): Set breakpoint on
	malloc and catch syscall.
2017-12-07 17:07:01 +00:00
..
actions-changed.c update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
actions-changed.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
actions.c update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
actions.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
ax.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
backtrace.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
change-loc-1.c update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
change-loc-2.c update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
change-loc.c update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
change-loc.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
change-loc.h update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
circ.c update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
circ.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
collection.c update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
collection.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
deltrace.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
disconnected-tracing.c update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
disconnected-tracing.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
entry-values.c update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
entry-values.exp Stop assuming no-debug-info variables have type int 2017-09-04 20:21:15 +01:00
ftrace-lock.c update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
ftrace-lock.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
ftrace.c update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
ftrace.exp Initialize target description early in IPA 2017-12-07 17:07:01 +00:00
infotrace.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
mi-trace-frame-collected.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
mi-trace-save.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
mi-trace-unavailable.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
mi-traceframe-changed.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
mi-tracepoint-changed.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
mi-tsv-changed.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
no-attach-trace.c update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
no-attach-trace.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
packetlen.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
passc-dyn.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
passcount.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
pending.c update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
pending.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
pendshr1.c update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
pendshr2.c update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
pr16508.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
qtro.c update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
qtro.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
range-stepping.c update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
range-stepping.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
read-memory.c update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
read-memory.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
report.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
save-trace.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
signal.c update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
signal.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
stap-trace.c update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
stap-trace.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
status-stop.c update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
status-stop.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
strace.c update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
strace.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
tfile.c update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
tfile.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
tfind.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
trace-break.c update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
trace-break.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
trace-buffer-size.c update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
trace-buffer-size.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
trace-common.h update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
trace-condition.c update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
trace-condition.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
trace-enable-disable.c update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
trace-enable-disable.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
trace-mt.c update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
trace-mt.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
trace-unavailable.c update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
tracecmd.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
tracefile-pseudo-reg.c update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
tracefile-pseudo-reg.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
tspeed.c update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
tspeed.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
tstatus.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
tsv.exp PR 21352: Add testsuite for "tsave -r" command 2017-04-05 12:43:52 -04:00
unavailable-dwarf-piece.c update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
unavailable-dwarf-piece.exp gdb/testsuite: Add "get_endianness" convenience proc 2017-06-13 15:20:26 +02:00
unavailable.cc update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
unavailable.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
while-dyn.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
while-stepping.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00