diff options
author | Markus Metzger <markus.t.metzger@intel.com> | 2017-01-30 09:16:27 +0100 |
---|---|---|
committer | Markus Metzger <markus.t.metzger@intel.com> | 2017-02-14 10:15:27 +0100 |
commit | 4c2c7ac69d7318d61a5c0e4f5ddcee1c1597f4e0 (patch) | |
tree | 6fa3bb7610d6b3e59743853f5e445f9f5c0197df | |
parent | 61697d017e114d7667fbb340fb73f8184d48ee5a (diff) | |
download | gdb-4c2c7ac69d7318d61a5c0e4f5ddcee1c1597f4e0.zip gdb-4c2c7ac69d7318d61a5c0e4f5ddcee1c1597f4e0.tar.gz gdb-4c2c7ac69d7318d61a5c0e4f5ddcee1c1597f4e0.tar.bz2 |
btrace: preserve call stack on function switch
On 64-bit FC25, the _dl_runtime_resolve function uses a conditional branch to
'call' a particular variant optimized for that system:
(gdb) disas _dl_runtime_resolve_avx_opt
Dump of assembler code for function _dl_runtime_resolve_avx_opt:
0x00007ffff7deeb60 <+0>: push %rax
0x00007ffff7deeb61 <+1>: push %rcx
0x00007ffff7deeb62 <+2>: push %rdx
0x00007ffff7deeb63 <+3>: mov $0x1,%ecx
0x00007ffff7deeb68 <+8>: xgetbv
0x00007ffff7deeb6b <+11>: mov %eax,%r11d
0x00007ffff7deeb6e <+14>: pop %rdx
0x00007ffff7deeb6f <+15>: pop %rcx
0x00007ffff7deeb70 <+16>: pop %rax
0x00007ffff7deeb71 <+17>: and $0x4,%r11d
0x00007ffff7deeb75 <+21>: bnd je 0x7ffff7def4a0 <_dl_runtime_resolve_sse_vex>
End of assembler dump.
When computing the function-level trace, btrace treats this as a switch from
_dl_runtime_resolve_avx_opt to _dl_runtime_resolve_sse_vex. We know that we
switched functions but we can't really say in which caller/callee relationship
those two functions are.
In addition to preserving the indentaion level, also preserve the caller
information. This is a heuristic since we don't really know. But at least in
this case, this seems to be the right thing to do.
This fixes a fail in gdb.btrace/rn-dl-bind.exp on 64-bit FC25.
gdb/
* btrace.c (ftrace_new_switch): Preserve up link and flags.
-rw-r--r-- | gdb/ChangeLog | 4 | ||||
-rw-r--r-- | gdb/btrace.c | 6 |
2 files changed, 8 insertions, 2 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index e274191..ae33435 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,7 @@ +2017-02-14 Markus Metzger <markus.t.metzger@intel.com> + + * btrace.c (ftrace_new_switch): Preserve up link and flags. + 2017-02-13 Luis Machado <lgustavo@codesourcery.com> * symfile (_initialize_symfile): Add usage text to the load command's diff --git a/gdb/btrace.c b/gdb/btrace.c index 6d621e4..ddf6692 100644 --- a/gdb/btrace.c +++ b/gdb/btrace.c @@ -448,9 +448,11 @@ ftrace_new_switch (struct btrace_function *prev, { struct btrace_function *bfun; - /* This is an unexplained function switch. The call stack will likely - be wrong at this point. */ + /* This is an unexplained function switch. We can't really be sure about the + call stack, yet the best I can think of right now is to preserve it. */ bfun = ftrace_new_function (prev, mfun, fun); + bfun->up = prev->up; + bfun->flags = prev->flags; ftrace_debug (bfun, "new switch"); |