Skip to contentSkip to conversation

scripts/decode{code,_stacktrace} fixes

PATCH RESEND New Marc Zyngier 1 participant 3 messages Dec 10, 2018

lore
Share & tools
lore
#0 lore raw

cover scripts/decode{code,_stacktrace} fixes

Resending this, as there was hardly any feedback except for Will's Ack. Andrew, can you please consider this?

Here's a couple of fixes that have been languishing in my tree for a few months.

The first one is for an issue that can only be observed using decodecode natively on arm/arm64m and resulting in a pretty useless disassembly. The second one fixes the path trimming in decode_stacktrace, and probably affects everyone.

Marc Zyngier (2):
scripts/decodecode: Set ARCH when running natively on arm/arm64 scripts/decode_stacktrace: Only strip base path when a prefix of the
path

 scripts/decode_stacktrace.sh | 2 +-
 scripts/decodecode           | 7 +++++++
 2 files changed, 8 insertions(+), 1 deletion(-)
Signature · 1 line
2.19.1
#1 lore raw

PATCH RESEND 1/2 scripts/decodecode: Set ARCH when running natively on arm/arm64

When running decodecode natively on arm64, ARCH is likely not to be set, and we end-up with .4byte instead of .inst when generating the disassembly.

Similar effects would occur if running natively on a 32bit ARM platform, although that's even less popular.

A simple workaround is to populate ARCH when it is not set and that we're running on an arm/arm64 system.

---
 scripts/decodecode | 7 +++++++
 1 file changed, 7 insertions(+)
scripts/decodecode +7 -0
index 9cef558528aa..ba8b8d5834e6 100755
@@ -60,6 +60,13 @@ case $width in
 4) type=4byte ;;
 esac
 
+if [ -z "$ARCH" ]; then
+    case `uname -m` in
+	aarch64*) ARCH=arm64 ;;
+	arm*) ARCH=arm ;;
+    esac
+fi
+
 disas() {
 	${CROSS_COMPILE}as $AFLAGS -o $1.o $1.s > /dev/null 2>&1
 
Signature · 1 line
2.19.1
#2 lore raw

PATCH RESEND 2/2 scripts/decode_stacktrace: Only strip base path when a prefix of the path

In reply to Marc Zyngier

Running something like:

decodecode vmlinux .

leads to interested results where not only the leading "." gets stripped from the displayed paths, but also anywhere in the string, displaying something like:

	kvm_vcpu_check_block (arch/arm64/kvm/virt/kvm/kvm_mainc:2141)

which doesn't help further processing.

Fix it by only stripping the base path if it is a prefix of the path.

---
 scripts/decode_stacktrace.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/decode_stacktrace.sh +1 -1
index 64220e36ce3b..98a7d63a723e 100755
@@ -78,7 +78,7 @@ parse_symbol() {
 	fi
 
 	# Strip out the base of the path
-	code=${code//$basepath/""}
+	code=${code//^$basepath/""}
 
 	# In the case of inlines, move everything to same line
 	code=${code//$'\n'/' '}
Signature · 1 line
2.19.1