mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-22 18:54:02 +01:00
011ee92bbc
If a stack trace or similar has a list of addresses from an executable or DSO loaded at a variable address (e.g. due to ASLR), the addresses will not directly correspond to the addresses stored in the object file. If a user wishes to use llvm-symbolizer, they have to subtract the load address from every address. This is somewhat inconvenient, especially as the output of --print-address will result in the adjusted address being listed, rather than the address coming from the stack trace, making it harder to map results between the two. This change adds a new switch to llvm-symbolizer --adjust-vma which takes an offset, which is then used to automatically do this calculation. The printed address remains the input address (allowing for easy mapping), whilst the specified offset is applied to the addresses when performing the lookup. The switch is conceptually similar to llvm-objdump's new switch of the same name (see D57051), which in turn mirrors a GNU switch. There is no equivalent switch in addr2line. Reviewed by: grimar Differential Revision: https://reviews.llvm.org/D57151 llvm-svn: 352195
40 lines
971 B
ArmAsm
40 lines
971 B
ArmAsm
# REQUIRES: x86-registered-target
|
|
|
|
.type foo,@function
|
|
.size foo,12
|
|
foo:
|
|
.space 10
|
|
nop
|
|
nop
|
|
|
|
# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o -g
|
|
|
|
# RUN: llvm-symbolizer 0xa 0xb --print-address --obj=%t.o \
|
|
# RUN: | FileCheck %s --check-prefix=NORMAL
|
|
# RUN: llvm-symbolizer 0x10a 0x10b --print-address --adjust-vma 0x100 --obj=%t.o \
|
|
# RUN: | FileCheck %s --check-prefix=ADJUST
|
|
|
|
# Show that we can handle addresses less than the offset.
|
|
# RUN: llvm-symbolizer 0xa 0xb --print-address --adjust-vma 0xc --obj=%t.o \
|
|
# RUN: | FileCheck %s --check-prefix=OVERFLOW
|
|
|
|
# NORMAL: 0xa
|
|
# NORMAL-NEXT: foo
|
|
# NORMAL-NEXT: adjust-vma.s:7:0
|
|
# NORMAL-EMPTY:
|
|
# NORMAL-NEXT: 0xb
|
|
# NORMAL-NEXT: foo
|
|
# NORMAL-NEXT: adjust-vma.s:8:0
|
|
|
|
# ADJUST: 0x10a
|
|
# ADJUST-NEXT: foo
|
|
# ADJUST-NEXT: adjust-vma.s:7:0
|
|
# ADJUST-EMPTY:
|
|
# ADJUST-NEXT: 0x10b
|
|
# ADJUST-NEXT: foo
|
|
# ADJUST-NEXT: adjust-vma.s:8:0
|
|
|
|
# OVERFLOW: 0xa
|
|
# OVERFLOW-NEXT: ??
|
|
# OVERFLOW-NEXT: ??
|