From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from zmcc-3-mx.zmailcloud.com (zmcc-3-mx.zmailcloud.com [34.200.143.36]) by sourceware.org (Postfix) with ESMTPS id 3809F3858D28 for ; Wed, 3 Nov 2021 16:07:20 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 3809F3858D28 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=symas.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=symas.com Received: from zmcc-3.zmailcloud.com (zmcc-3-mta-1.zmailcloud.com [104.154.87.183]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by zmcc-3-mx.zmailcloud.com (Postfix) with ESMTPS id C5F2A405A8; Wed, 3 Nov 2021 11:07:25 -0500 (CDT) Received: from zmcc-3.zmailcloud.com (localhost [127.0.0.1]) by zmcc-3-mta-1.zmailcloud.com (Postfix) with ESMTPS id 81F208013BBC; Wed, 3 Nov 2021 11:07:19 -0500 (CDT) Received: from localhost (localhost [127.0.0.1]) by zmcc-3-mta-1.zmailcloud.com (Postfix) with ESMTP id 715F9801142D; Wed, 3 Nov 2021 11:07:19 -0500 (CDT) Received: from zmcc-3.zmailcloud.com ([127.0.0.1]) by localhost (zmcc-3-mta-1.zmailcloud.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id 3M41A26d4rWm; Wed, 3 Nov 2021 11:07:19 -0500 (CDT) Received: from [192.168.1.138] (unknown [84.203.29.36]) by zmcc-3-mta-1.zmailcloud.com (Postfix) with ESMTPSA id 8FA1F803511A; Wed, 3 Nov 2021 11:07:18 -0500 (CDT) Subject: Re: Process memory map To: John Baldwin , Chris Packham Cc: "gdb@sourceware.org" References: <11b6bfd2-dc8b-4f07-a6ee-74fceda32054@symas.com> <95ecace6-76fd-781c-381d-385692373b0e@FreeBSD.org> From: Howard Chu Message-ID: <2ccb34d7-c59e-e1f7-8772-8199e33c23cb@symas.com> Date: Wed, 3 Nov 2021 16:07:17 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/60.0 SeaMonkey/2.53.8.1 MIME-Version: 1.0 In-Reply-To: <95ecace6-76fd-781c-381d-385692373b0e@FreeBSD.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-4.6 required=5.0 tests=BAYES_00, KAM_DMARC_STATUS, NICE_REPLY_A, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP, URIBL_RED autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gdb@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Nov 2021 16:07:21 -0000 John Baldwin wrote: > On 11/3/21 12:20 AM, Chris Packham via Gdb wrote: >> On Wed, Nov 3, 2021 at 1:33 PM Howard Chu wrote: >>> >>> Is the complete map of process address space saved in a core file? Wh= en debugging >>> with a core file, is there a gdb command to mmap the files that were = mapped at the >>> time the core was taken, so that references to addresses in those reg= ions will be >>> valid? >> >> I recently had a similar need. I found `info proc all` (technically >> `info proc mappings`) contained the mapping info I needed. For a >> regular core file the shared libraries were automatically loaded (in >> my case I needed to `set auto-load safe-path` and `set sysroot` for my >> cross-build environment). The one slight problem I had was with a very >> specific core file where the crash was in ld.so in that specific case >> it wasn't automatically loaded and I had to muck around with `add >> symbol-file` and manually working out some offsets to get it loaded >> into the right place. >> >> I'd be interested in hearing tips from anyone else. >=20 > Note that manually loading symbols is much easier in recent versions of > GDB.=C2=A0 You can find the base address that a given file is loaded at > via 'info proc mappings' and then just use > 'add-symbol-file -o /path/to/library' to load all of the > symbols without having to calculate the address of individual sections. >=20 Thanks, `info proc mappings` is helpful but I'm talking about referencing the contents of arbitrary mmap'd files, not shared libraries. gdb doesn't currently map them, and by default their contents are not included in cor= e files. --=20 -- Howard Chu CTO, Symas Corp. http://www.symas.com Director, Highland Sun http://highlandsun.com/hyc/ Chief Architect, OpenLDAP http://www.openldap.org/project/