public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
* Reusing GCC code in GDB
@ 2018-03-13 11:42 Alan Hayward
  2018-03-19 14:35 ` 'set debug lin-lwp 1' seems broken with GDB/MI Dmitry Antipov
  2018-03-19 18:56 ` Reusing GCC code in GDB Joel Brobecker
  0 siblings, 2 replies; 5+ messages in thread
From: Alan Hayward @ 2018-03-13 11:42 UTC (permalink / raw)
  To: gdb; +Cc: nd

I’m looking at a GDB issue where GDB is not consistent with GCC*, and requires (more or less) the rewrite of a self-contained section of code in the GDB aarch64 backend.
 
Given GCC already has the correct behaviour, I’m considering copying the block of GCC code (all from gcc/config/aarch64/aarch64.c) into GDB  (gdb/aarch64-tdep.c) and replacing the GCC structures with the equivalent GDB ones. Unless the gdb code requires it, I’m NOT planning on changing the function names, code comments or code flow logic.

Given that GDB and GCC are both FSF projects, I was hoping that this would be ok. However, I wanted to check first before I went ahead. 

Thanks,
Alan.
 
*pr gdb/22943. The issue is passing structures in FP registers for function arguments (HVAs and HFAs). GDB doesn’t take into account nested structures. I’m looking at using the gcc function aarch64_vfp_is_call_or_return_candidate() and the sub functions it uses.

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

* 'set debug lin-lwp 1' seems broken with GDB/MI
  2018-03-13 11:42 Reusing GCC code in GDB Alan Hayward
@ 2018-03-19 14:35 ` Dmitry Antipov
  2018-03-24 19:10   ` Simon Marchi
  2018-03-19 18:56 ` Reusing GCC code in GDB Joel Brobecker
  1 sibling, 1 reply; 5+ messages in thread
From: Dmitry Antipov @ 2018-03-19 14:35 UTC (permalink / raw)
  To: gdb

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

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

* Re: Reusing GCC code in GDB
  2018-03-13 11:42 Reusing GCC code in GDB Alan Hayward
  2018-03-19 14:35 ` 'set debug lin-lwp 1' seems broken with GDB/MI Dmitry Antipov
@ 2018-03-19 18:56 ` Joel Brobecker
  1 sibling, 0 replies; 5+ messages in thread
From: Joel Brobecker @ 2018-03-19 18:56 UTC (permalink / raw)
  To: Alan Hayward; +Cc: gdb, nd

> I’m looking at a GDB issue where GDB is not consistent with GCC*, and
>  requires (more or less) the rewrite of a self-contained section of
>  code in the GDB aarch64 backend.
>
> Given GCC already has the correct behaviour, I’m considering copying
> the block of GCC code (all from gcc/config/aarch64/aarch64.c) into GDB
> (gdb/aarch64-tdep.c) and replacing the GCC structures with the
> equivalent GDB ones. Unless the gdb code requires it, I’m NOT planning
> on changing the function names, code comments or code flow logic.
>
> Given that GDB and GCC are both FSF projects, I was hoping that this
> would be ok. However, I wanted to check first before I went ahead. 

My perspective is that this should be OK, because GCC requires
contributions to be assigned to the FSF, and the code is GPLv3.
It is similar, I think, with the libiberty code being shared
between GCC and binutils-gdb.


-- 
Joel

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

* Re: 'set debug lin-lwp 1' seems broken with GDB/MI
  2018-03-19 14:35 ` 'set debug lin-lwp 1' seems broken with GDB/MI Dmitry Antipov
@ 2018-03-24 19:10   ` Simon Marchi
  2018-03-27 13:10     ` Dmitry Antipov
  0 siblings, 1 reply; 5+ messages in thread
From: Simon Marchi @ 2018-03-24 19:10 UTC (permalink / raw)
  To: Dmitry Antipov; +Cc: gdb

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

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

* Re: 'set debug lin-lwp 1' seems broken with GDB/MI
  2018-03-24 19:10   ` Simon Marchi
@ 2018-03-27 13:10     ` Dmitry Antipov
  0 siblings, 0 replies; 5+ messages in thread
From: Dmitry Antipov @ 2018-03-27 13:10 UTC (permalink / raw)
  To: Simon Marchi; +Cc: gdb

On 03/24/2018 10:10 PM, Simon Marchi wrote:

> 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, looks good.

Dmitry

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

end of thread, other threads:[~2018-03-27 13:10 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-13 11:42 Reusing GCC code in GDB Alan Hayward
2018-03-19 14:35 ` 'set debug lin-lwp 1' seems broken with GDB/MI Dmitry Antipov
2018-03-24 19:10   ` Simon Marchi
2018-03-27 13:10     ` Dmitry Antipov
2018-03-19 18:56 ` Reusing GCC code in GDB Joel Brobecker

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).