public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug gdb/27339] New: Stepping an instruction that makes the thread exit acts as continue
@ 2021-02-03 20:07 simark at simark dot ca
  0 siblings, 0 replies; only message in thread
From: simark at simark dot ca @ 2021-02-03 20:07 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=27339

            Bug ID: 27339
           Summary: Stepping an instruction that makes the thread exit
                    acts as continue
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: gdb
          Assignee: unassigned at sourceware dot org
          Reporter: simark at simark dot ca
  Target Milestone: ---

When using a stepping command and hitting an instruction that makes the thread
exit, it looks as a "continue" from the point of view of the user.

Using the binary from the test case attached to

  https://sourceware.org/bugzilla/show_bug.cgi?id=27338

$ ./gdb -q -nx --data-directory=data-directory
testsuite/outputs/gdb.threads/step-over-thread-exit/step-over-thread-exit -ex
"tb my_exit_syscall" -ex r        
Reading symbols from
testsuite/outputs/gdb.threads/step-over-thread-exit/step-over-thread-exit...
Temporary breakpoint 1 at 0x123c: file
/home/simark/src/binutils-gdb/gdb/testsuite/lib/my-syscalls.S, line 68.
Starting program:
/home/simark/build/binutils-gdb/gdb/testsuite/outputs/gdb.threads/step-over-thread-exit/step-over-thread-exit 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/../lib/libthread_db.so.1".
[New Thread 0x7ffff7c5e640 (LWP 1318054)]
[Switching to Thread 0x7ffff7c5e640 (LWP 1318054)]

Thread 2 "step-over-threa" hit Temporary breakpoint 1, my_exit_syscall () at
/home/simark/src/binutils-gdb/gdb/testsuite/lib/my-syscalls.S:68
68              syscall
(gdb)

Doing a "stepi" at this point continues the program until the end.

When a thread is focused, a step-like command is used, and the thread exit, I
think it would instead be more user friendly to get a stop saying that the
thread we were stepping has exited.

Probably also applies to step, next, finish, etc.

If the targets passed thread exit events to infrun when the exiting thread was
stepping (as also suggested in bug 27338), I think infrun could notice that the
thread had an fsm (tp->thread_fsm), and cause a stop.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-02-03 20:07 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-03 20:07 [Bug gdb/27339] New: Stepping an instruction that makes the thread exit acts as continue simark at simark dot ca

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).