Skip to content

Conversation

@lyakh
Copy link
Collaborator

@lyakh lyakh commented May 12, 2025

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
Collaborator Author

lyakh commented May 12, 2025

#if CONFIG_GDBSTUB
if (ipc_enter_gdb) {
ipc_enter_gdb = false;
k_msleep(5);
Copy link
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
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
@lyakh lyakh changed the title [DRAFT][DNM] GDB stub support GDB stub support Jun 25, 2025
@marcinszkudlinski
Copy link
Contributor

You have PR number 10000 !!!!

@lyakh
Copy link
Collaborator Author

lyakh commented Jun 25, 2025

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 owner June 26, 2025 11:01
@kv2019i kv2019i changed the title GDB stub support GDB stub support (include Zephry west update) Jun 30, 2025
@kv2019i kv2019i changed the title GDB stub support (include Zephry west update) GDB stub support (includes Zephyr west update) Jun 30, 2025
Copy link
Collaborator

@kv2019i kv2019i left a comment

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
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
Collaborator Author

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
Collaborator

kv2019i commented Jul 2, 2025

@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
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
Member

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

@lyakh
Copy link
Collaborator Author

lyakh commented Jul 4, 2025

@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

lyakh and 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 <[email protected]>
Need to decide if old XTOS GDB stub should be removed and add support
for IPC4.

Signed-off-by: Noah Klayman <[email protected]>
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 <[email protected]>
Add suppoprt for the new IPC4 GDB enter message.

Signed-off-by: Guennadi Liakhovetski <[email protected]>
By default enable the GDB stub when building the debug configuration.

Signed-off-by: Guennadi Liakhovetski <[email protected]>
@lyakh lyakh force-pushed the gdb branch 2 times, most recently from 2824d1e to dd938e1 Compare July 11, 2025 08:43
@lyakh lyakh added the DNM Do Not Merge tag label Jul 11, 2025
@lyakh lyakh removed the DNM Do Not Merge tag label Jul 30, 2025
@lyakh lyakh changed the title GDB stub support (includes Zephyr west update) GDB stub support Jul 30, 2025
@kv2019i kv2019i merged commit 9a52302 into thesofproject:main Jul 30, 2025
35 of 45 checks passed
@lyakh lyakh deleted the gdb branch July 31, 2025 06:01
Sign up for free to 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