From: Nadav Amit <nadav.amit@gmail.com>
To: Andrew Jones <andrew.jones@linux.dev>
Cc: kvmarm@lists.linux.dev, kvm@vger.kernel.org,
Nikos Nikoleris <nikos.nikoleris@arm.com>,
Paolo Bonzini <pbonzini@redhat.com>,
Thomas Huth <thuth@redhat.com>, Nadav Amit <namit@vmware.com>
Subject: [kvm-unit-tests PATCH v3 1/6] efi: keep efi debug information in a separate file
Date: Wed, 28 Jun 2023 00:13:50 +0000 [thread overview]
Message-ID: <20230628001356.2706-3-namit@vmware.com> (raw)
In-Reply-To: <20230628001356.2706-1-namit@vmware.com>
From: Nadav Amit <namit@vmware.com>
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.
Signed-off-by: Nadav Amit <namit@vmware.com>
---
v2->v3:
* Add *.debug to .gitignore [Andrew]
v1->v2:
* Making clean should remove .debug [Andrew]
* x86 EFI support [Andrew]
---
.gitignore | 1 +
arm/Makefile.common | 5 ++++-
x86/Makefile.common | 5 ++++-
3 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/.gitignore b/.gitignore
index 29f352c..2168e01 100644
--- a/.gitignore
+++ b/.gitignore
@@ -7,6 +7,7 @@ tags
*.flat
*.efi
*.elf
+*.debug
*.patch
.pc
patches
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
next prev parent reply other threads:[~2023-06-28 0:14 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-28 0:13 [PATCH] .debug ignore - to squash with efi:keep efi Nadav Amit
2023-06-28 0:13 ` [kvm-unit-tests PATCH v3 0/6] arm64: improve debuggability Nadav Amit
2023-07-01 12:19 ` Andrew Jones
2023-06-28 0:13 ` Nadav Amit [this message]
2023-06-28 0:13 ` [kvm-unit-tests PATCH v3 2/6] lib/stack: print base addresses on relocation setups Nadav Amit
2023-07-01 11:34 ` Andrew Jones
2023-07-01 17:18 ` Nadav Amit
2023-06-28 0:13 ` [kvm-unit-tests PATCH v3 3/6] arm64: enable frame pointer and support stack unwinding Nadav Amit
2023-06-28 0:13 ` [kvm-unit-tests PATCH v3 4/6] arm64: stack: update trace stack on exception Nadav Amit
2023-06-28 0:13 ` [kvm-unit-tests PATCH v3 5/6] efi: print address of image Nadav Amit
2023-06-28 0:13 ` [kvm-unit-tests PATCH v3 6/6] arm64: dump stack on bad exception Nadav Amit
2023-06-28 8:19 ` [PATCH] .debug ignore - to squash with efi:keep efi Andrew Jones
2023-06-28 8:22 ` Andrew Jones
2023-06-28 17:30 ` Nadav Amit
2023-06-28 17:33 ` Nadav Amit
2023-06-29 7:43 ` Andrew Jones
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230628001356.2706-3-namit@vmware.com \
--to=nadav.amit@gmail.com \
--cc=andrew.jones@linux.dev \
--cc=kvm@vger.kernel.org \
--cc=kvmarm@lists.linux.dev \
--cc=namit@vmware.com \
--cc=nikos.nikoleris@arm.com \
--cc=pbonzini@redhat.com \
--cc=thuth@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox