Re: 'set debug lin-lwp 1' seems broken with GDB/MI

Simon Marchi <[email protected]>
Newsgroups gmane.comp.gdb.devel
Message-ID <[email protected]>
On 2018-03-19 10:35, Dmitry Antipov wrote:
> On x86_64 GNU/Linux target, 'set debug lin-lwp 1' works as expected in
> CLI mode...
> 
> $ ~/.local/gdb-8.1.50/bin/gdb -q
> (gdb) set debug lin-lwp 1
> (gdb) attach 30460
> Attaching to process 30460
> sigchld
> LNA: waitpid 30460, saving status Stopped (signal) (stopped)
> PTRACE_ATTACH LWP 30461, 0, 0 (OK)
> [New LWP 30461]
> PTRACE_ATTACH LWP 30462, 0, 0 (OK)
> sigchld
> sigchld
> [New LWP 30462]
> LNSL: running -> suspending LWP 30462
> LNSL: running -> suspending LWP 30461
> LNSL: already stopped/no stop_requested yet LWP 30460
> linux_nat_wait: [process -1], [TARGET_WNOHANG]
> RSRL: NOT resuming LWP LWP 30462, not stopped
> RSRL: NOT resuming LWP LWP 30461, not stopped
> RSRL: NOT resuming LWP LWP 30460, has pending status
> LLW: enter
> LLW: Using pending wait status Stopped (signal) (stopped) for LWP 
> 30460.
> LLW: exit
> LNSL: running -> suspending LWP 30461
> linux-nat: already stopping LWP 30461 at GDB's request
> LNSL: running -> suspending LWP 30462
> linux-nat: already stopping LWP 30462 at GDB's request
> linux_nat_wait: [process -1], []
> RSRL: NOT resuming LWP LWP 30462, not stopped
> RSRL: NOT resuming LWP LWP 30461, not stopped
> RSRL: NOT resuming LWP LWP 30460, not resumed
> LLW: enter
> LNW: waitpid(-1, ...) returned 30462, ERRNO-OK
> LLW: waitpid 30462 received Stopped (signal) (stopped)
> LLW: resume_stop SIGSTOP caught for LWP 30462.
> LNW: waitpid(-1, ...) returned 30461, ERRNO-OK
> LLW: waitpid 30461 received Stopped (signal) (stopped)
> LLW: resume_stop SIGSTOP caught for LWP 30461.
> LNW: waitpid(-1, ...) returned 0, ERRNO-OK
> RSRL: NOT resuming LWP LWP 30462, has pending status
> RSRL: NOT resuming LWP LWP 30461, has pending status
> RSRL: NOT resuming LWP LWP 30460, not resumed
> SEL: Found 2 events, selecting #0
> LLW: exit
> sigchld
> sigchld
> sigchld
> RSRL: NOT resuming LWP LWP 30462, not resumed
> RSRL: NOT resuming LWP LWP 30461, has pending status
> RSRL: NOT resuming LWP LWP 30460, not resumed
> [Thread debugging using libthread_db enabled]
> Using host libthread_db library "/lib64/libthread_db.so.1".
> linux_nat_wait: [process -1], []
> RSRL: NOT resuming LWP Thread 0x7fba253fa700 (LWP 30462), not resumed
> RSRL: NOT resuming LWP Thread 0x7fba25bfb700 (LWP 30461), has pending 
> status
> RSRL: NOT resuming LWP Thread 0x7fba26cb1740 (LWP 30460), not resumed
> LLW: enter
> LLW: Using pending wait status Stopped (signal) (stopped) for Thread
> 0x7fba25bfb700 (LWP 30461).
> LLW: exit
> 0x00007fba25fba8ad in pthread_join () from /lib64/libpthread.so.0
> 
> ...but not with MI:
> 
> $ ~/.local/gdb-8.1.50/bin/gdb -q -i=mi2
> =thread-group-added,id="i1"
> =cmd-param-changed,param="auto-load safe-path",value="/"
> (gdb)
> -gdb-set debug lin-lwp 1
> ^done
> (gdb)
> -target-attach 30460
> =thread-group-started,id="i1",pid="30460"
> ~"../../gdb/ui-file.h:59: internal-error: virtual void
> ui_file::write_async_safe(const char*, long int): write_async_safe\nA
> problem internal to GDB has been detected,\nfurther debugging may
> prove unreliable.\nQuit this debugging session? (y or n) "
> 
> Observed on 8.1 release as well.
> 
> Dmitry

Hi Dmitry,

I posted a patch here, could you take a look and test if it fixes the 
problem for you?

https://sourceware.org/ml/gdb-patches/2018-03/msg00488.html

Thanks,

Simon
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.