30 lines
567 B
Plaintext
30 lines
567 B
Plaintext
|
#!/bin/sh
|
||
|
|
||
|
# SPDX-FileCopyrightText: 2022 Jan Engelhardt <jengelh@inai.de>
|
||
|
# SPDX-FileCopyrightText: 2022 Ralf Habacker <ralf.habacker@freenet.de>
|
||
|
# SPDX-License-Identifier: GPL-2.0-or-later
|
||
|
|
||
|
# get source filenames from dwarf debug sections
|
||
|
|
||
|
gawk '
|
||
|
BEGIN { state = 0 }
|
||
|
|
||
|
state == 1 && $2 ~ /DW_AT_name/ {
|
||
|
atname = $NF
|
||
|
}
|
||
|
|
||
|
state == 1 && $2 ~ /DW_AT_comp_dir/ {
|
||
|
atdir = $NF
|
||
|
if (atdir != "" && atname != "") {
|
||
|
print atdir "/" atname
|
||
|
state = 0
|
||
|
}
|
||
|
}
|
||
|
|
||
|
state == 0 && $0 ~ /DW_TAG_compile_unit/ {
|
||
|
state = 1
|
||
|
atdir = ""
|
||
|
atname = ""
|
||
|
}
|
||
|
'
|