microsoft / microsoft/vscode-cpptools

[GDB pipe DOCKER] Breakpoint hit in runtime loaded lib may not respond in UI

Open
#12,637 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug debugger help wanted
Dominant language
TypeScript
Stars
6.2k
Forks
1.7k
Avg merge
14h 46m
Merged PRs (30d)
61

Description

Environment
  • OS and version: Ubuntu 20
  • VS Code: 1.92.2
  • C/C++ extension: 1.21.6
  • OS and version of remote machine (if applicable): Docker Ubuntu 20
  • GDB / LLDB version: GNU gdb (Ubuntu 9.2-0ubuntu1~20.04.2) 9.2
Bug Summary and Steps to Reproduce

Bug Summary:
My launch.json use pipe to docker container.
I am try to debug program which is use munit C testing framework. Program logic is this: dlopen application-tests-lib -> munit run test from this lib -> munit internal fork -> test is running.
Breakpoint is set in application-tests-lib which is loaded in rutime.
Sometimes the breakpoint is hit, but sometimes VSCode has no reaction and in the log I see breakpoint hit on 'remote' side and gdb is waiting.

Debugger Configurations
{
    "version": "2.0.0",
    "configurations": [
        {
            "name": "(gdb) Pipe to docker",
            "type": "cppdbg",
            "request": "launch",
            "program": "/home/user/projects/base/sim/.rootfs/usr/bin/tests-runner",
            "args": [
                "--work-dir=/home/user/projects/base/sim/.rootfs",
                "--cores-dir=./usr/lib/cores",
                "--tests-dir=./usr/lib/tests",
                "--tests-lib-filter=(?!.*sdk)pp-manager",
                "--",
                "unit/pp-manager/l2-mac-ip/audit-all-cleared"
            ],
            "stopAtEntry": false,
            "cwd": "/home/user/projects/base/sim/",
            "environment": [],
            "externalConsole": false,
            "pipeTransport": {
                "debuggerPath": "/usr/bin/gdb",
                /* builder.sh runs docker container. */
                "pipeProgram": "${workspaceFolder}/../../builder/builder.sh",
                "pipeArgs": ["run", "-pipe"],
                "pipeCwd": "${workspaceFolder}/../../builder/",
                "quoteArgs": false
            },
            "sourceFileMap": {
                "/home/user/projects": "${workspaceFolder}/../..",
            },
            "MIMode": "gdb",
            "setupCommands": [
                {
                    "description": "GDB format",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                },
                {
                    "description": "Follow fork child",
                    "text": "-gdb-set follow-fork-mode child",
                    "ignoreFailures": false
                }
            ],
            "logging": {"trace": true, "engineLogging":true, "programOutput": true, "traceResponse": true, "moduleLoad": true, "exceptions": true}
        }
    ],
}
Debugger Logs
--> E (output): {"type":"event","event":"output","body":{"category":"stdout","output":"Thread 2.1 \"tests-runner\" hit Breakpoint 2, init_pp_manager (params=0x0, user_data=0x561920a8a3ec) at tests/pp-manager-core/pp_manager_utils.c:100\n"},"seq":629}
Thread 2.1 "tests-runner" hit Breakpoint 2, init_pp_manager (params=0x0, user_data=0x561920a8a3ec) at tests/pp-manager-core/pp_manager_utils.c:100
--> E (output): {"type":"event","event":"output","body":{"category":"stdout","output":"100\t\trmkdir(buff, S_IRWXU);\n"},"seq":631}
100		rmkdir(buff, S_IRWXU);
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (1506) <-1031-thread-info\n"},"seq":633}
1: (1506) <-1031-thread-info
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (1506) ->1031^done,threads=[{id=\"2\",target-id=\"Thread 0x7fd9b94bdc40 (LWP 175)\",name=\"tests-runner\",frame={level=\"0\",addr=\"0x00007fd9b7c1c757\",func=\"init_pp_manager\",args=[{name=\"params\",value=\"0x0\"},{name=\"user_data\",value=\"0x561920a8a3ec\"}],file=\"tests/pp-manager-core/pp_manager_utils.c\",fullname=\"/home/user/projects/eltex-services/pp-manager/tests/pp-manager-core/pp_manager_utils.c\",line=\"100\",arch=\"i386:x86-64\"},state=\"stopped\",core=\"1\"}],current-thread-id=\"2\"\n"},"seq":635}
1: (1506) ->1031^done,threads=[{id="2",target-id="Thread 0x7fd9b94bdc40 (LWP 175)",name="tests-runner",frame={level="0",addr="0x00007fd9b7c1c757",func="init_pp_manager",args=[{name="params",value="0x0"},{name="user_data",value="0x561920a8a3ec"}],file="tests/pp-manager-core/pp_manager_utils.c",fullname="/home/user/projects/eltex-services/pp-manager/tests/pp-manager-core/pp_manager_utils.c",line="100",arch="i386:x86-64"},state="stopped",core="1"}],current-thread-id="2"
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (1507) ->(gdb)\n"},"seq":637}
1: (1507) ->(gdb)
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (1507) 1029: elapsed time 27\n"},"seq":639}
1: (1507) 1029: elapsed time 27
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (1507) Send Event AD7BreakpointBoundEvent\n"},"seq":641}
1: (1507) Send Event AD7BreakpointBoundEvent
--> E (breakpoint): {"type":"event","event":"breakpoint","body":{"reason":"changed","breakpoint":{"id":4,"verified":true,"line":130,"BoundBreakpoints":[]}},"seq":643}
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (1507) 1030: elapsed time 3\n"},"seq":645}
1: (1507) 1030: elapsed time 3
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (1508) Send Event AD7ProcessInfoUpdatedEvent\n"},"seq":647}
1: (1508) Send Event AD7ProcessInfoUpdatedEvent
--> E (process): {"type":"event","event":"process","body":{"startMethod":"launch","name":"/home/user/projects/base/sim/.rootfs/usr/bin/tests-runner","systemProcessId":0,"pointerSize":64},"seq":649}
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (1508) Send Event AD7ThreadCreateEvent\n"},"seq":651}
1: (1508) Send Event AD7ThreadCreateEvent
--> E (thread): {"type":"event","event":"thread","body":{"reason":"started","threadId":175},"seq":653}
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (1508) 1031: elapsed time 2\n"},"seq":655}
1: (1508) 1031: elapsed time 2
<--   C (threads-12): {"command":"threads","type":"request","seq":12}
--> R (threads-12): {"type":"response","request_seq":12,"success":true,"command":"threads","body":{"threads":[{"id":175,"name":"tests-runner [175]"}]},"seq":658}
Other Extensions

No response

Additional Information

Logs when breakpoint not hit in UI:
problem.log
Logs when breakpoint is hit in UI:
no-problem.log

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the launch.json pipeTransport configuration and compare problem.log with no-problem.log, focusing on the GDB/MI breakpoint, thread, and process events shown. Trace how the C/C++ extension handles a breakpoint in the runtime-loaded library and forked test process; done means reproducing the missed UI stop and identifying a verified fix with regression coverage.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, docker, typescript
Domain
devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.