Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
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.
Find all posts by this user
Quote this message in a reply
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

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.

It should be enabled by default anyway. Add "V=1" to the make command line to see the raw build commands.

Michael
Visit this user's website Find all posts by this user
Quote this message in a reply
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.
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)