Skip to content

Please support disassembly and C/C++ with Assembly code debugging #3148

Closed
@ghost

Description

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;
}
# Compile command
nasm -g -Fstabs -f elf64 -o hello.o hello.asm
gcc -g -c -o test_call main.c hello.o
// 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.

Activity

pieandcakes

pieandcakes commented on Feb 11, 2019

@pieandcakes
Contributor

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.

self-assigned this
on Feb 11, 2019
removed their assignment
on Feb 11, 2019
ghost

ghost commented on Feb 11, 2019

@ghost

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

pieandcakes

pieandcakes commented on Feb 11, 2019

@pieandcakes
Contributor

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

ghost

ghost commented on Feb 11, 2019

@ghost

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

WardenGnaw

WardenGnaw commented on Feb 11, 2019

@WardenGnaw
Member

This is similar to #1980

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

ghost

ghost commented on Feb 12, 2019

@ghost

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

WardenGnaw

WardenGnaw commented on Feb 13, 2019

@WardenGnaw
Member

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

See microsoft/MIEngine#816

ci70

ci70 commented on May 9, 2019

@ci70

What is the status on this?

pieandcakes

pieandcakes commented on May 9, 2019

@pieandcakes
Contributor

@optomux This is on our backlog.

ghost

ghost commented on May 9, 2019

@ghost

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

ghost closed this as completedon May 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @WardenGnaw@ci70@pieandcakes

        Issue actions

          Please support disassembly and C/C++ with Assembly code debugging · Issue #3148 · microsoft/vscode-cpptools