1
0
mirror of https://github.com/upx/upx.git synced 2025-08-11 22:52:30 +08:00

gdb implicitly triggers a trap when catching SIGTRAP

Why? Where is it?
0  dl_main (phdr=<optimized out>, phnum=<optimized out>, user_entry=<optimized out>,
    auxv=<optimized out>) at rtld.c:2399
1  0x00007ffff7fe4b36 in _dl_sysdep_start (start_argptr=start_argptr@entry=0x7fffffffda20,
    dl_main=dl_main@entry=0x7ffff7fe67a0 <dl_main>)
    at ../sysdeps/unix/sysv/linux/dl-sysdep.c:141
2  0x00007ffff7fe649e in _dl_start_final (arg=0x7fffffffda20) at rtld.c:494
3  _dl_start (arg=0x7fffffffda20) at rtld.c:581
4  0x00007ffff7fe5188 in _start () from /lib64/ld-linux-x86-64.so.2

	modified:   mimic_ctest.sh
This commit is contained in:
John Reiser
2025-07-15 11:22:24 -07:00
parent ae06114698
commit 269f41ef32

View File

@ -55,23 +55,29 @@ cat > catch-sigsegv.gdb <<'EOF'
info reg
x/16i $pc-0x20
end
catch signal SIGTRAP
commands
x/i $pc
info reg
x/16i $pc-0x20
end
EOF
catcher=$(readlink -f catch-sigsegv.gdb)
function emu_gdb () {
echo; echo emu_gdb "$@"
/usr/bin/gdb -q -x "$catcher" <<end_go --args "$@"
run
q
end_go
echo
}
emu=(emu_gdb)
function gdb_upx () {
echo; echo gdb_upx "$@"
/usr/bin/gdb -q -x "$catcher" <<end_go --args "$upx_exe" "$@"
run
q
end_go
echo
}
run_upx=( gdb_upx )
## end jreiser test 2025-07-14
# run_upx sanity check
@ -135,9 +141,7 @@ fo="--force-overwrite"
"${run_upx[@]}" -3 --all-filters "${upx_self_exe}" ${fo} -o upx-packed-fa${exe}
"${run_upx[@]}" -3 --no-filter "${upx_self_exe}" ${fo} -o upx-packed-fn${exe}
"${run_upx[@]}" -3 --all-filters --debug-use-random-filter "${upx_self_exe}" ${fo} -o upx-packed-fr${exe}
set -x
"${run_upx[@]}" -3 --nrv2b "${upx_self_exe}" ${fo} -o upx-packed-nrv2b${exe}
set +x
"${run_upx[@]}" -3 --nrv2d "${upx_self_exe}" ${fo} -o upx-packed-nrv2d${exe}
"${run_upx[@]}" -3 --nrv2e "${upx_self_exe}" ${fo} -o upx-packed-nrv2e${exe}
"${run_upx[@]}" -1 --lzma "${upx_self_exe}" ${fo} -o upx-packed-lzma${exe}