Skip to content

Commit e297f7c

Browse files
author
Alex J Lennon
committed
test(e2e): Zephyr hello_world break at printf line (main.c:11) + list
GDB batch uses absolute path :11; assert stop at hello_world/src/main.c Made-with: Cursor
1 parent bb3e77e commit e297f7c

1 file changed

Lines changed: 16 additions & 3 deletions

File tree

scripts/e2e_zephyr_native_sim.sh

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,19 +105,32 @@ echo "==> rsgdb :$PROXY_PORT -> 127.0.0.1:$GDB_PORT"
105105
RSGDB_PID=$!
106106
wait_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)"
109116
OUT=$(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

117125
echo "$OUT"
118126

119127
if ! 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
122135
fi
123136

0 commit comments

Comments
 (0)