From patchwork Fri Jul 11 09:17:20 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adrian Sendroiu X-Patchwork-Id: 2008 Received: (qmail 24847 invoked by alias); 11 Jul 2014 09:18:42 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 24832 invoked by uid 89); 11 Jul 2014 09:18:42 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.4 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW, SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.3.2 X-HELO: na01-by2-obe.outbound.protection.outlook.com Received: from mail-by2lp0238.outbound.protection.outlook.com (HELO na01-by2-obe.outbound.protection.outlook.com) (207.46.163.238) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Fri, 11 Jul 2014 09:18:40 +0000 Received: from BN3PR0301CA0079.namprd03.prod.outlook.com (25.160.152.175) by BY2PR03MB144.namprd03.prod.outlook.com (10.242.35.150) with Microsoft SMTP Server (TLS) id 15.0.985.8; Fri, 11 Jul 2014 09:18:36 +0000 Received: from BL2FFO11FD008.protection.gbl (2a01:111:f400:7c09::134) by BN3PR0301CA0079.outlook.office365.com (2a01:111:e400:401e::47) with Microsoft SMTP Server (TLS) id 15.0.985.8 via Frontend Transport; Fri, 11 Jul 2014 09:18:36 +0000 Received: from tx30smr01.am.freescale.net (192.88.168.50) by BL2FFO11FD008.mail.protection.outlook.com (10.173.161.4) with Microsoft SMTP Server (TLS) id 15.0.980.11 via Frontend Transport; Fri, 11 Jul 2014 09:18:35 +0000 Received: from fsr-ub1264-100.ea.freescale.net (fsr-ub1264-100.ea.freescale.net [10.171.74.130]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id s6B9IW0M012815; Fri, 11 Jul 2014 02:18:34 -0700 From: Adrian Sendroiu To: CC: Adrian Sendroiu Subject: [PATCH] call remote_check_symbols after attaching Date: Fri, 11 Jul 2014 12:17:20 +0300 Message-ID: <1405070240-11462-1-git-send-email-adrian.sendroiu@freescale.com> X-EOPAttributedMessage: 0 X-Forefront-Antispam-Report: CIP:192.88.168.50; CTRY:US; IPV:CAL; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(6009001)(199002)(189002)(377424004)(6806004)(84676001)(79102001)(229853001)(107046002)(104166001)(33646001)(110136001)(2351001)(105606002)(81542001)(95666004)(81342001)(104016003)(102836001)(68736004)(74502001)(74662001)(31966008)(83322001)(19580405001)(19580395003)(44976005)(26826002)(36756003)(85306003)(62966002)(64706001)(97736001)(83072002)(89996001)(106466001)(85852003)(20776003)(47776003)(77156001)(46102001)(88136002)(87286001)(87936001)(86362001)(50986999)(93916002)(76482001)(92726001)(92566001)(21056001)(99396002)(48376002)(50226001)(80022001)(50466002)(4396001)(77982001); DIR:OUT; SFP:; SCL:1; SRVR:BY2PR03MB144; H:tx30smr01.am.freescale.net; FPR:; MLV:ovrnspm; PTR:InfoDomainNonexistent; MX:1; LANG:en; MIME-Version: 1.0 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID: X-Forefront-PRVS: 02698DF457 Received-SPF: Fail (: domain of freescale.com does not designate 192.88.168.50 as permitted sender) receiver=; client-ip=192.88.168.50; helo=tx30smr01.am.freescale.net; Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=adrian.sendroiu@freescale.com; X-OriginatorOrg: freescale.com When debugging a remote bare-metal target with "target extended-remote" + attach, gdb won't send a qSymbol packet to initiate symbol lookup. This happens because all the previous places in which gdb might have done this are guarded by conditions that don't hold in the said scenario: there are no shared libraries, no vsyscall page and the binary file didn't change in the time passed between the "file" and the "attach" commands. To solve this problem remote_check_symbols is called in the post_attach hook. gdb: 2014-07-11 Adrian Sendroiu * remote.c: call remote_check_symbols after attaching --- gdb/remote.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/gdb/remote.c b/gdb/remote.c index 3aa030c..2c97b5d 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -4484,6 +4484,19 @@ extended_remote_attach (struct target_ops *ops, const char *args, int from_tty) extended_remote_attach_1 (ops, args, from_tty); } +/* Implementation of the to_post_attach method */ + +static void +extended_remote_post_attach (struct target_ops *ops, int pid) +{ + /* In certain cases gdb might not have had the chance to start symbol lookup + up until now. This could happen if the debugged binary is not using + shared libraries, the vsyscall page is not present and the binary itself + hadn't changed since the debugging process was started */ + if (symfile_objfile != NULL) + remote_check_symbols(); +} + /* Check for the availability of vCont. This function should also check the response. */ @@ -11530,6 +11543,7 @@ Specify the serial device it is connected to (e.g. /dev/ttya)."; extended_remote_ops.to_mourn_inferior = extended_remote_mourn; extended_remote_ops.to_detach = extended_remote_detach; extended_remote_ops.to_attach = extended_remote_attach; + extended_remote_ops.to_post_attach = extended_remote_post_attach; extended_remote_ops.to_kill = extended_remote_kill; extended_remote_ops.to_supports_disable_randomization = extended_remote_supports_disable_randomization;