Vscode-cpptools: Please support disassembly and C/C++ with Assembly code debugging

Created on 9 Feb 2019  路  10Comments  路  Source: microsoft/vscode-cpptools

Type: Debugger
Input information below
Hi, I'm using the vscode C/C++, x86 and x86_64 Assembly extensions to develop C/C++ and Assembly programs, today I compile a C/C++ program with Assembly code, when I create launch.json to debug run, I setting a breakpoint at assembly language caller at C/C++ source file, after debugger step into assembly function, vscode not showing current line at assembly source file.
So, the C/C++ extension debugger part can support disassembly and assembly language program debugging?
Please review existing issues and our documentation at https://github.com/Microsoft/vscode-cpptools/tree/master/Documentation prior to filing an issue.

Describe the bug

  • OS and Version: Fedora Linux Workstation 29
  • VS Code Version: 1.31.0
  • C/C++ Extension Version: 0.21.0
  • Other extensions you installed (and if the issue persists after disabling them): x86 and x86_64 Assembly
  • A clear and concise description of what the bug is.

To Reproduce
Please include a code sample and launch.json configuration.
Steps to reproduce the behavior:
Code sample:

;; hello.asm
extern print_hello
[section .text]
global print_again
print_again:
    call print_hello
    call print_hello
// main.c
#include <stdio.h>
extern void print_again();
char *strPtr = "HelloWorld\n";
void print_hello() {
    printf("%s", strPtr);
}
int main() {
    print_again();
    return 0;
}



md5-926d5a9bc6a723f8bf8a91bba1fe7e55



``` json
// launch.json
{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "(gdb) Launch",
            "type": "cppdbg",
            "request": "launch",
            "program": "${workspaceFolder}/test_call",
            "args": [],
            "stopAtEntry": false,
            "cwd": "${workspaceFolder}",
            "environment": [],
            "externalConsole": true,
            "MIMode": "gdb",
            "setupCommands": [
                {
                    "description": "Enable pretty-printing for gdb",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                }
            ]
        }
    ]
}
  1. Set a breakpoint at main.c:8
  2. Click f5, start debugging
  3. Click f11, step in print_again()
  4. Terminal show "HelloWorld" 2 times
  5. Click f11, debug session over

Additional context
If applicable, please include logging by adding "logging": { "engineLogging": true, "trace": true, "traceResponse": true } in your launch.json
Add any other context about the problem here including log or error messages in your Debug Console or Output windows.

Feature Request debugger

Most helpful comment

@optomux This is on our backlog.

All 10 comments

If you debug with gdb and you step, does it end up in your assembly code? Is there a restriction in gdb or some additional configuration commands we need to send to gdb to allow this to work? You say you installed another extension. Does it work with that extension?

This extension is primarily a C/C++ extension but if you can provide more information on how this is supposed to work we may be able to investigate it.

That extensions just provided assembly code syntax highlight.I think, maybe the cpptools can provide assembly debugging feature.

@c4dr01d If you tell me how to get gdb to debug into assembly, I can investigate. Otherwise unless someone from the community is willing to do the work, it isn't something that I can do at this time.

@pieandcakes I using the gdb debugged Linux kernel, when I toggle a breakpoint at assembly code, the gdb will stop, then I can use nexti command to track kernel behaviors. That code is combined C and assembly code, when C program call assembly code, gdb will step in to assembly source file,when assembly program call C program, gdb will step into C source file.

This is similar to https://github.com/Microsoft/vscode-cpptools/issues/1980

The issue is that VS Code does not expose or allow us to add debugging icons for nexti or stepi

@WardenGnaw how about disassemble? and show disassembly code? that feature can implement?

Disassembly is possible but there is an requirement around implementing a custom view for VS Code.

See https://github.com/Microsoft/MIEngine/issues/816

What is the status on this?

@optomux This is on our backlog.

I'm learning how to write a vscode plugin, when I known how to wrote it, maybe I will implement it.

Was this page helpful?
0 / 5 - 0 ratings