grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

GRUB2: Keeping debug symbols in an image


From: Adrian Burns
Subject: GRUB2: Keeping debug symbols in an image
Date: Mon, 20 Feb 2012 23:16:38 +0000

Hi, i had sent this out to address@hidden but perhaps its best sent to devel

Im looking for GRUB2's grub-mkimage to produce an efi file for target
execution along with a matching elf file that has all the debug
symbols included so that i can use a debugger to step through the
GRUB2 code. So far i see that strip is used in
grub/grub-core/genmod.sh.in to strip debug sections from the *.o files
as the build generates the *.mod file (i used readelf to verify this
after commenting out the strip command below) Then in grub-mkimage.c,
the generate_image() function appears to make no attempt to preserve
symbols. Is there a way to tell the build system to leave modules and
images with full symbol table and debugging information?

for the image....has anyone modified grub-mkimage.c to retain debug
symbols in generated image?

thanks,
Adrian



####################################### see line 58 of
grub/grub-core/genmod.sh.in where files get stripped
      if test address@hidden@ != xemu; then
          @STRIP@ --strip-unneeded \
              -K grub_mod_init -K grub_mod_fini \
              -K _grub_mod_init -K _grub_mod_fini \
              -R .note -R .comment $tmpfile || exit 1
      fi
#######################################


####################################### debug sections have been
stripped in *.mod files
> objdump -h grub-core/fat.mod

grub-core/fat.mod:     file format elf32-i386

Sections:
Idx Name          Size      VMA       LMA       File off  Algn
 0 .text         00000e56  00000000  00000000  00000034  2**2
                CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE
 1 .rodata.str1.1 00000099  00000000  00000000  00000e8a  2**0
                CONTENTS, ALLOC, LOAD, READONLY, DATA
 2 .data         00000024  00000000  00000000  00000f24  2**2
                CONTENTS, ALLOC, LOAD, RELOC, DATA
 3 .module_license 0000000f  00000000  00000000  00000f48  2**2
                CONTENTS, ALLOC, LOAD, DATA
 4 .bss          00000004  00000000  00000000  00000f58  2**2
                ALLOC
 5 .comment.SUSE.OPTs 00000006  00000000  00000000  00000f58  2**0
                CONTENTS, READONLY
 6 .note.GNU-stack 00000000  00000000  00000000  00000f5e  2**0
                CONTENTS, READONLY, CODE
 7 .modname      00000004  00000000  00000000  00000f5e  2**0
                CONTENTS, READONLY




####################################### debug sections are being
compiled into *.o files
> readelf -e grub-core/fs/fat_module-fat.o
...
...
Section Headers:
 [Nr] Name              Type            Addr     Off    Size   ES Flg Lk Inf Al
 [ 0]                   NULL            00000000 000000 000000 00      0   0  0
 [ 1] .text             PROGBITS        00000000 000034 000e56 00  AX  0   0  4
 [ 2] .rel.text         REL             00000000 0059ec 000348 08     26   1  4
 [ 3] .data             PROGBITS        00000000 000e8c 000024 00  WA  0   0  4
 [ 4] .rel.data         REL             00000000 005d34 000038 08     26   3  4
 [ 5] .bss              NOBITS          00000000 000eb0 000004 00  WA  0   0  4
 [ 6] .debug_abbrev     PROGBITS        00000000 000eb0 0003ea 00      0   0  1
 [ 7] .debug_info       PROGBITS        00000000 00129a 0018aa 00      0   0  1
 [ 8] .rel.debug_info   REL             00000000 005d6c 000fc0 08     26   7  4
 [ 9] .debug_line       PROGBITS        00000000 002b44 000360 00      0   0  1
 [10] .rel.debug_line   REL             00000000 006d2c 000008 08     26   9  4
 [11] .rodata.str1.1    PROGBITS        00000000 002ea4 000099 01 AMS  0   0  1
 [12] .module_license   PROGBITS        00000000 002f40 00000f 00  WA  0   0  4
 [13] .debug_frame      PROGBITS        00000000 002f50 000260 00      0   0  4
 [14] .rel.debug_frame  REL             00000000 006d34 000100 08     26  13  4
 [15] .debug_loc        PROGBITS        00000000 0031b0 000e4f 00      0   0  1
 [16] .debug_pubnames   PROGBITS        00000000 003fff 000036 00      0   0  1
 [17] .rel.debug_pubnam REL             00000000 006e34 000008 08     26  16  4
 [18] .debug_aranges    PROGBITS        00000000 004035 000020 00      0   0  1
 [19] .rel.debug_arange REL             00000000 006e3c 000010 08     26  18  4
 [20] .debug_ranges     PROGBITS        00000000 004055 000060 00      0   0  1
 [21] .debug_str        PROGBITS        00000000 0040b5 000de1 01  MS  0   0  1
 [22] .comment          PROGBITS        00000000 004e96 00003a 01  MS  0   0  1
 [23] .comment.SUSE.OPT PROGBITS        00000000 004ed0 000006 01  MS  0   0  1
 [24] .note.GNU-stack   PROGBITS        00000000 004ed6 000000 00   X  0   0  1
 [25] .shstrtab         STRTAB          00000000 004ed6 000109 00      0   0  1
 [26] .symtab           SYMTAB          00000000 005440 000390 10     27  36  4
 [27] .strtab           STRTAB          00000000 0057d0 00021c 00      0   0  1
Key to Flags:
 W (write), A (alloc), X (execute), M (merge), S (strings)
 I (info), L (link order), G (group), x (unknown)
 O (extra OS processing required) o (OS specific), p (processor specific)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]