From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4537 invoked by alias); 17 Mar 2014 15:23:10 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 4521 invoked by uid 89); 17 Mar 2014 15:23:09 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.8 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 17 Mar 2014 15:23:07 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s2HFN6VV020647 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 17 Mar 2014 11:23:06 -0400 Received: from brno.lan (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s2HFN59v009032 for ; Mon, 17 Mar 2014 11:23:05 -0400 From: Pedro Alves To: gdb-patches@sourceware.org Subject: [PATCH 0/8] Allow making GDB not automatically connect to the native target (and add "target native"). Date: Mon, 17 Mar 2014 15:23:00 -0000 Message-Id: <1395069784-7406-1-git-send-email-palves@redhat.com> X-SW-Source: 2014-03/txt/msg00362.txt.bz2 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 -- 1.7.11.7