Commit 406b5c12 authored by Brian Johannesmeyer's avatar Brian Johannesmeyer Committed by Josh Poimboeuf

scripts/faddr2line: Remove call to addr2line from find_dir_prefix()

Use the single long-running faddr2line process from find_dir_prefix().
Signed-off-by: default avatarBrian Johannesmeyer <bjohannesmeyer@gmail.com>
Link: https://lore.kernel.org/r/20240415145538.1938745-7-bjohannesmeyer@gmail.comSigned-off-by: default avatarJosh Poimboeuf <jpoimboe@kernel.org>
parent e36b69e9
...@@ -85,15 +85,17 @@ command -v ${ADDR2LINE} >/dev/null 2>&1 || die "${ADDR2LINE} isn't installed" ...@@ -85,15 +85,17 @@ command -v ${ADDR2LINE} >/dev/null 2>&1 || die "${ADDR2LINE} isn't installed"
# init/main.c! This only works for vmlinux. Otherwise it falls back to # init/main.c! This only works for vmlinux. Otherwise it falls back to
# printing the absolute path. # printing the absolute path.
find_dir_prefix() { find_dir_prefix() {
local objfile=$1
local start_kernel_addr=$(echo "${ELF_SYMS}" | sed 's/\[.*\]//' | local start_kernel_addr=$(echo "${ELF_SYMS}" | sed 's/\[.*\]//' |
${AWK} '$8 == "start_kernel" {printf "0x%s", $2}') ${AWK} '$8 == "start_kernel" {printf "0x%s", $2}')
[[ -z $start_kernel_addr ]] && return [[ -z $start_kernel_addr ]] && return
local file_line=$(${ADDR2LINE} -e $objfile $start_kernel_addr) run_addr2line ${start_kernel_addr} ""
[[ -z $file_line ]] && return [[ -z $ADDR2LINE_OUT ]] && return
local file_line=${ADDR2LINE_OUT#* at }
if [[ -z $file_line ]] || [[ $file_line = $ADDR2LINE_OUT ]]; then
return
fi
local prefix=${file_line%init/main.c:*} local prefix=${file_line%init/main.c:*}
if [[ -z $prefix ]] || [[ $prefix = $file_line ]]; then if [[ -z $prefix ]] || [[ $prefix = $file_line ]]; then
return return
...@@ -350,7 +352,7 @@ echo "${ELF_SECHEADERS}" | ${GREP} -q '\.debug_info' || die "CONFIG_DEBUG_INFO n ...@@ -350,7 +352,7 @@ echo "${ELF_SECHEADERS}" | ${GREP} -q '\.debug_info' || die "CONFIG_DEBUG_INFO n
init_addr2line $objfile init_addr2line $objfile
DIR_PREFIX=supercalifragilisticexpialidocious DIR_PREFIX=supercalifragilisticexpialidocious
find_dir_prefix $objfile find_dir_prefix
FIRST=1 FIRST=1
while [[ $# -gt 0 ]]; do while [[ $# -gt 0 ]]; do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment