Building with debug symbols
|
2019-02-04, 17:12
Post: #1
|
|||
|
|||
Building with debug symbols
I am trying to build with debugging symbols. I was able to build with gdbudp included. But I am missing something when attempting to build with debug symbols . I tried setting EXTRA_CFLAGS to -g and CFLAGS to -g but when open the the image with gdb I get the message
Reading symbols from bin-x86_64-efi/snp--intelx.efi.tmp...(no debugging symbols found)...done. Any pointers on how to enable "-g" during compile. |
|||
2019-02-04, 17:21
Post: #2
|
|||
|
|||
RE: Building with debug symbols
(2019-02-04 17:12)ebruno Wrote: I am trying to build with debugging symbols. I was able to build with gdbudp included. But I am missing something when attempting to build with debug symbols . I tried setting EXTRA_CFLAGS to -g and CFLAGS to -g but when open the the image with gdb I get the message It should be enabled by default anyway. Add "V=1" to the make command line to see the raw build commands. Michael |
|||
2019-02-04, 18:01
Post: #3
|
|||
|
|||
RE: Building with debug symbols
I can see the -g flag in the compile , see sample below:
gcc -E -DARCH=x86_64 -DPLATFORM=efi -DSECUREBOOT=0 -fstrength-reduce -fomit-frame-pointer -falign-jumps=1 -falign-loops=1 -falign-functions=1 -m64 -mno-mmx -mno-sse -fshort-wchar -Ui386 -Ulinux -DNVALGRIND -fpie -mno-red-zone -Iinclude -I. -Iarch/x86/include -Iarch/x86_64/include -Iarch/x86_64/include/efi -Os -g -ffreestanding -Wall -W -Wformat-nonliteral -fno-stack-protector -fno-dwarf2-cfi-asm -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables -Wno-address -g -Werror -ffunction-sections -fdata-sections -include include/compiler.h -DASM_TCHAR='@' -DASM_TCHAR_OPS='@' -DOBJECT=dhcpopts -Wno-error -M net/dhcpopts.c -MG -MP | sed 's/\.o\s*:/_DEPS +=/' > bin-x86_64-efi/deps/net/dhcpopts.c.d [DEPS] net/fcoe.c Here is the final link command. ld -m elf_x86_64 -q -S --gc-sections -static -T scripts/efi.lds -u _efi_start --defsym check__efi_start=_efi_start -u obj_snp --defsym check_obj_snp=obj_snp -u obj_intelx --defsym check_obj_intelx=obj_intelx -u obj_config --defsym check_obj_config=obj_config -u obj_config_efi --defsym check_obj_config_efi=obj_config_efi --defsym pci_vendor_id=0 --defsym pci_device_id=0 -e _efi_start bin-x86_64-efi/version.snp--intelx.efi.o bin-x86_64-efi/blib.a -o bin-x86_64-efi/snp--intelx.efi.tmp \ --defsym _build_id=`perl -e 'printf "0x%08x", int ( rand ( 0xffffffff ) );'` \ --defsym _build_timestamp=1549298277 \ -Map bin-x86_64-efi/snp--intelx.efi.tmp.map objdump -ht bin-x86_64-efi/snp--intelx.efi.tmp | perl ./util/sortobjdump.pl >> bin-x86_64-efi/snp--intelx.efi.tmp.map ./util/elf2efi64 --subsystem=10 bin-x86_64-efi/snp--intelx.efi.tmp bin-x86_64-efi/snp--intelx.efi When attempt to load the file in to gdb I get gdb snp--intelx.efi GNU gdb (Ubuntu 8.1-0ubuntu3) 8.1.0.20180409-git Copyright © 2018 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "x86_64-linux-gnu". Type "show configuration" for configuration details. For bug reporting instructions, please see: <http://www.gnu.org/software/gdb/bugs/>. Find the GDB manual and other documentation resources online at: <http://www.gnu.org/software/gdb/documentation/>. For help, type "help". Type "apropos word" to search for commands related to "word"... BFD: /home/XXXX/ipxe/src/bin-x86_64-efi/snp--intelx.efi: Warning: Ignoring section flag IMAGE_SCN_MEM_NOT_PAGED in section .text BFD: /home/XXXX/ipxe/src/bin-x86_64-efi/snp--intelx.efi: Warning: Ignoring section flag IMAGE_SCN_MEM_NOT_PAGED in section .rodata BFD: /home/XXXX/ipxe/src/bin-x86_64-efi/snp--intelx.efi: Warning: Ignoring section flag IMAGE_SCN_MEM_NOT_PAGED in section .data BFD: /home/XXXX/ipxe/src/bin-x86_64-efi/snp--intelx.efi: Warning: Ignoring section flag IMAGE_SCN_MEM_NOT_PAGED in section .bss BFD: /home/XXXX/ipxe/src/bin-x86_64-efi/snp--intelx.efi: Warning: Ignoring section flag IMAGE_SCN_MEM_NOT_PAGED in section .reloc BFD: /home/XXXX/ipxe/src/bin-x86_64-efi/snp--intelx.efi: Warning: Ignoring section flag IMAGE_SCN_MEM_NOT_PAGED in section .debug Reading symbols from snp--intelx.efi...(no debugging symbols found)...done. |
|||
2019-02-27, 01:12
Post: #4
|
|||
|
|||
RE: Building with debug symbols
Digging in to this a bit more found in src/Makefile.efl line 9 LDFLAGS += -q -S
-S tells the linker to strip Omit debugger symbol information (but not all symbols) from the output file. However when build with the -S flag I get ld -m elf_x86_64 -q --gc-sections -static -T scripts/efi.lds -u _efi_start --defsym check__efi_start=_efi_start -u obj_snp --defsym check_obj_snp=obj_snp -u obj_intelx --defsym c\ heck_obj_intelx=obj_intelx -u obj_config --defsym check_obj_config=obj_config -u obj_config_efi --defsym check_obj_config_efi=obj_config_efi --defsym pci_vendor_id=0 --defsym pci_dev\ ice_id=0 -e _efi_start bin-x86_64-efi/version.snp--intelx.efi.o bin-x86_64-efi/blib.a -o bin-x86_64-efi/snp--intelx.efi.tmp \ --defsym _build_id=`perl -e 'printf "0x%08x", int ( rand ( 0xffffffff ) );'` \ --defsym _build_timestamp=1551225293 \ -Map bin-x86_64-efi/snp--intelx.efi.tmp.map objdump -ht bin-x86_64-efi/snp--intelx.efi.tmp | perl ./util/sortobjdump.pl >> bin-x86_64-efi/snp--intelx.efi.tmp.map ./util/elf2efi64 --subsystem=10 bin-x86_64-efi/snp--intelx.efi.tmp bin-x86_64-efi/snp--intelx.efi Unrecognised relocation type 10 Makefile.efi:25: recipe for target 'bin-x86_64-efi/snp--intelx.efi' failed make[2]: *** [bin-x86_64-efi/snp--intelx.efi] Error 1 rm bin-x86_64-efi/version.snp--intelx.efi.o snp--intelx.efi.tmp now has debug symbols ericb@bsdpemulator-01:~/SystemReprovisioningTools/ZeroTouchOS$ gdb ipxe/src/bin-x86_64-efi/snp--intelx.efi.tmp GNU gdb (Ubuntu 8.1-0ubuntu3) 8.1.0.20180409-git Copyright © 2018 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "x86_64-linux-gnu". Type "show configuration" for configuration details. For bug reporting instructions, please see: <http://www.gnu.org/software/gdb/bugs/>. Find the GDB manual and other documentation resources online at: <http://www.gnu.org/software/gdb/documentation/>. For help, type "help". Type "apropos word" to search for commands related to "word"... Reading symbols from ipxe/src/bin-x86_64-efi/snp--intelx.efi.tmp...done. (gdb) list 14 15 FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL ); 16 17 #include <stddef.h> 18 #include <stdio.h> 19 #include <ipxe/init.h> 20 #include <ipxe/version.h> 21 #include <usr/autoboot.h> 22 23 /** (gdb) list main 23 /** 24 * Main entry point 25 * 26 * @ret rc Return status code 27 */ 28 __asmcall int main ( void ) { 29 int rc; 30 31 /* Perform one-time-only initialisation (e.g. heap) */ 32 initialise(); If add -S to LDFLAGS the build completes but no debug symbols in the binaries. /util/elf2efi64 seems to application having an issue. /util/elf2efi64 --subsystem=10 bin-x86_64-efi/snp--intelx.efi.tmp bin-x86_64-efi/snp--intelx.efi Unrecognised relocation type 10 Makefile.efi:25: recipe for target 'bin-x86_64-efi/snp--intelx.efi' failed |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)