GP-5667: Fix gdbi and lldb argument passing in bash.

This commit is contained in:
Dan
2025-05-14 14:58:39 +00:00
parent 70820402d7
commit 6ab32ff426
9 changed files with 21 additions and 15 deletions
@@ -52,4 +52,4 @@ function launch-gdb() {
"${args[@]}" "${args[@]}"
} }
launch-gdb launch-gdb "$@"
@@ -64,7 +64,7 @@ function do-installation() {
"${sshargs[@]}" "${sshargs[@]}"
} }
launch-gdb-ssh launch-gdb-ssh "$@"
if check-result-and-prompt-mitigation $? " if check-result-and-prompt-mitigation $? "
It appears ghidragdb is missing from the remote system. This can happen if you It appears ghidragdb is missing from the remote system. This can happen if you
forgot to install the required package. This can also happen if you installed forgot to install the required package. This can also happen if you installed
@@ -49,9 +49,11 @@ target_image="$1"
shift shift
function launch-gdb() { function launch-gdb() {
local qargs
printf -v qargs '%q ' "$@"
local -a args local -a args
compute-gdb-remote-args "$target_image" "remote | '$OPT_SSH_PATH' $OPT_EXTRA_SSH_ARGS '$OPT_HOST' '$OPT_GDBSERVER_PATH' $OPT_EXTRA_GDBSERVER_ARGS - '$target_image' $@" "$GHIDRA_TRACE_RMI_ADDR" compute-gdb-remote-args "$target_image" "remote | '$OPT_SSH_PATH' $OPT_EXTRA_SSH_ARGS '$OPT_HOST' '$OPT_GDBSERVER_PATH' $OPT_EXTRA_GDBSERVER_ARGS - '$target_image' $qargs" "$GHIDRA_TRACE_RMI_ADDR"
"${args[@]}" "${args[@]}"
} }
launch-gdb launch-gdb "$@"
@@ -52,4 +52,4 @@ function launch-gdb() {
"${args[@]}" "${args[@]}"
} }
launch-gdb launch-gdb "$@"
@@ -28,13 +28,15 @@ add-gdb-init-args() {
add-gdb-image-and-args() { add-gdb-image-and-args() {
target_image=$1 target_image=$1
target_args=$2 shift
if [ -n "$target_image" ]; then if [ -n "$target_image" ]; then
args+=(-ex "file '$target_image'") args+=(-ex "file '$target_image'")
fi fi
if [ -n "$target_args" ]; then if [ "$#" -ne 0 ]; then
args+=(-ex "set args $target_args") local qargs
printf -v qargs '%q ' "$@"
args+=(-ex "set args $qargs")
fi fi
} }
@@ -104,7 +106,7 @@ compute-gdb-remote-args() {
args+=("$OPT_GDB_PATH") args+=("$OPT_GDB_PATH")
add-gdb-init-args add-gdb-init-args
add-gdb-image-and-args "$target_image" "" add-gdb-image-and-args "$target_image"
args+=(-ex "echo Connecting to $target_cx\n") args+=(-ex "echo Connecting to $target_cx\n")
args+=(-ex "target $target_cx") args+=(-ex "target $target_cx")
add-gdb-connect-and-sync "$rmi_address" add-gdb-connect-and-sync "$rmi_address"
@@ -51,4 +51,4 @@ function launch-lldb() {
"${args[@]}" "${args[@]}"
} }
launch-lldb launch-lldb "$@"
@@ -49,4 +49,4 @@ function launch-lldb() {
"${args[@]}" "${args[@]}"
} }
launch-lldb launch-lldb "$@"
@@ -63,7 +63,7 @@ function do-installation() {
"${sshargs[@]}" "${sshargs[@]}"
} }
launch-lldb-ssh launch-lldb-ssh "$@"
if check-result-and-prompt-mitigation $? " if check-result-and-prompt-mitigation $? "
It appears ghidralldb is missing from the remote system. This can happen if you It appears ghidralldb is missing from the remote system. This can happen if you
forgot to install the required package. This can also happen if you installed forgot to install the required package. This can also happen if you installed
@@ -27,7 +27,7 @@ add-lldb-init-args() {
add-lldb-image-and-args() { add-lldb-image-and-args() {
target_image=$1 target_image=$1
target_args=$2 shift
if [ -n "$target_image" ]; then if [ -n "$target_image" ]; then
if [ -n "$OPT_ARCH" ]; then if [ -n "$OPT_ARCH" ]; then
@@ -36,8 +36,10 @@ add-lldb-image-and-args() {
args+=(-o "target create '$target_image'") args+=(-o "target create '$target_image'")
fi fi
fi fi
if [ -n "$target_args" ]; then if [ "$#" -ne 0 ]; then
args+=(-o "settings set target.run-args $target_args") local qargs
printf -v qargs '%q ' "$@"
args+=(-o "settings set -- target.run-args $qargs")
fi fi
} }