From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=195.135.221.5; helo=smtp.nue.novell.com; envelope-from=glin@suse.com; receiver=edk2-devel@lists.01.org Received: from smtp.nue.novell.com (smtp.nue.novell.com [195.135.221.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id CC82E220E8DF1 for ; Mon, 23 Apr 2018 19:13:49 -0700 (PDT) Received: from emea4-mta.ukb.novell.com ([10.120.13.87]) by smtp.nue.novell.com with ESMTP (TLS encrypted); Tue, 24 Apr 2018 04:13:47 +0200 Received: from GaryWorkstation (nwb-a10-snat.microfocus.com [10.120.13.201]) by emea4-mta.ukb.novell.com with ESMTP (TLS encrypted); Tue, 24 Apr 2018 03:13:33 +0100 Date: Tue, 24 Apr 2018 10:13:29 +0800 From: Gary Lin To: Johannes Swoboda Cc: Rebecca Cran , thomas.palmer@hpe.com, lersek@redhat.com, Michael Kinney , edk2-devel@lists.01.org, clemens.hlauschek@inso.tuwien.ac.at Message-ID: <20180424021328.ff2igddlce3xpghp@GaryWorkstation> References: <12fe2332-c864-60e1-4f12-280e9939449f@redhat.com> <81abcc10-1c8c-1012-7c08-b9cd24efa85a@bluestop.org> MIME-Version: 1.0 In-Reply-To: User-Agent: NeoMutt/20170912 (1.9.0) Subject: Re: gdb reload-uefi missing EFI_SYSTEM_TABLE_POINTER [was: Source code debugging of OVMF] X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Apr 2018 02:13:50 -0000 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Fri, Apr 20, 2018 at 04:54:06PM +0200, Johannes Swoboda wrote: > Hello, > > Thank you all for your insights. > > You advised me to use the scripts from [1]. > I did so following this guide [2] (thank you also for putting it back up!), > with the minor adaptions that I made the script python3-compatible[3], and > applied the patches mentioned in [2] manually. I assume they failed because > they could only be applied to older versions of the files to be patched. > > In particular, I added the line DebugPkg/GdbSyms/GdbSyms.inf right below > line OvmfPkg/PlatformDxe/Platform.inf in line 830 of the vUDK2018 release. > That makes sense, right? > > The guide looks promising; I think this would give me everything I need. > However I ran into a problem when executing > > (gdb) reload-uefi -o > > ./Build/OvmfX64/DEBUG_GCC5/X64/DebugPkg/GdbSyms/GdbSyms/DEBUG/GdbSyms.dll > > gdb complained: > > Python Exception No type named > > EFI_SYSTEM_TABLE_POINTER.: > > Error occurred in Python command: No type named > > EFI_SYSTEM_TABLE_POINTER. > > The EFI_SYSTEM_TABLE_POINTER is defined in > [WORKSPACE]/MdeModulePkg/Core/Dxe/Misc/DebugImageInfo.c, so I'm guessing I > lack that file respectively its corresponding module. > I encountered the issue before and it seems caused by the linker option, "--whole-archive", which drops the symbols not used. As a workaround, I add the following lines to Initialize(): DEBUG ((DEBUG_VERBOSE, "%a: %llx\n", __FUNCTION__, &ESTP)); DEBUG ((DEBUG_VERBOSE, "%a: %llx\n", __FUNCTION__, &EDIITH)); DEBUG ((DEBUG_VERBOSE, "%a: %llx\n", __FUNCTION__, &EIDH)); DEBUG ((DEBUG_VERBOSE, "%a: %llx\n", __FUNCTION__, &EIOHU)); DEBUG ((DEBUG_VERBOSE, "%a: %llx\n", __FUNCTION__, &EIDDE)); DEBUG ((DEBUG_VERBOSE, "%a: %llx\n", __FUNCTION__, &EIDCNE)); DEBUG ((DEBUG_VERBOSE, "%a: %llx\n", __FUNCTION__, &EIDCRE)); DEBUG ((DEBUG_VERBOSE, "%a: %llx\n", __FUNCTION__, &EIDCME)); It at least makes the linker believe the symbols are important. Maybe you can try it. Cheers, Gary Lin > I compiled OVMF with nice OvmfPkg/build.sh -a X64 -n $(getconf > _NPROCESSORS_ONLN). > > If you could tell me whether my guess make sense and how I would include > [WORKSPACE]/MdeModulePkg/Core/Dxe/Misc/DebugImageInfo.c, that would be > great. > > Kind regards, > Johannes > > [1]: https://github.com/andreiw/andreiw-wip.git > [2]: https://code.bluestop.org/w/tianocore/debugging-with-gdb/ > [3]: https://github.com/johannesswoboda/andreiw-wip/blob/master/uefi/DebugPkg/Scripts/gdb_uefi.py > - in case someone else needs it one day > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel >