samples: gdbstub: doc: Remove redundant sample
Remove gdbstub sample (samples/subsys/debug/gdbstub) as duplicated by a test (tests/subsys/debug/gdbstub). Update the GDB stub documentation. Signed-off-by: Dmitrii Golovanov <dmitrii.golovanov@intel.com>
This commit is contained in:
parent
664d96785b
commit
c8d6a62b9d
9 changed files with 3 additions and 133 deletions
|
@ -87,8 +87,9 @@ Using Serial Backend
|
||||||
Example
|
Example
|
||||||
*******
|
*******
|
||||||
|
|
||||||
This is an example using ``samples/subsys/debug/gdbstub`` to demonstrate
|
This is an example to demonstrate how GDB stub works.
|
||||||
how GDB stub works.
|
You can also refer to ``tests/subsys/debug/gdbstub``
|
||||||
|
for its implementation as a Twister test.
|
||||||
|
|
||||||
#. Open two terminal windows.
|
#. Open two terminal windows.
|
||||||
|
|
||||||
|
|
|
@ -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)
|
|
|
@ -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`.
|
|
|
@ -1,7 +0,0 @@
|
||||||
/* SPDX-License-Identifier: Apache-2.0 */
|
|
||||||
|
|
||||||
/ {
|
|
||||||
chosen {
|
|
||||||
zephyr,gdbstub-uart = &uart1;
|
|
||||||
};
|
|
||||||
};
|
|
|
@ -1,7 +0,0 @@
|
||||||
/* SPDX-License-Identifier: Apache-2.0 */
|
|
||||||
|
|
||||||
/ {
|
|
||||||
chosen {
|
|
||||||
zephyr,gdbstub-uart = &uart1;
|
|
||||||
};
|
|
||||||
};
|
|
|
@ -1,4 +0,0 @@
|
||||||
CONFIG_GDBSTUB=y
|
|
||||||
CONFIG_NO_OPTIMIZATIONS=y
|
|
||||||
CONFIG_USERSPACE=y
|
|
||||||
CONFIG_KOBJECT_TEXT_AREA=4096
|
|
|
@ -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
|
|
|
@ -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
|
|
|
@ -1,38 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (c) 2020 Intel Corporation.
|
|
||||||
*
|
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <zephyr/kernel.h>
|
|
||||||
#include <zephyr/sys/printk.h>
|
|
||||||
|
|
||||||
#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);
|
|
Loading…
Add table
Add a link
Reference in a new issue