This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[pushed] Re: [PATCH 0/8] Allow making GDB not automatically connect to the native target (and add "target native").
- From: Pedro Alves <palves at redhat dot com>
- To: gdb-patches at sourceware dot org
- Date: Wed, 21 May 2014 18:57:19 +0100
- Subject: [pushed] Re: [PATCH 0/8] Allow making GDB not automatically connect to the native target (and add "target native").
- Authentication-results: sourceware.org; auth=none
- References: <1395069784-7406-1-git-send-email-palves at redhat dot com>
I've pushed this in now.
Pedro Alves
On 03/17/2014 03:22 PM, Pedro Alves wrote:
> Sometimes it's useful to be able to disable the automatic connection
> to the native target. E.g., sometimes GDB disconnects from the
> extended-remote target I was debugging, without me noticing it, and
> then I do "run". That starts the program locally, and only after a
> little head scratch session do I figure out the program is running
> locally instead of remotely as intended. Same thing with "attach",
> "info os", etc.
>
> With this series, we now can have this instead:
>
> (gdb) set auto-connect-native-target off
> (gdb) target extended-remote :9999
> ...
> *gdb disconnects*
> (gdb) run
> Don't know how to run. Try "help target".
>
> To still be able to connect to the native target with
> auto-connect-native-target set to off, I've renamed all native targets
> to "target native", and made "target native" work instead of erroring
> out as today.
>
> E.g., before, on GNU/Linux and most native targets, the native target
> is called "child", and trying to open it yields:
>
> (gdb) target child
> Use the "run" command to start a child process.
>
> After the series we get:
>
> (gdb) target native
> Done. Use the "run" command to start a process.
> (gdb) maint print target-stack
> The current target stack is:
> - native (Native process)
> - exec (Local exec file)
> - None (None)
> (gdb) run
> Starting program: ./a.out
> ...
>
> I've also wanted this for the testsuite, when running against the
> native-extended-gdbserver.exp board (runs against gdbserver in
> extended-remote mode). With that board, it's always a bug to launch a
> program with the native target. Turns out we still have one such case
> this series catches:
>
> (gdb) break main
> Breakpoint 1 at 0x4009e5: file ../../../src/gdb/testsuite/gdb.base/coremaker.c, line 138.
> (gdb) run
> Don't know how to run. Try "help target".
> (gdb) FAIL: gdb.base/corefile.exp: run: with core
>
> For convenience, I've also put this at:
> git@github.com:palves/gdb.git target_native_v1
>
> Pedro Alves (8):
> Rename "target djgpp" -> "target native"
> Rename "target darwin-child" -> "target native"
> Rename "target GNU" -> "target native"
> Windows: Rename "target child" -> "target native"
> nto-procfs.c: Add "target native".
> go32-nat.c: Don't override to_open.
> NEWS: Mention native target renames.
> Allow making GDB not automatically connect to the native target.
>
> gdb/NEWS | 21 +++
> gdb/darwin-nat.c | 10 +-
> gdb/doc/gdb.texinfo | 58 ++++++
> gdb/gnu-nat.c | 8 +-
> gdb/go32-nat.c | 16 +-
> gdb/inf-child.c | 62 +++++-
> gdb/inf-child.h | 11 ++
> gdb/inf-ptrace.c | 6 +-
> gdb/inf-ttrace.c | 10 +-
> gdb/linux-nat.c | 8 +
> gdb/nto-procfs.c | 97 +++++++---
> gdb/procfs.c | 13 +-
> gdb/target.c | 48 ++++-
> gdb/testsuite/boards/native-extended-gdbserver.exp | 2 +
> .../gdb.base/auto-connect-native-target.c | 23 +++
> .../gdb.base/auto-connect-native-target.exp | 209 +++++++++++++++++++++
> gdb/windows-nat.c | 10 +-
> 17 files changed, 531 insertions(+), 81 deletions(-)
> create mode 100644 gdb/testsuite/gdb.base/auto-connect-native-target.c
> create mode 100644 gdb/testsuite/gdb.base/auto-connect-native-target.exp
>
--
Pedro Alves