On Sun, Jun 25, 2023 at 11:07:11PM +0000, Nadav Amit wrote: > From: Nadav Amit <namit@xxxxxxxxxx> > > Debugging tests that run on EFI is hard because the debug information is > not included in the EFI file. Dump it into a separeate .debug file to > allow the use of gdb or pretty_print_stacks script. We're still missing the run_tests.sh change needed for pretty_print_stacks, but I can post that myself. Thanks, drew > > Signed-off-by: Nadav Amit <namit@xxxxxxxxxx> > > --- > > v1->v2: > * Making clean should remove .debug [Andrew] > * x86 EFI support [Andrew] > --- > arm/Makefile.common | 5 ++++- > x86/Makefile.common | 5 ++++- > 2 files changed, 8 insertions(+), 2 deletions(-) > > diff --git a/arm/Makefile.common b/arm/Makefile.common > index d60cf8c..9b45a8f 100644 > --- a/arm/Makefile.common > +++ b/arm/Makefile.common > @@ -78,6 +78,9 @@ ifeq ($(CONFIG_EFI),y) > > %.efi: %.so > $(call arch_elf_check, $^) > + $(OBJCOPY) --only-keep-debug $^ $@.debug > + $(OBJCOPY) --strip-debug $^ > + $(OBJCOPY) --add-gnu-debuglink=$@.debug $^ > $(OBJCOPY) \ > -j .text -j .sdata -j .data -j .dynamic -j .dynsym \ > -j .rel -j .rela -j .rel.* -j .rela.* -j .rel* -j .rela* \ > @@ -103,7 +106,7 @@ $(libeabi): $(eabiobjs) > $(AR) rcs $@ $^ > > arm_clean: asm_offsets_clean > - $(RM) $(TEST_DIR)/*.{o,flat,elf,so,efi} $(libeabi) $(eabiobjs) \ > + $(RM) $(TEST_DIR)/*.{o,flat,elf,so,efi,debug} $(libeabi) $(eabiobjs) \ > $(TEST_DIR)/.*.d $(TEST_DIR)/efi/.*.d lib/arm/.*.d > > generated-files = $(asm-offsets) > diff --git a/x86/Makefile.common b/x86/Makefile.common > index 9f2bc93..c42c3e4 100644 > --- a/x86/Makefile.common > +++ b/x86/Makefile.common > @@ -54,6 +54,9 @@ ifeq ($(CONFIG_EFI),y) > @chmod a-x $@ > > %.efi: %.so > + $(OBJCOPY) --only-keep-debug $^ $@.debug > + $(OBJCOPY) --strip-debug $^ > + $(OBJCOPY) --add-gnu-debuglink=$@.debug $^ > $(OBJCOPY) \ > -j .text -j .sdata -j .data -j .dynamic -j .dynsym -j .rel \ > -j .rela -j .reloc -S --target=$(FORMAT) $< $@ > @@ -124,4 +127,4 @@ arch_clean: > $(RM) $(TEST_DIR)/*.o $(TEST_DIR)/*.flat $(TEST_DIR)/*.elf \ > $(TEST_DIR)/.*.d lib/x86/.*.d \ > $(TEST_DIR)/efi/*.o $(TEST_DIR)/efi/.*.d \ > - $(TEST_DIR)/*.so $(TEST_DIR)/*.efi > + $(TEST_DIR)/*.so $(TEST_DIR)/*.efi $(TEST_DIR)/*.debug > -- > 2.34.1 >