Giter Club home page Giter Club logo

code-debug's Introduction

Debug

VS Marketplace Open VSX Registry GitHub CI Status Coverage Status

Native VSCode debugger. Supports both GDB and LLDB.

Installation

Press ctrl-p (cmd+p on OS X) and run ext install webfreak.debug in visual studio code and install GDB/LLDB. See Usage for details on how to set it up.

Preview

Usage

Image with red circle around a gear and a red arrow pointing at GDB and LLDB

Or if you already have an existing debugger in your project setup you can click "Create Configuration" or use the auto completion instead:

Visual studio code debugger launch.json auto completion showing alternative way to create debuggers

Open your project and click the debug button in your sidebar. At the top right press the little gear icon and select GDB or LLDB. It will automatically generate the configuration you need.

Note: for LLDB you need to have lldb-mi in your PATH

If you are on OS X you can add lldb-mi to your path using ln -s /Applications/Xcode.app/Contents/Developer/usr/bin/lldb-mi /usr/local/bin/lldb-mi if you have Xcode.

Default config with a red circle around the target

Now you need to change target to the application you want to debug relative to the cwd. (Which is the workspace root by default)

Additionally you can set terminal if you want to run the program in a separate terminal with support for input. On Windows set it to an empty string ("") to enable this feature. On linux set it to an empty string ("") to use the default terminal emulator specified with x-terminal-emulator or specify a custom one. Note that it must support the -e argument.

Before debugging you need to compile your application first, then you can run it using the green start button in the debug sidebar. For this you could use the preLaunchTask argument vscode allows you to do. Adding breakpoints while the program runs will not interrupt it immediately. For that you need to pause & resume the program once first. However adding breakpoints while its paused works as expected.

Extending variables is very limited as it does not support child values of variables. Watching expressions works partially but the result does not get properly parsed and it shows the raw output of the command. It will run data-evaluate-expression to check for variables.

While running you will get a console where you can manually type GDB/LLDB commands or MI commands prepended with a hyphen -. The console shows all output separated in stdout for the application, stderr for errors and log for log messages.

Some exceptions/signals like segmentation faults will be caught and displayed but it does not support for example most D exceptions.

Support exists for stopping at the entry point of the application. This is controlled through the stopAtEntry setting. This value may be either a boolean or a string. In the case of a boolean value of false (the default), this setting is disabled. In the case of a boolean value of true, if this is a launch configuration and the debugger supports the start (or exec-run --start MI feature, more specifically), than this will be used to run to the entry point of the application. Note that this appears to work fine for GDB, but LLDB doesn't necessarily seem to adhere to this, even though it may indicate that it supports this feature. The alternative configuration option for the stopAtEntry setting is to specify a string where the string represents the entry point itself. In this situation a temporary breakpoint will be set at the specified entry point and a normal run will occur for a launch configuration. This (setting a temporary breakpoint) is also the behavior that occurs when the debugger does not support the start feature and the stopAtEntry was set to true. In that case the entry point will default to "main". Thus, the most portable way to use this configuration is to explicitly specify the entry point of the application. In the case of an attach configuration, similar behavior will occur, however since there is no equivalent of the start command for attaching, a boolean value of true for the stopAtEntry setting in a launch configuration will automatically default to an entry point of "main", while a string value for this setting will be interpreted as the entry point, causing a temporary breakpoint to be set at that location prior to continuing execution. Note that stopping at the entry point for the attach configuration assumes that the entry point has not yet been entered at the time of attach, otherwise this will have no affect.

Attaching to existing processes

Attaching to existing processes currently only works by specifying the PID in the launch.json and setting request to "attach". You also need to specify the executable path for the debugger to find the debug symbols.

"request": "attach",
"executable": "./bin/executable",
"target": "4285"

This will attach to PID 4285 which should already run. GDB will pause the program on entering and LLDB will keep it running.

Using gdbserver for remote debugging (GDB only)

You can also connect to a gdbserver instance and debug using that. For that modify the launch.json by setting request to "attach" and remote to true and specifying the port and optionally hostname in target.

"request": "attach",
"executable": "./bin/executable",
"target": ":2345",
"cwd": "${workspaceRoot}",
"remote": true

This will attach to the running process managed by gdbserver on localhost:2345. You might need to hit the start button in the debug bar at the top first to start the program.

Control over whether the debugger should continue executing on connect can be configured by setting stopAtConnect. The default value is false so that execution will continue after connecting.

Using ssh for debugging on remote

Debugging using ssh automatically converts all paths between client & server and also optionally redirects X11 output from the server to the client.
Simply add a ssh object in your launch request.

"request": "launch",
"target": "./executable",
"cwd": "${workspaceRoot}",
"ssh": {
	"forwardX11": true,
	"host": "192.168.178.57",
	"cwd": "/home/remoteUser/project/",
	"keyfile": "/path/to/.ssh/key", // OR
	"password": "password123",
	"user": "remoteUser",
	"x11host": "localhost",
	// x11port may also be specified as string containing only numbers (useful to use configuration variables)
	"x11port": 6000,
	// Optional, content will be executed on the SSH host before the debugger call.
	"bootstrap": "source /home/remoteUser/some-env"
}

ssh.sourceFileMap will be used to trim off local paths and map them to the server. This is required for basically everything except watched variables or user commands to work.

For backward compatibility you can also use cwd and ssh.cwd for the mapping, this is only used if the newer ssh.sourceFileMap is not configured.

For X11 forwarding to work you first need to enable it in your Display Manager and allow the connections. To allow connections you can either add an entry for applications or run xhost + in the console while you are debugging and turn it off again when you are done using xhost -.

Because some builds requires one or more environment files to be sourced before running any command, you can use the ssh.bootstrap option to add some extra commands which will be prepended to the debugger call (using && to join both).

Debugging a process from a different user (especially root/system processes)

To debug a program that needs additional privileges you may use one of the two approaches:

  1. start vscode with the necessary rights (so both the program and the started debugger instance will have root rights) - sudo code / sudo codium or "start as admin".
    Note that this has a lot of security implications and will have the user settings of vscode for this user.
  2. preferred: use a small wrapper script that calls sudo gdb $* / runas /profile /user:admin-user (or the debugger of your choice) and configure this extension to use it (for example with gdbpath)

Extra Debugger Arguments

Additional arguments can be supplied to the debugger if needed. These will be added when the debugger executable (e.g., gdb, lldb-mi, etc.) is launched. Extra debugger arguments are supplied via the debugger_args setting. Note that the behavior of escaping these options depends on the environment in which the debugger is started. For non-SSH debugging, the options are passed directly to the application and therefore no escaping is necessary (other than what is necessary for the JSON configuration). However, as a result of the options being passed directly to the application, care must be taken to place switches and switch values as separate entities in debugger_args, if they would normally be separated by a space. For example, supplying the option and value -iex "set $foo = \"bar\"" would consist of the following debugger_args:

"debugger_args" : ["-iex", "set $foo = \"bar\""]

If = is used to associate switches with their values, than the switch and value should be placed together instead. In fact, the following example shows 4 different ways in which to specify the same switch and value, using both short and long format, as well as switch values supplied as a separate parameter or supplied via the =:

  • "debugger_args" : ["-iex", "set $foo = \"bar\""]
  • "debugger_args" : ["-iex=set $foo = \"bar\""]
  • "debugger_args" : ["--init-eval-command", "set $foo = \"bar\""]
  • "debugger_args" : ["--init-eval-command=set $foo = \"bar\""]

Where escaping is really necessary is when running the debugger over SSH. In this case, the options are not passed directly to the application, but are instead combined with the application name, joined together with any other options, and sent to the remote system to be parsed and executed. Thus, depending on the remote system, different escaping may be necessary. The following shows how the same command as above needs to be escaped differently based on whether the remote system is a POSIX or a Windows system.

  • SSH to Linux machine:
    "debugger_args": ["-iex", "'set $foo = \"bar\"'"]
  • SSH to Windows machine:
    "debugger_args": ["-iex", "\"set $foo = \\\"bar\\\"\""]

You may need to experiment to find the correct escaping necessary for the command to be sent to the debugger as you intended.

code-debug's People

Contributors

abussy-aldebaran avatar andyneff avatar bbenoist avatar brownts avatar coldencullen avatar ea-mousing avatar evangrayk avatar faustinoaq avatar gentoo90 avatar gitmensch avatar haronk avatar jelleroets avatar kvinwang avatar kylewlacy avatar leszekswirski avatar martin-fleck-at avatar marus avatar mrmaxmeier avatar ndk4 avatar nomtats avatar ntoskrnl7 avatar oltolm avatar rafmudaf avatar reznikmm avatar rookwood101 avatar simark avatar vild avatar webfreak001 avatar wosi avatar yanpas avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

code-debug's Issues

Using gdb from a different toolchain (e.g. arm-none-eabi-gdb)

Hi,

I tried to look around the configurations but I couldn't find a straightforward way to use gdb from a different toolchain (arm-none-eabi in my case), is it possible? If not, could it be made possible to configure which gdb executable to use? This would be useful when performing remote debugging on different architectures.

Buffering prevents output without newlines

Hello, I try to use the debug extension to debug a helloworld C program, but I can not find any output of the program being debugged, although breaks and watches of gdb works. The vscode Output window only have git and tasks results which is the output of the make program, and the Debug Console window only have gdb debug info output. Please help!

The command version gdb 7.11 works all right at Mac OSX10.10.5 machine, and output "hello, world! the value = 100" in the end:

jasmine:vscodetes$ gdb helloworld
GNU gdb (GDB) 7.11
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-apple-darwin14.5.0".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from hello world...Reading symbols from /Users/z01/work/vscodetest/helloworld.dSYM/Contents/Resources/DWARF/helloworld...done.
done.
(gdb) run
Starting program: /Users/z01/work/vscodetest/helloworld 
warning: `/BinaryCache/coreTLS/coreTLS-35.40.1~1/Objects/coretls.build/coretls.build/Objects-normal/x86_64/system_coretls_vers.o': can't open to read symbols: No such file or directory.
warning: Could not open OSO archive file "/BinaryCache/coreTLS/coreTLS-35.40.1~1/Symbols/BuiltProducts/libcoretls_ciphersuites.a"
warning: Could not open OSO archive file "/BinaryCache/coreTLS/coreTLS-35.40.1~1/Symbols/BuiltProducts/libcoretls_handshake.a"
warning: Could not open OSO archive file "/BinaryCache/coreTLS/coreTLS-35.40.1~1/Symbols/BuiltProducts/libcoretls_record.a"
warning: Could not open OSO archive file "/BinaryCache/coreTLS/coreTLS-35.40.1~1/Symbols/BuiltProducts/libcoretls_stream_parser.a"
hello, world! the value = 100[Inferior 1 (process 639) exited normally]

If submitting a bug please make sure

  • [Y ] If you are using gdb
    • [Y ] gdb --version >= 7.7.1
    • [ Y] it works on the command line with gdb
    • [ Y] cwd and target are properly set

Screenshots are helpful but not required

failed to debug dlang app

f5 ->

Failed to run command break-insert /home/aaa/src/d/DCD/src/client/client.d:39: No source file named /home/aaa/src/d/DCD/src/client/client.d(this file exist actually).

{
"version": "0.2.0",
"configurations": [
{
"name": "Debug",
"type": "gdb",
"request": "launch",
"target": "./dcd-client",
"cwd": "${workspaceRoot}"
}
]
}

Call stack rarly works

When using ARM GDB the call stack rarely displays any information on breakpoints/pause. have not been able to pinpoint when it does work

Please OS X user manual to README and how to set breakpoint in lldb?

If submitting a bug please make sure

  • use lldb
    • lldb --version is apple version
    • it works on the command line with lldb-mi

Xcode command tools won't provide lldb-mi, but this command is shipped with Xcode.app

just one command can make OS X user use this extension.
ln -s/Applications/Xcode.app/Contents/Developer/usr/bin/lldb-mi /usr/local/bin/lldb-mi

And how to configure launch.json to make it support breakpoint?

Add option to execute extra commands before running GDB when using SSH

For some reasons, I need to execute an extra command (loading an appropriate execution environment on the target machine) before executing GDB over SSH.

Could it be possible to add an extraCommands options in the config which would contains the commands to execute on the remote machine (within the same SSH session than GDB) before calling GDB?

How to setup launch.json?

Please provide clear basic documentation about how to set up launch.json. A link to documentation in the Microsoft/vscode project would be fine, if there is such documentation.

Note that I don't know Node.js and would rather not spend a day learning it, just to be able to use Code for developing my C code app. The Code getting started guide suggests developing a Node.js app in order to get familiar with how Code works. Unfortunately, it's not clear which version of Node.js should be installed, how to install it (I get various errors), how to install the example files, etc. The learning curve is way too steep. A quick reference guide for setting up launch.json tailored to C/C++ code development would be great.

Some questions:

Regarding "cwd": "${workspaceRoot}", if I have my source and object files all in one directory and I start Code in that directory, can I leave that line as is? When might I want to change cwd to some different value?

Is ${workspaceRoot} a Node.js variable? How can I view its value?

Is "target": "./myapp" or "target": "myapp" OK if the myapp executable is in the cwd directory? I'm guessing the file path (for example ".") is relative to cwd, is that right?

How does Code know where to find the source files?

How can I set the default command line args for my application?

I'm having a hard time getting Code to stop at breakpoints. Can I start my app and have Code/gdb break immediately so I can set breakpoints and have gdb break when a breakpoint is reached? This is for local debugging.

Can I have my app's stdin, stdout and stderr go to a separate window from the gdb dialog?

How can I run a make from within Code, i.e. how can I set up the launch.json or similar file to enable this?

make support

I added "preLaunchTask": "make" to launch.json and

{
    "version": "0.1.0",
    "command": "make",
    "isShellCommand": false,
    // Show the output window only if unrecognized errors occur.
    "showOutput": "always", //"silent",

    // use the standard tsc problem matcher to find compile problems
    // in the output.
    "problemMatcher": "$tsc"
}

in tasks.json and now make runs each time I click start, which is pretty good. But,

  1. If there are compile errors (resulting in make returning an error value), Code doesn't stop. It tries to run the program anyway.
  2. The make output window appears momentarily but is replaced with the debug console (which BTW displays the cryptic message undefined=thread-group-added,id="i1"). I'd like the output window to remain visible if there are make errors.
  3. F8, Ctrl-Shift-M etc., don't work to let me visit the errors in my source code. What does it take to make that work?

I would suggest you provide a more extensive launch.json and a tasks.json file tailored to C/C++ development and with some comments, similar to the default tasks.json file. That would enable new users to get started more quickly.

Double output in console

Don't know this is by design, but it appears that the autorun commands go off twice.

1-gdb-set target-async on
2-environment-directory "c:\\dev\\abc/out/obj"
3-target-select remote localhost:4444
undefined=thread-group-added,id="i1"
Reading symbols from c:\dev\abc/out/use/A_Myriad_A_5_9.elf...
done.
Not implemented stop reason (assuming exception): undefined
target remote localhost:4444
monitor interface=0
monitor port=0
monitor speed=500000
monitor type=0
monitor unit=2
monitor connect
4-stack-list-frames 0 20
target remote localhost:4444
A program is being debugged already.  Kill it? (y or n) [answered Y; input not from terminal]
Remote debugging using localhost:4444
0x0000a408 in CanOpen_GetSetS16 (WriteBOOL=0 '\000', DataU8Ptr=0xa401 "") at CanOpenDef.h:132
132             else          { ((U16Type*)CanOpenDataU8Ptr)->DataU16 = (U16)*VarS16Ptr; }
Not implemented stop reason (assuming exception): undefined
monitor interface=0
monitor port=0
monitor speed=500000
5-stack-list-frames 0 20
monitor type=0
monitor unit=2
monitor connect
Failed to run command `stack-list-frames 0 20`: Cannot access memory at address 0x4
An error occured: Cannot access memory at address 0x4
Failed to run command `stack-list-frames 0 20`: Cannot access memory at address 0x4
An error occured: Cannot access memory at address 0x4

Unable to debug in latest release

image

{
    "version": "0.3.1",
    "configurations": [
        {
            "name": "Debug GDB",
            "type": "gdb",
            "request": "attach",
            "target": ":4444",
            "remote": true,
            "autorun": ["-monitor interface=0"]
        }
    ]
}

Examin memory location

I would love a way to examine memory locations with GDB (ARM GDB) via the "x adr" command. by manually entering in locations and lengths, or even better by expanding pointers.

Why data-evaluate-expression for variables

data-evaluate-expression is used to inspect the value of variables during debugging (as your documentation clearly says).

For some reason gdb still uses my pretty printers but lldb-mi ignores them.

This is not a bug report since I get the same behavior in the command line: data-evaluate-expression ignores my type summary variable formatters but if I use frame variable or even print they come out nice. Why is data-evaluate-expression being used across the board? Is this intentional? Am I missing something?

WinDBG?

This is awesome! Please consider hooking up WinDBG too?
MSVC, Clang, DMD, and LDC all produce MS compatible COFF/PDB output in Windows, and LLDB can't really debug that yet.
By doing this you will also solve the debug situation for Windows C++ developers; by far the largest native developer community, and they have no debug solution yet.

Support calling GDB over SSH

Could it be possible to implement support for calling GDB over SSH ?

From what I've understood, it seems quite easy to implement within code-debug. You would simply need to replace the system executable calls and stdio redirections by an appropriate SSH implementation. simple-ssh seems to do the job but there might be better alternatives.

You can take a look at the Visual Studio (!= vscode) GDB Debugger Extension for an example implementation of this use-case. Source code of Microsoft/MIEngine might also help ๐Ÿ˜‰

Here are my personal requirements for this feature:

  • Use either authentication with a password or with an SSH private key file.
  • Expose the possibility to use a custom SSH port
  • The target field must point to the target executable not the ssh server

launch.json proposal:

"request": "launch",
"target": "./bin/executable",
"cwd": "/home/target/build",
"ssh": {
  "host": "127.0.0.1",
  "port": "2222",
  "user": "jdoe",
  "password": "pw4jdoe"
}

internal-error: inferior_thread: Assertion `tp' failed.

Latest release. Using GDB v7.7

1-gdb-set target-async on
2-environment-directory "c:\\dev\\trunk/Sw/A_XMC/out/obj"
3-target-select remote localhost:4444
Reading symbols from c:\dev\trunk\Sw\A_XMC\out\use\A_Myriad_A_5_9.elf...
done.
../../gdb-7.7.50.20140303/gdb/thread.c:85: internal-error: inferior_thread: Assertion `tp' failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.
Quit this debugging session? 
(y or n) [answered Y; input not from terminal]
undefined
This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.
../../gdb-7.7.50.20140303/gdb/thread.c:85: internal-error: inferior_thread: Assertion `tp' failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.
Create a core file of GDB? 
(y or n) [answered Y; input not from terminal]

Not on the clear what this could be...

[Bug] Parsing ELF file leaves variables list empty

"executable": "./Sw/A_XMC/out/use/A_Myriad_A_5_6.elf" successfully parses all symbols and I am able, through the Debug Console, to read variables using p SymbolName which means they're all there.

Shouldn't they appear in the variables list on the left? I can manually add Watch expressions and reference variables just fine.

Document install & update

The procedure for installing or updating code-debug is unclear. Starting with this page:

https://marketplace.visualstudio.com/items?itemName=webfreak.debug

There is a green "Get Started" button at the top of the page which takes you to some good instructions (https://code.visualstudio.com/docs/editor/extension-gallery?pub=webfreak&ext=debug) on how to install code-debug. The first time I installed code-debug, I clicked on that button and installed without too much trouble. However, later I wanted to try to reinstall, and I clicked on the "Get Started" link on the right side of the webfreak.debug page under "Resources." That took me to https://github.com/WebFreak001/code-debug , and I wasn't sure how to proceed. I clicked "Download ZIP" but then couldn't figure out what to do with the zip file.

I would suggest several things to avoid confusion:

  • On the webfreak.debug page, in the main text body section, insert a new, first section before the "Debug" section titled "Installation" with the text "To install this extension to Visual Studio Code, please follow the instructions at https://code.visualstudio.com/docs/editor/extension-gallery?pub=webfreak&ext=debug ."
  • Rename the "Get Started" link under "Resources" to "Github page".
  • Include a "HowToInstall" file in the zip file that contains instructions on how to install or update from the zip file (or if that's not practical, refer to the ext=debug page).
  • Do something on the github code-debug page to discourage downloading the zip file and encourage following the proper installation instructions.

lldb never shows local variables

  • lldb-350.0.21.3 (Xcode 7.3)
  • it works on the command line with lldb-mi (tried frame variables)
  • cwd and target are properly set

Screenshots are helpful but not required

I am trying to use VSCode 1.0 with your extension on OS X El Capitan, VS Code does not show local variables when VS Code hit breakpoint.

When I pause process from VSCode - I see local variables, but only simple values, not structures, all structures show <unknown> and Could not expand variable.

Would like to validate Rust debugging

Hi,

Could you provide a quick How-to on how to debug your debugging adapter. I've been trying to debug it on OSX after adding rust support but I can't manage to have the gdb debugger recognized once launched in debug mode.

Thanks

README.md images are broken

Il looks like README.md images URLs from your website are broken.

image

Relying on external sources makes the content your Git commits dependent of those sources. This implies a lot of considerations such as high-availability and concurrent version management.

As an example, it is impossible for contributors to update screen captures without access on i.webfreak.org.

IMO, you should directly add them into your repository and use relative URLs to display their content in the README.md file.

It does not breaks the page displayed on the marketplace.

For a real-world example, see:

Clear Debug console before start debugging

It seems debug console show more old logs when i stop debug and try to debug again.

#include <stdio.h>

int main(int argc, char* argv[])
{
    int a = 10;
    a *= 10;
    while (1) {
        printf("hello, world! the value = %d\n", a);
        a += 10;
        fflush(stdout);
    }
    return 0;
}

when start with no break points. Debug console window show more logs util it can't show any thing, then an empty debug console shows. Then i click stop debug button. when i start debug again. There is till no logs show (maybe for there have more old logs not showed before).

Two problem here:

  1. when more logs, debug console stucks
  2. restart debug not clear old logs

If submitting a bug please make sure

  • [Y ] If you are using gdb
    • [Y ] gdb --version >= 7.7.1
    • [ Y] it works on the command line with gdb
    • [ Y] cwd and target are properly set

Screenshots are helpful but not required

[Bug] CWD option escaped improperly on Windows

When CWD is not present, a general warning says that Warning: c:devMyPath: No such file or directory. As you can see, no slashes are present.

Setting "cwd": "C:/dev/My/Path" or "cwd": "C:\\dev\\My\\Path" produces the same message. However, setting it to "cwd": "C:/dev/My/Path/" (note trailing slash) ends up as

Failed to run command `environment-directory "C:\dev\My\Path\"`: Problem parsing arguments: environment-directory "C:\dev\My\Path\"
An error occured: Problem parsing arguments: environment-directory "C:\dev\My\Path\"

Not fluent enough in TypeScript to fix it I'm afraid.

set up path

I am not sure how to set PATH in Ubuntu after install debug? Thanks

Intellisense?

My source code is reasonably colorized, but there is no error detection, no "Show definition," etc., that I can see. What does it take to make that work for C/C++ programs?

[Feature] Remote debugging offset

Just tried out your latest release and was able to successfully connect to my GDB bridge and send a bunch of monitor commands!

Is there a way to set variable address offset?

I'm currently using an ELF file as executable, so I get a bunch of errors when I try to set a breakpoint. Not really interested in breakpoints right now, but more to read variables on the fly.

image

So it successfully reads the ELF file. But then it complains about some weird path with no slashes.

After that I try to set a breakpoint since my variable list is all empty. That's when the "Failed to run command" pops up. Any ideas there?

Also, I'm able to read data with x/uw 0x20000BD0 which is my 1ms timer and it successfully returns!

Changing breakpoints while paused doesn't work

Breakpoints can be set or cleared using the Code UI, but the change has no effect until the next time the Start button is clicked in Code.

For example, I can set some breakpoints through the Code UI, click Start, and Code will stop when a breakpoint is hit. But if I clear the breakpoint via Code UI and then continue, the program will continue to stop at that breakpoint location. Or if I set a new breakpoint during the pause and then continue, Code won't stop at the new breakpoint.

It seems as if Code updates gdb's breakpoints only at Start time, not during pauses.

Or maybe it's another case of improper argument passing to gdb. If I type enable or disable on the input line of the debug console while paused, breakpoints are enabled or disabled as expected. But if type disable th.c:1403, I get a message in the debug console: Bad breakpoint number 'th' and the breakpoint isn't disabled.

Debug adapter process has terminated unexpectedly

gdb version:
GNU gdb (GDB) 7.11

.gdbinit

python
print " โ€” โ€” Loading Rust pretty-printers โ€” โ€” "
sys.path.insert(0, "/Users/chetanconikee/.multirust/toolchains/stable-x86_64-apple-darwin/lib/rustlib/etc")
import gdb_rust_pretty_printing
gdb_rust_pretty_printing.register_printers(gdb)
end

screen shot 2016-06-04 at 5 30 07 pm

Unclear instructions

Not on the clear on what I should change "target" to. I assume the final executable?

I'm actually looking for remote GDB debugging. Perhaps this is the wrong plugin for me?

the internal structure of extension ignores a nesting level

for example:

#include <iostream>
#include <string>

struct A
{
  std::string infoa;
};

struct B
{
  std::string infob;
  A* a;
};

struct C
{
  std::string infoc;
  B* b;

  void Test()
  {
    std::cout << infoc << ", " << b->infob << ", " << b->a->infoa << std::endl;
  }
};

int main()
{
  A* a = new A{"aaa"};
  B* b = new B{"bbb", a};
  C c = C{"ccc", b};
  c.Test();
  return 0;
}

code-debug

same commands passed directly to gdb

7-data-evaluate-expression "_this"
7^done,value="{infoc = "ccc", b = 0x614c50}"
(gdb)
8-data-evaluate-expression "_b"
8^done,value="{infob = "bbb", a = 0x614c20}"
(gdb)
9-data-evaluate-expression "*a"
9^error,msg="Attempt to take contents of a non-pointer value."
(gdb)

gdb over ssh, break-insert is not work

-----code

#include <stdio.h>
#include <unistd.h>

int func ( void )
{
    return 0 ;
}

int main ( int argc ,char *argv[] )
{
    int a = 0 ;
    printf ( "hello world\n" ) ;
    return 0 ;
}

----- log

Running gdb over ssh...
undefined=thread-group-added,id="i1"
Running executable

Failed to run command `break-insert /root/duxin/project/gdbtest/main.cpp:6`: Cannot access memory at address 0x4005a4
An error occured: Cannot access memory at address 0x4005a4

hello world

----- launch.json

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Debug",
            "type": "gdb",
            "request": "launch",
            "target": "./main",
            "cwd": "${workspaceRoot}",
            "ssh": {
                "forwardX11": false,
                "host": "192.168.4.32",
                "cwd": "/root/duxin/project/gdbtest",
                "password": "oracle",
                "user": "root"
            }
        }
    ]
}

Errors when trying to re-install

This might be considered a user error, because what I did was install code-debug a second time, rather that uninstalling and reinstalling, or updating. I didn't read far enough in the installation instructions. :-)

However, I would suggest that code-debug (or perhaps VS Code itself) should check if the user is trying to reinstall, and give some more user-friendly error handling.

Attached is the output I got on my xterm, when I started Code, then tried to reinstall code-debug. Note that the first few lines, down to and including "bash: no job control in this shell" happen every time I start Code. That's probably a separate issue, but if someone knows how to fix that, please let me know.

InstallErrors.txt

invalid lldb command on OSX

When starting debug (green play button) the following error is outputted:

undefined(lldb) 1-gdb-set target-async on
(lldb) 2-file-exec-and-symbols "/Users/nikharris/source/navitas-hub-emulator/hub-emulator"
undefinederror: '1-gdb-set' is not a valid command.
error: '2-file-exec-and-symbols' is not a valid command.

platform: OSX 10.11.3
Visual Studio Code version: 0.10.11
lldb-mi version: 7.4

launch.json

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Debug",
            "type": "lldb-mi",
            "request": "launch",
            "target": "./hub-emulator",
            "cwd": "${workspaceRoot}"
        }
    ]
}

Specifying arguments in a launch configuration, breaks debugging

Greetings. I recently tried to create a debug configuration, one with GDB, and another with LLDB, neither worked...

GDB

No errors printed out in Debug Console, and no error popups shown.

launch.json
{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Debug",
            "type": "gdb",
            "request": "launch",
            "preLaunchTask": "exifextract_all",
            "cwd": "${workspaceRoot}",
            "target": "./Build/Final/exifextract",
            "arguments": "./Test/IMG_0985.JPG ./Test/IMG_1351.JPG ./Test/IMG_1353.JPG ./Test/IMG_1355.JPG ./Test/IMG_1357.JPG"
        }
    ]
}

LLDB (using lldb-mi)

No errors in Debug Console. One error popup shown...:

image

launch.json
{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Debug",
            "type": "lldb-mi",
            "request": "launch",
            "preLaunchTask": "exifextract_all",
            "cwd": "${workspaceRoot}",
            "target": "./Build/Final/exifextract",
            "arguments": "./Test/IMG_0985.JPG ./Test/IMG_1351.JPG ./Test/IMG_1353.JPG ./Test/IMG_1355.JPG ./Test/IMG_1357.JPG"
        }
    ]
}

It's worth noting that, when using the GDB configuration, my executable doesn't appear to ever be launched.
However, when using the LLDB configuration, my executable is launched, but terminated almost immediately.

It's also worth noting that my executable runs just fine from the command-line.

I've reviewed issues #37 and #59 (as well as #60, it's duplicate), but neither were of any help to me.

Both GDB and LLDB work fine from the console, and the versions of both, meet the requirements (7.7.1 for GDB, 3.7.1 for LLDB).

Specs:

  • OS X 10.11.5
  • Visual Studio Code v1.2.0
  • Code Debug v0.8.1

Edit: As pointed out in a later comment, when I removed the arguments property from my launch configuration(s), they work fine.

Spurious hover-related warnings

I have no IntelliSense extensions loaded yet. While stopped at a breakpoint in my C program, if I move the mouse over various words in the program, I get warning messages in the debug console. Notice for example that the word "negative" was from a /* comment */, so it shouldn't try to get its value!

Hovering over a variable name that has a value does seem to work - it (Code or code-debug) shows the value in a hover message.

spurioushovererrors

[Feature] Automatically run script

Prior to debugging, I have to run source gdb.script in the Debug Console to set up my GDB bridge properly. I have a bunch of monitor commands in there, but also (as mentioned in #6 (comment)) I choose to run e.g. add-symbol-file C:/dev/My/Path/MyElfFile.elf 0x8020000 to manually set my address offset.

Would be super sweet to having a script called automatically! What do you think?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.