public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug gdb/28777] New: Running/starting an inferior with "set schedule-multiple on" while another one is running messes things up
@ 2022-01-13  2:13 simark at simark dot ca
  2022-01-13  2:13 ` [Bug gdb/28777] Running/starting an inferior with "set schedule-multiple on" while another one is started " simark at simark dot ca
  0 siblings, 1 reply; 2+ messages in thread
From: simark at simark dot ca @ 2022-01-13  2:13 UTC (permalink / raw)
  To: gdb-prs

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

            Bug ID: 28777
           Summary: Running/starting an inferior with "set
                    schedule-multiple on" while another one is running
                    messes things up
           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: ---

Starting an inferior while another one is live, stopped at a breakpoint,
confuses GDB.

Using a trivial test program:

~~~
#include <unistd.h>

int main() {
    for (int i = 0; i < 100; i++) {
        sleep(1);
    }
}
~~~

On Linux native, set things up with:

$ ./gdb -nx -q --data-directory=data-directory \
    -ex "file a.out" \
    -ex "add-inferior" \
    -ex "inferior 2" \
    -ex "file a.out" \
    -ex start \
    -ex "inferior 1" \
    -ex "set schedule-multiple on"
(gdb) i th
  Id   Target Id               Frame 
  2.1  process 1041085 "a.out" main () at test.c:4

No selected thread.  See `help thread'.
(gdb) info inferiors 
  Num  Description       Connection           Executable        
* 1    <null>                                
/home/simark/build/binutils-gdb-one-target/gdb/a.out 
  2    process 1041085   1 (native)          
/home/simark/build/binutils-gdb-one-target/gdb/a.out 


Then try "run" or "start":

(gdb) start
Temporary breakpoint 2 at 0x1141: -qualified main. (2 locations)
Starting program: /home/simark/build/binutils-gdb-one-target/gdb/a.out 
Cannot remove breakpoints because program is no longer writable.
Further execution is probably impossible.

Thread 1.1 "a.out" hit Temporary breakpoint 2, main () at test.c:4
4           for (int i = 0; i < 100; i++) {
warning: Error removing breakpoint 2
(gdb) i th
  Id   Target Id               Frame 
* 1.1  process 1040903 "a.out" main () at test.c:4
  2.1  process 1040899         Couldn't get registers: No such process.
(gdb) info inferiors 
  Num  Description       Connection           Executable        
* 1    process 1040903   1 (native)          
/home/simark/build/binutils-gdb-one-target/gdb/a.out 
  2    process 1040899   1 (native)          
/home/simark/build/binutils-gdb-one-target/gdb/a.out 
(gdb) inferior 2
[Switching to inferior 2 [process 1040899]
(/home/simark/build/binutils-gdb-one-target/gdb/a.out)]
[Switching to thread 2.1 (process 1040899)]
Couldn't get registers: No such process.


(gdb) r
Starting program: /home/simark/build/binutils-gdb-one-target/gdb/a.out 

Program terminated with signal SIGTRAP, Trace/breakpoint trap.
The program no longer exists.
(gdb) i th
  Id   Target Id               Frame 
  1.1  process 1041026 "a.out" 0x00007ffff7e9aa4a in
clock_nanosleep@GLIBC_2.2.5 () from /usr/lib/libc.so.6

No selected thread.  See `help thread'.
(gdb) info inferiors 
  Num  Description       Connection           Executable        
  1    process 1041026   1 (native)          
/home/simark/build/binutils-gdb-one-target/gdb/a.out 
* 2    <null>                                
/home/simark/build/binutils-gdb-one-target/gdb/a.out 


Things are about equally messed up with gdbserver --multi.  Start gdbserver
with:

$ ../gdbserver/gdbserver --once --multi :1234

Set things up with:

$ ./gdb -nx -q --data-directory=data-directory \
    -ex "tar ext :1234" \
    -ex "file a.out" \
    -ex "set remote exec-file
/home/simark/build/binutils-gdb-one-target/gdb/a.out" \
    -ex "add-inferior" \
    -ex "inferior 2" \
    -ex "file a.out" \
    -ex "set remote exec-file
/home/simark/build/binutils-gdb-one-target/gdb/a.out" \
    -ex start \
    -ex "inferior 1" \
    -ex "set schedule-multiple on"
(gdb) i th
  Id   Target Id                      Frame 
  2.1  Thread 1041178.1041178 "a.out" main () at test.c:4

No selected thread.  See `help thread'.
(gdb) info inferiors 
  Num  Description       Connection                Executable        
* 1    <null>            1 (extended-remote :1234)
/home/simark/build/binutils-gdb-one-target/gdb/a.out 
  2    process 1041178   1 (extended-remote :1234)
/home/simark/build/binutils-gdb-one-target/gdb/a.out 

(gdb) start
Temporary breakpoint 2 at 0x1141: -qualified main. (2 locations)
Starting program: /home/simark/build/binutils-gdb-one-target/gdb/a.out 
Reading /lib64/ld-linux-x86-64.so.2 from remote target...
Reading /lib64/ld-linux-x86-64.so.2 from remote target...
Reading
/usr/local/lib/debug/.build-id/04/0cc3dd10461562f177df39e3be2f3704258c3c.debug
from remote target...
Reading
/usr/local/lib/debug/.build-id/34/ce7d9e9e52decbbe2ad4dbbb77e7b72d5f56c6.debug
from remote target...

Program terminated with signal SIGTRAP, Trace/breakpoint trap.
The program no longer exists.
(gdb) i th
  Id   Target Id                      Frame 
  1.1  Thread 1041254.1041254 "a.out" 0x00007ffff7fce090 in _start () from
target:/lib64/ld-linux-x86-64.so.2

No selected thread.  See `help thread'.
(gdb) info inferiors 
  Num  Description       Connection                Executable        
  1    process 1041254   1 (extended-remote :1234)
/home/simark/build/binutils-gdb-one-target/gdb/a.out 
* 2    <null>            1 (extended-remote :1234)
/home/simark/build/binutils-gdb-one-target/gdb/a.out 


(gdb) run
Starting program: /home/simark/build/binutils-gdb-one-target/gdb/a.out 
Reading /lib64/ld-linux-x86-64.so.2 from remote target...
Reading /lib64/ld-linux-x86-64.so.2 from remote target...
Reading
/usr/local/lib/debug/.build-id/04/0cc3dd10461562f177df39e3be2f3704258c3c.debug
from remote target...
Reading
/usr/local/lib/debug/.build-id/34/ce7d9e9e52decbbe2ad4dbbb77e7b72d5f56c6.debug
from remote target...

Program terminated with signal SIGTRAP, Trace/breakpoint trap.
The program no longer exists.
(gdb) i th
  Id   Target Id                      Frame 
  1.1  Thread 1041316.1041316 "a.out" 0x00007ffff7fd18d8 in dl_main () from
target:/lib64/ld-linux-x86-64.so.2

No selected thread.  See `help thread'.
(gdb) info inferiors 
  Num  Description       Connection                Executable        
  1    process 1041316   1 (extended-remote :1234)
/home/simark/build/binutils-gdb-one-target/gdb/a.out 
* 2    <null>            1 (extended-remote :1234)
/home/simark/build/binutils-gdb-one-target/gdb/a.out

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug gdb/28777] Running/starting an inferior with "set schedule-multiple on" while another one is started messes things up
  2022-01-13  2:13 [Bug gdb/28777] New: Running/starting an inferior with "set schedule-multiple on" while another one is running messes things up simark at simark dot ca
@ 2022-01-13  2:13 ` simark at simark dot ca
  0 siblings, 0 replies; 2+ messages in thread
From: simark at simark dot ca @ 2022-01-13  2:13 UTC (permalink / raw)
  To: gdb-prs

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

Simon Marchi <simark at simark dot ca> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|Running/starting an         |Running/starting an
                   |inferior with "set          |inferior with "set
                   |schedule-multiple on" while |schedule-multiple on" while
                   |another one is running      |another one is started
                   |messes things up            |messes things up

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-01-13  2:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-13  2:13 [Bug gdb/28777] New: Running/starting an inferior with "set schedule-multiple on" while another one is running messes things up simark at simark dot ca
2022-01-13  2:13 ` [Bug gdb/28777] Running/starting an inferior with "set schedule-multiple on" while another one is started " 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).