microsoft / microsoft/vscode-cpptools

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

Aperta
#12,637 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

bug debugger help wanted
Lingua principale
TypeScript
Stelle
6.2k
Fork
1.7k
Merge medio
14h 46m
PR unite (30g)
61

Descrizione

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

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Inizia dalla configurazione pipeTransport di launch.json e confronta problem.log con no-problem.log, concentrandoti sugli eventi di breakpoint, thread e processo GDB/MI mostrati. Traccia il modo in cui la C/C++ extension gestisce un breakpoint nella libreria caricata a runtime e nel processo di test creato tramite fork; il lavoro è completo quando viene riprodotto lo stop dell’interfaccia utente mancato e viene identificata una correzione verificata con copertura di regressione.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
cpp, docker, typescript
Ambito
devtools
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Da chiarire
Idoneità per principianti
25/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.