diff --git a/doc/services/debugging/gdbstub.rst b/doc/services/debugging/gdbstub.rst index 5b702d9569802fb..50b830fb5b86a66 100644 --- a/doc/services/debugging/gdbstub.rst +++ b/doc/services/debugging/gdbstub.rst @@ -87,8 +87,9 @@ Using Serial Backend Example ******* -This is an example using ``samples/subsys/debug/gdbstub`` to demonstrate -how GDB stub works. +This is an example to demonstrate how GDB stub works. +You can also refer to ``tests/subsys/debug/gdbstub`` +for its implementation as a Twister test. #. Open two terminal windows. diff --git a/samples/subsys/debug/gdbstub/CMakeLists.txt b/samples/subsys/debug/gdbstub/CMakeLists.txt deleted file mode 100644 index 9759ca6c7f0c365..000000000000000 --- a/samples/subsys/debug/gdbstub/CMakeLists.txt +++ /dev/null @@ -1,12 +0,0 @@ -# SPDX-License-Identifier: Apache-2.0 - -cmake_minimum_required(VERSION 3.20.0) - -if(BOARD MATCHES "qemu_x86") - list(APPEND QEMU_EXTRA_FLAGS -serial tcp:127.0.0.1:5678,server) -endif() - -find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) -project(debug) - -target_sources(app PRIVATE src/main.c) diff --git a/samples/subsys/debug/gdbstub/README.rst b/samples/subsys/debug/gdbstub/README.rst deleted file mode 100644 index dc8430cd339891c..000000000000000 --- a/samples/subsys/debug/gdbstub/README.rst +++ /dev/null @@ -1,31 +0,0 @@ -.. zephyr:code-sample:: gdb-debug - :name: GDB debug - - Use GDB Remote Serial Protocol to debug a Zephyr application running on QEMU. - -Overview -******** - -A simple sample that can be used with QEMU to show debug using GDB -Remote Serial Protocol (RSP) capabilities. - -Building and Running -******************** - -This application can be built and executed on QEMU as follows: - -.. zephyr-app-commands:: - :zephyr-app: samples/subsys/debug/gdbstub - :host-os: unix - :board: qemu_x86 - :goals: run - :compact: - -Open a new terminal and use gdb to connect to the running qemu as follows: - -.. code-block:: bash - - gdb build/zephyr/zephyr.elf - (gdb) target remote :5678 - -Exit QEMU by pressing :kbd:`CTRL+A` :kbd:`x`. diff --git a/samples/subsys/debug/gdbstub/boards/qemu_x86.overlay b/samples/subsys/debug/gdbstub/boards/qemu_x86.overlay deleted file mode 100644 index e6c560fae727514..000000000000000 --- a/samples/subsys/debug/gdbstub/boards/qemu_x86.overlay +++ /dev/null @@ -1,7 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ - -/ { - chosen { - zephyr,gdbstub-uart = &uart1; - }; -}; diff --git a/samples/subsys/debug/gdbstub/boards/qemu_x86_64.overlay b/samples/subsys/debug/gdbstub/boards/qemu_x86_64.overlay deleted file mode 100644 index e6c560fae727514..000000000000000 --- a/samples/subsys/debug/gdbstub/boards/qemu_x86_64.overlay +++ /dev/null @@ -1,7 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ - -/ { - chosen { - zephyr,gdbstub-uart = &uart1; - }; -}; diff --git a/samples/subsys/debug/gdbstub/prj.conf b/samples/subsys/debug/gdbstub/prj.conf deleted file mode 100644 index da68f3823c4d5cf..000000000000000 --- a/samples/subsys/debug/gdbstub/prj.conf +++ /dev/null @@ -1,4 +0,0 @@ -CONFIG_GDBSTUB=y -CONFIG_NO_OPTIMIZATIONS=y -CONFIG_USERSPACE=y -CONFIG_KOBJECT_TEXT_AREA=4096 diff --git a/samples/subsys/debug/gdbstub/run.gdbinit b/samples/subsys/debug/gdbstub/run.gdbinit deleted file mode 100644 index abce598f54af7a3..000000000000000 --- a/samples/subsys/debug/gdbstub/run.gdbinit +++ /dev/null @@ -1,17 +0,0 @@ -set pagination off -#symbol-file build/zephyr/zephyr.elf -target remote :5678 -b test -b main.c:33 -c - -s -set var a = 2 -c -if ret == 6 - printf "PASSED\n" - quit 0 -else - printf "FAILED\n" - quit 1 -end diff --git a/samples/subsys/debug/gdbstub/sample.yaml b/samples/subsys/debug/gdbstub/sample.yaml deleted file mode 100644 index 5f75a80154122c4..000000000000000 --- a/samples/subsys/debug/gdbstub/sample.yaml +++ /dev/null @@ -1,15 +0,0 @@ -# -# Copyright (c) 2020 intel Corporation. -# -# SPDX-License-Identifier: Apache-2.0 -# - -sample: - name: gdbstub sample -tests: - sample.debug.gdbstub: - build_only: true - platform_allow: qemu_x86 - tags: - - debug - - gdbstub diff --git a/samples/subsys/debug/gdbstub/src/main.c b/samples/subsys/debug/gdbstub/src/main.c deleted file mode 100644 index 51995db4ab7370a..000000000000000 --- a/samples/subsys/debug/gdbstub/src/main.c +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2020 Intel Corporation. - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include -#include - -#define STACKSIZE 512 - -static int test(void) -{ - int a; - int b; - - a = 10; - b = a * 2; - - return a + b; -} - -static void thread_entry(void *p1, void *p2, void *p3) -{ - printk("Hello from user thread!\n"); -} - -int main(void) -{ - int ret; - - ret = test(); - printk("%d\n", ret); - return 0; -} - -K_THREAD_DEFINE(thread, STACKSIZE, thread_entry, NULL, NULL, NULL, - 7, K_USER, 0);