File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -105,19 +105,32 @@ echo "==> rsgdb :$PROXY_PORT -> 127.0.0.1:$GDB_PORT"
105105RSGDB_PID=$!
106106wait_listen " $PROXY_PORT "
107107
108- echo " ==> gdb batch (host gdb — same architecture as zephyr.exe)"
108+ # hello_world sample: printf is on line 11 of src/main.c (see Zephyr tree).
109+ HELLO_SRC=" $ZEPHYR_WORKSPACE /zephyr/samples/hello_world/src/main.c"
110+ if [[ ! -f " $HELLO_SRC " ]]; then
111+ echo " error: expected $HELLO_SRC (hello_world sample)" >&2
112+ exit 1
113+ fi
114+
115+ echo " ==> gdb batch (host gdb — breakpoint on hello_world printf line)"
109116OUT=$( gdb -nx --batch \
110117 -ex " set pagination off" \
111118 -ex " target extended-remote 127.0.0.1:$PROXY_PORT " \
112- -ex " break main " \
119+ -ex " break \" $HELLO_SRC \" :11 " \
113120 -ex " continue" \
121+ -ex " list" \
114122 -ex " quit" \
115123 " $ZEPHYR_EXE " 2>&1 ) || true
116124
117125echo " $OUT "
118126
119127if ! echo " $OUT " | grep -qE ' Breakpoint|Temporary breakpoint' ; then
120- echo " error: expected GDB to hit a breakpoint at main" >&2
128+ echo " error: expected GDB to set a breakpoint" >&2
129+ exit 1
130+ fi
131+
132+ if ! echo " $OUT " | grep -qE ' hello_world/src/main\.c:11|main\.c:11' ; then
133+ echo " error: expected GDB to stop at hello_world/src/main.c line 11 (printf)" >&2
121134 exit 1
122135fi
123136
You can’t perform that action at this time.
0 commit comments