"finish" command leads to SIGTRAP

David Griffiths dgriffiths@undo.io
Thu Feb 21 11:21:00 GMT 2019


I have a strange situation where issuing the "finish" command always leads
to a SIGTRAP (this is gdb 8.1 on Ubuntu 16.04). Once this SIGTRAP occurs
every continue also produces SIGTRAP. Completely reproducible. In the run
up to the finish I'm doing single steps from a previous breakpoint:

=====

(gdb) display/i $pc
1: x/i $pc
=> 0x7fffe1923b84:    movabs $0x7ffff6d33b00,%r10
(gdb) si
0x00007fffe1923b8e in ?? ()
1: x/i $pc
=> 0x7fffe1923b8e:    callq  *%r10
(gdb)
0x00007ffff6d33b00 in os::javaTimeMillis() () from
/mnt/hgfs/david/jdk8u/build/linux-x86_64-normal-server-release/jdk/lib/amd64/server/libjvm.so
1: x/i $pc
=> 0x7ffff6d33b00 <_ZN2os14javaTimeMillisEv>:    push   %rbp
(gdb) finish
Run till exit from #0  0x00007ffff6d33b00 in os::javaTimeMillis() () from
/mnt/hgfs/david/jdk8u/build/linux-x86_64-normal-server-release/jdk/lib/amd64/server/libjvm.so

Thread 2 "java" received signal SIGTRAP, Trace/breakpoint trap.
0x00007ffff6d33b01 in os::javaTimeMillis() () from
/mnt/hgfs/david/jdk8u/build/linux-x86_64-normal-server-release/jdk/lib/amd64/server/libjvm.so
1: x/i $pc
=> 0x7ffff6d33b01 <_ZN2os14javaTimeMillisEv+1>:    xor    %esi,%esi
(gdb) c
Continuing.

Thread 2 "java" received signal SIGTRAP, Trace/breakpoint trap.
0x00007ffff6d33b03 in os::javaTimeMillis() () from
/mnt/hgfs/david/jdk8u/build/linux-x86_64-normal-server-release/jdk/lib/amd64/server/libjvm.so
1: x/i $pc
=> 0x7ffff6d33b03 <_ZN2os14javaTimeMillisEv+3>:    mov    %rsp,%rbp

=====

Even more strangely I can execute finish on that function in general, e.g.
if I set a breakpoint on it:

=====

(gdb) br os::javaTimeMillis
Breakpoint 1 at 0x7ffff6d33b00
(gdb) c
Continuing.
[Switching to Thread 0x7ffff7fd8700 (LWP 12502)]

Thread 2 "java" hit Breakpoint 1, 0x00007ffff6d33b00 in
os::javaTimeMillis() () from
/mnt/hgfs/david/jdk8u/build/linux-x86_64-normal-server-release/jdk/lib/amd64/server/libjvm.so
(gdb) finish
Run till exit from #0  0x00007ffff6d33b00 in os::javaTimeMillis() () from
/mnt/hgfs/david/jdk8u/build/linux-x86_64-normal-server-release/jdk/lib/amd64/server/libjvm.so
0x00007fffe1b4f75c in ?? ()
(gdb)

=====

So there must be something about the environment when it occurs but I don't
know what. And by the way the code runs fine without the finish/single
steps/etc.

I need it to work because I'm trying to automate something via gdb/MI. Any
suggestions as to how to debug this would be very welcome.

Thanks,

David
-- 

David Griffiths, Senior Software Engineer

Undo <https://undo.io> | Resolve even the most challenging software defects
with software flight recorder technology

Software reliability report: optimizing the software supplier and customer
relationship
<https://info.undo.io/software-reliability-report-optimizing-supplier-and-customer-relationship>



More information about the Gdb mailing list