From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20575 invoked by alias); 21 May 2014 17:57:24 -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 20565 invoked by uid 89); 21 May 2014 17:57:23 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.2 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS 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; Wed, 21 May 2014 17:57:22 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s4LHvLgC024239 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 21 May 2014 13:57:21 -0400 Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s4LHvJE0015596 for ; Wed, 21 May 2014 13:57:20 -0400 Message-ID: <537CE8FF.3070103@redhat.com> Date: Wed, 21 May 2014 17:57:00 -0000 From: Pedro Alves User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.5.0 MIME-Version: 1.0 To: gdb-patches@sourceware.org Subject: [pushed] Re: [PATCH 0/8] Allow making GDB not automatically connect to the native target (and add "target native"). References: <1395069784-7406-1-git-send-email-palves@redhat.com> In-Reply-To: <1395069784-7406-1-git-send-email-palves@redhat.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-SW-Source: 2014-05/txt/msg00497.txt.bz2 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