public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "simark at simark dot ca" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug gdb/27339] New: Stepping an instruction that makes the thread exit acts as continue
Date: Wed, 03 Feb 2021 20:07:15 +0000	[thread overview]
Message-ID: <bug-27339-4717@http.sourceware.org/bugzilla/> (raw)

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.

                 reply	other threads:[~2021-02-03 20:07 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-27339-4717@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=gdb-prs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).