Skip to content

GDB stub support - #10000

Merged
kv2019i merged 5 commits into
thesofproject:mainfrom
lyakh:gdb
Jul 30, 2025
Merged

GDB stub support#10000
kv2019i merged 5 commits into
thesofproject:mainfrom
lyakh:gdb

Conversation

@lyakh

Copy link
Copy Markdown
Collaborator

This respins nklayman@cbb3f4d to add GDB stub support to SOF. With this an IPC can be sent to SOF to enter the GDB stub, after which a Linux driver debugging interface from thesofproject/linux#5411 can be used to communicate with the stub over a memory window. Both IPC3 and IPC4 are supported. So far only cAVS 2.5 is supported.

@lyakh

Copy link
Copy Markdown
CollaboratorAuthor

Comment threadsrc/ipc/ipc3/handler.c
Comment threadsrc/include/sof/ipc/common.h
Comment threadsrc/include/sof/ipc/common.h
Comment threadsrc/ipc/ipc-common.c Outdated
#if CONFIG_GDBSTUB
if (ipc_enter_gdb) {
ipc_enter_gdb = false;
k_msleep(5);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why sleep and why 5 ms ?

static int ipc_glb_gdb_debug(struct ipc4_message_request *ipc4)
{
#if CONFIG_GDBSTUB
ipc_enter_gdb = true;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should log this entry as it comes from host IPC

@lyakh
lyakh marked this pull request as ready for review June 25, 2025 13:26
@lyakhlyakh changed the title [DRAFT][DNM] GDB stub supportGDB stub supportJun 25, 2025
@marcinszkudlinski

Copy link
Copy Markdown
Contributor

You have PR number 10000 !!!!

@lyakh

Copy link
Copy Markdown
CollaboratorAuthor

You have PR number 10000 !!!!

@marcinszkudlinski I do (since more than a month ;-) )! Am I getting a prize? ;-)

@lyakh
lyakh requested a review from abonislawski as a code ownerJune 26, 2025 11:01
@kv2019ikv2019i changed the title GDB stub supportGDB stub support (include Zephry west update)Jun 30, 2025
@kv2019ikv2019i changed the title GDB stub support (include Zephry west update)GDB stub support (includes Zephyr west update)Jun 30, 2025

@kv2019ikv2019i left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great!


# GDB stub

CONFIG_GDBSTUB=y

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This overlay is used in our SOF driver CI, so gdb stub will be enabled. Probably ok and even preferred as this will get a minimal coverage in CI for the gdb build.

Copy link
Copy Markdown
CollaboratorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, that's the intension

@kv2019i

Copy link
Copy Markdown
Collaborator

@lyakh This seems ready to go except for the mandatory CI check fail. Any idea why that is failing? I don't see anything in the PR that would break existing tests.

@lgirdwood

Copy link
Copy Markdown
Member

@lyakh This seems ready to go except for the mandatory CI check fail. Any idea why that is failing? I don't see anything in the PR that would break existing tests.

-- west build: generating a build system
Loading Zephyr default modules (Zephyr base).
-- Application: /srv/home/jenkins/workspace/sof_config_build@2/sof/app
-- CMake version: 3.31.4
CMake Error at /srv/home/jenkins/.local/lib/python3.10/site-packages/cmake/data/share/cmake-3.31/Modules/FindPackageHandleStandardArgs.cmake:233 (message):
Could NOT find Python3: Found unsuitable version "3.10.16", but required is
at least "3.12" (found /usr/bin/python3, found components: Interpreter)

Python versions.

@lgirdwood

Copy link
Copy Markdown
Member

@lyakh can you rebase - btw not seen the Python failure in other PRs.

@lyakh

lyakh commented Jul 4, 2025

Copy link
Copy Markdown
CollaboratorAuthor

@lyakh can you rebase - btw not seen the Python failure in other PRs.

@lgirdwood Python failures aren't seen in most other PRs because they don't update the Zephyr version. So we need to fix that issue first, then I can rebase and we can merge

lyakhand others added 2 commits July 11, 2025 09:59
Add an IPC4 message type to instruct the firmware to enter the GDB
stub.
Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Need to decide if old XTOS GDB stub should be removed and add support
for IPC4.
Signed-off-by: Noah Klayman <noah.klayman@intel.com>
lyakh added 3 commits July 11, 2025 09:59
To avoid timed out IPC on the host side, enter the GDB stub only
after replying to the IPC.
Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Add suppoprt for the new IPC4 GDB enter message.
Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
By default enable the GDB stub when building the debug configuration.
Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
@lyakh
lyakhforce-pushed the gdb branch 2 times, most recently from 2824d1e to dd938e1CompareJuly 11, 2025 08:43
@lyakhlyakh added the DNM Do Not Merge tag label Jul 11, 2025
@lyakhlyakh removed the DNM Do Not Merge tag label Jul 30, 2025
@lyakhlyakh changed the title GDB stub support (includes Zephyr west update)GDB stub supportJul 30, 2025
@kv2019i
kv2019i merged commit 9a52302 into thesofproject:mainJul 30, 2025
35 of 45 checks passed
@lyakh
lyakh deleted the gdb branch July 31, 2025 06:01
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

@lyakh@marcinszkudlinski@kv2019i@lgirdwood@nklayman