microsoft / microsoft/vscode-cpptools

Exception has occurred-Interrupt when add breakpoint to beak the program in attach request on extended-remote target

Open
#10,390 3 comments 5 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Environment
  • OS and version: Ubuntu 20.04
  • VS Code:1.74.2
  • C/C++ extension: v1.13.9
  • OS and version of remote machine (if applicable):
  • GDB / LLDB version: gdb 9.2
Bug Summary and Steps to Reproduce

Bug Summary:

Steps to reproduce:

  1. Source code
    #include <stdio.h>

    int main()
    {
    while(1){
    sleep(5);
    printf("\n\nHello world\n\n");
    }

       return 0;
    

    }

build it with -g to a.out.

  1. Run it on remote target, and launch gdbserver "gdbserver --multi :23456"
  2. Create attach configuration on localhost VScode to attach it.
  3. No breakpoint set,run the attach and select the process id of a.out, it works well.
  4. Try to set BP on line "sleep (5)", exception occured.

image

Debugger Configurations
{
            "name": "(gdb) Attach",
            "type": "cppdbg",
            "request": "attach",
            "program": "xxx/a.out",
            "MIMode": "gdb",
            "miDebuggerPath": "/usr/bin/gdb",
            "miDebuggerServerAddress": "xxxx:23456",
            "useExtendedRemote": true,
            "setupCommands": [
                {
                    "description": "Enable pretty-printing for gdb",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                },
                {
                    "description": "Set Disassembly Flavor to Intel",
                    "text": "-gdb-set disassembly-flavor intel",
                    "ignoreFailures": true
                }
            ],
            "logging": { 
                "engineLogging": true, "trace": true, "traceResponse": true 
            }
        },
Debugger Logs
1: (31191) ->1025^done,stack=[frame={level="0",addr="0x00007fe7ffe4c1b4",func="clock_nanosleep",from="target:/lib/x86_64-linux-gnu/libc.so.6",arch="i386:x86-64"},frame={level="1",addr="0x00007fe7ffe51ec7",func="nanosleep",from="target:/lib/x86_64-linux-gnu/libc.so.6",arch="i386:x86-64"},frame={level="2",addr="0x00007fe7ffe51dfe",func="sleep",from="target:/lib/x86_64-linux-gnu/libc.so.6",arch="i386:x86-64"},frame={level="3",addr="0x0000558976a09180",func="main",file="helloworld.c",fullname="/home/test/testFolder/hello1/helloworld.c",line="6",arch="i386:x86-64"}]
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (31191) ->(gdb)\n"},"seq":439}
1: (31191) ->(gdb)
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (31191) 1025: elapsed time 7\n"},"seq":441}
1: (31191) 1025: elapsed time 7
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (31191) Send Event AD7ExceptionEvent\n"},"seq":443}
1: (31191) Send Event AD7ExceptionEvent
--> E (stopped): {"type":"event","event":"stopped","body":{"reason":"exception","threadId":1,"text":"Interrupt","allThreadsStopped":true},"seq":445}
<--   C (threads-18): {"command":"threads","type":"request","seq":18}
--> R (threads-18): {"type":"response","request_seq":18,"success":true,"command":"threads","body":{"threads":[{"id":1,"name":"a.out [1]"}]},"seq":448}
<--   C (stackTrace-19): {"command":"stackTrace","arguments":{"threadId":1,"startFrame":0,"levels":20},"type":"request","seq":19}
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (31206) <-1026-stack-list-arguments 0 0 3\n"},"seq":451}
1: (31206) <-1026-stack-list-arguments 0 0 3
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (31206) ->1026^done,stack-args=[frame={level=\"0\",args=[]},frame={level=\"1\",args=[]},frame={level=\"2\",args=[]},frame={level=\"3\",args=[]}]\n"},"seq":453}
1: (31206) ->1026^done,stack-args=[frame={level="0",args=[]},frame={level="1",args=[]},frame={level="2",args=[]},frame={level="3",args=[]}]
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (31206) ->(gdb)\n"},"seq":455}
1: (31206) ->(gdb)
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (31206) 1026: elapsed time 0\n"},"seq":457}
1: (31206) 1026: elapsed time 0
--> R (stackTrace-19): {"type":"response","request_seq":19,"success":true,"command":"stackTrace","body":{"stackFrames":[{"id":1000,"name":"libc.so.6!clock_nanosleep","line":0,"column":0,"instructionPointerReference":"0x00007fe7ffe4c1b4","moduleId":1},{"id":1001,"name":"libc.so.6!nanosleep","line":0,"column":0,"instructionPointerReference":"0x00007fe7ffe51ec7","moduleId":1},{"id":1002,"name":"libc.so.6!sleep","line":0,"column":0,"instructionPointerReference":"0x00007fe7ffe51dfe","moduleId":1},{"id":1003,"name":"main()","source":{"name":"helloworld.c","path":"/home/test/testFolder/hello1/helloworld.c","sources":[],"checksums":[]},"line":6,"column":1,"instructionPointerReference":"0x0000558976a09180"}],"totalFrames":4},"seq":459}
Other Extensions

No response

Additional Information

No response

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

Reproduce the attach scenario from the provided configuration using gdbserver in extended-remote mode, then set a breakpoint on the sleep(5) line. Start with the debugger logs around AD7ExceptionEvent and the stopped event, and use the absence of an unexpected Interrupt exception after setting the breakpoint as the completion check.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, linux, ubuntu, vscode
Domain
devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.