linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] scripts/decode{code,_stacktrace} fixes
@ 2018-11-22 12:14 Marc Zyngier
  2018-11-22 12:14 ` [PATCH 1/2] scripts/decodecode: Set ARCH when running natively on arm/arm64 Marc Zyngier
  2018-11-22 12:14 ` [PATCH 2/2] scripts/decode_stacktrace: Only strip base path when a prefix of the path Marc Zyngier
  0 siblings, 2 replies; 5+ messages in thread
From: Marc Zyngier @ 2018-11-22 12:14 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel, Will Deacon

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(-)

-- 
2.19.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/2] scripts/decodecode: Set ARCH when running natively on arm/arm64
  2018-11-22 12:14 [PATCH 0/2] scripts/decode{code,_stacktrace} fixes Marc Zyngier
@ 2018-11-22 12:14 ` Marc Zyngier
  2018-11-23 18:31   ` Will Deacon
  2018-11-22 12:14 ` [PATCH 2/2] scripts/decode_stacktrace: Only strip base path when a prefix of the path Marc Zyngier
  1 sibling, 1 reply; 5+ messages in thread
From: Marc Zyngier @ 2018-11-22 12:14 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel, Will Deacon

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.

Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
---
 scripts/decodecode | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/scripts/decodecode b/scripts/decodecode
index 9cef558528aa..ba8b8d5834e6 100755
--- a/scripts/decodecode
+++ b/scripts/decodecode
@@ -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
 
-- 
2.19.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/2] scripts/decode_stacktrace: Only strip base path when a prefix of the path
  2018-11-22 12:14 [PATCH 0/2] scripts/decode{code,_stacktrace} fixes Marc Zyngier
  2018-11-22 12:14 ` [PATCH 1/2] scripts/decodecode: Set ARCH when running natively on arm/arm64 Marc Zyngier
@ 2018-11-22 12:14 ` Marc Zyngier
  2018-11-22 13:11   ` Mark Rutland
  1 sibling, 1 reply; 5+ messages in thread
From: Marc Zyngier @ 2018-11-22 12:14 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel, Will Deacon

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.

Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
---
 scripts/decode_stacktrace.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/decode_stacktrace.sh b/scripts/decode_stacktrace.sh
index 64220e36ce3b..98a7d63a723e 100755
--- a/scripts/decode_stacktrace.sh
+++ b/scripts/decode_stacktrace.sh
@@ -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'/' '}
-- 
2.19.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 2/2] scripts/decode_stacktrace: Only strip base path when a prefix of the path
  2018-11-22 12:14 ` [PATCH 2/2] scripts/decode_stacktrace: Only strip base path when a prefix of the path Marc Zyngier
@ 2018-11-22 13:11   ` Mark Rutland
  0 siblings, 0 replies; 5+ messages in thread
From: Mark Rutland @ 2018-11-22 13:11 UTC (permalink / raw)
  To: Marc Zyngier; +Cc: Andrew Morton, linux-kernel, Will Deacon

On Thu, Nov 22, 2018 at 12:14:40PM +0000, Marc Zyngier wrote:
> 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.
> 
> Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
> ---
>  scripts/decode_stacktrace.sh | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/scripts/decode_stacktrace.sh b/scripts/decode_stacktrace.sh
> index 64220e36ce3b..98a7d63a723e 100755
> --- a/scripts/decode_stacktrace.sh
> +++ b/scripts/decode_stacktrace.sh
> @@ -78,7 +78,7 @@ parse_symbol() {
>  	fi
>  
>  	# Strip out the base of the path
> -	code=${code//$basepath/""}
> +	code=${code//^$basepath/""}

FWIW, you can do this using the usual POSIX shell string substitution:

	code=${code##$basepath}

[1] http://pubs.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html#tag_02_06_02

Mark.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] scripts/decodecode: Set ARCH when running natively on arm/arm64
  2018-11-22 12:14 ` [PATCH 1/2] scripts/decodecode: Set ARCH when running natively on arm/arm64 Marc Zyngier
@ 2018-11-23 18:31   ` Will Deacon
  0 siblings, 0 replies; 5+ messages in thread
From: Will Deacon @ 2018-11-23 18:31 UTC (permalink / raw)
  To: Marc Zyngier; +Cc: Andrew Morton, linux-kernel

On Thu, Nov 22, 2018 at 12:14:39PM +0000, Marc Zyngier wrote:
> 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.
> 
> Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
> ---
>  scripts/decodecode | 7 +++++++
>  1 file changed, 7 insertions(+)

Acked-by: Will Deacon <will.deacon@arm.com>

Will

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-11-23 18:31 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-22 12:14 [PATCH 0/2] scripts/decode{code,_stacktrace} fixes Marc Zyngier
2018-11-22 12:14 ` [PATCH 1/2] scripts/decodecode: Set ARCH when running natively on arm/arm64 Marc Zyngier
2018-11-23 18:31   ` Will Deacon
2018-11-22 12:14 ` [PATCH 2/2] scripts/decode_stacktrace: Only strip base path when a prefix of the path Marc Zyngier
2018-11-22 13:11   ` Mark Rutland

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).