
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
}
]
}
]
}
- Set a breakpoint at main.c:8
- Click f5, start debugging
- Click f11, step in print_again()
- Terminal show "HelloWorld" 2 times
- 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 commentedon Feb 11, 2019
If you debug with
gdb
and you step, does it end up in your assembly code? Is there a restriction ingdb
or some additional configuration commands we need to send togdb
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.
ghost commentedon Feb 11, 2019
That extensions just provided assembly code syntax highlight.I think, maybe the cpptools can provide assembly debugging feature.
pieandcakes commentedon Feb 11, 2019
@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 commentedon Feb 11, 2019
@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 commentedon Feb 11, 2019
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 commentedon Feb 12, 2019
@WardenGnaw how about disassemble? and show disassembly code? that feature can implement?
WardenGnaw commentedon Feb 13, 2019
Disassembly is possible but there is an requirement around implementing a custom view for VS Code.
See microsoft/MIEngine#816
ci70 commentedon May 9, 2019
What is the status on this?
pieandcakes commentedon May 9, 2019
@optomux This is on our backlog.
ghost commentedon May 9, 2019
I'm learning how to write a vscode plugin, when I known how to wrote it, maybe I will implement it.