yazd / DKit

DKit is a package to aid developing D programs using Sublime Text 3.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

GDB debug addition

stef-k opened this issue · comments

Not an issue but i would like to mention that after some additions on SublimeGDB plugin it is possible to debug D sources. You can check a screenshot of a debugging session at https://github.com/stef-k/SublimeGDB/wiki/D-language-debugging-session-screenshot working on Ubuntu 13.04 with system's GDB.

Its a small patch still in progress (not working on OS X 10.9, Windows untested) but for Linux at least can show variable values...

If you are interested of getting some functionality, the forked SublimeGDB can be found at https://github.com/stef-k/SublimeGDB and the original work: https://github.com/quarnster/SublimeGDB.

Looking very interesting.. I remember trying SublimeGDB and not succeeding a few months ago, but I will have another go at your fork either today or tomorrow.

Well the original does not work because GDB expects debug symbols. The fork invokes dmd -g before invoking the debugger. It would be nice if all utilities could come in a form of one plugin, it would remind more of an IDE towards D lang.

I realise the need for -g. My problem wasn't with GDB. It was with the plugin and my problem still persists. I tried the plugin again, and after setting it up, whenever I start debugging, the GDB panels flash and close, and the breakpoints aren't hit.

Your idea about the IDE is good, and I'm open for feature/pull requests. Do you have any ideas?

Did you used the forked sublimmegdb if yes it's weird because I use it for basic debugging and being able to add break points and check the values of the variables.
As for ideas lets first see if we can get the plugins work as expected.

@stef-k got the same problem as @yazd

Would you mind sharing example user config file for plugin?
Also love your Subl3 setup, looks amazing 👍

Hi, sorry for the delay but i was at work + time zone difference. Later today i'll post all the details about the use of GDB. Regards.

Update:

I assume you mean the theme, its from https://github.com/netatoo/phoenix-theme, indeed a splendid theme.

For the D language GDB support please check at https://github.com/stef-k/SublimeGDB/wiki where all settings both default and user's are listed.
Regards.

@stef-k thanks for wiki and info.

Still doesn't work for me both with Sublime2 and Sublime3.
GDB related windows just blink out in a second and nothing happens.

When I tried F5 with C program it insist that configuration is bad.

Thats weird. I'll try to do a clean install and re download the plugin and let you know.

Test it again with clean copy of the plugin, steps:

    import std.stdio;

    void main()
    {
        auto foo = "testing";

        writeln(foo); //<--- breakpoint here using context menu or F9
    }
  • Added breakpoint at the line
  • Pressed F5 and the debug session started showing the variable from the breakpoint

My System: Ubuntu 13.10, Sublime 3047, GDB GNU gdb (GDB) 7.6.1-ubuntu

I cannot reproduce the problem, try pressing `(tilde) to bring the console output and see for errors.

This is what I get in the console:

Will write debug info to file: stdout
Process: b''
b''
0Process: <subprocess.Popen object at 0x7f59f3cb3790>
Process: <subprocess.Popen object at 0x7f59f3cb3790>
pty: 3, tty: None, name: /tmp/tmp8fpdicGDB session ended

Environment:
Fedora 19 64-bit, Sublime 3059, GDB GNU gdb (GDB) Fedora 7.6.1-46.fc19

Hi again, a quick question. Do you have any problems with the original SublimeGDB plugin? Please try a debug session for one of the original supported languages.
Regards.

Sorry for the late answer but I've been extremely busy.
I tried the original SublimeGDB with both C++ and D programs right now and followed https://github.com/quarnster/SublimeGDB#usage and both worked.
Then I tried again with your fork, and for some reason (might be because I set sublime project settings now), I'm getting this different and weird error:

Traceback (most recent call last):
  File "/home/userx/apps/sublime_text_3/sublime_plugin.py", line 526, in run_
    return self.run()
  File "/home/userx/.config/sublime-text-3/Packages/SublimeGDB/sublimegdb.py", line 1628, in run
    stderr=subprocess.PIPE)
  File "X/subprocess.py", line 818, in __init__
  File "X/subprocess.py", line 1416, in _execute_child
FileNotFoundError: [Errno 2] No such file or directory: '/bin/sh'

/bin/sh does indeed exist. I'm trying to figure this out now.

That's weird... Now it's working!
Maybe a restart of Sublime made it work?

Hi, i was thinking that it may have to do with Python's subprocess module. For some reason it works ok in Debian (Ubuntu) system but not in others.

Sadly i am not familiar with non Debian systems, it may be the setup of the user's bash (.bashrc, etc).

I could change though how the debugger is called.

I will come back when have anything new to report.
Regards

To continue with my previous comment, there must be some difference between the two Linux distros and this may be the problem. In fact my tries to get the auto complete from DKit work have failed. From the command line I am able to invoke the DCD but I had no luck from Sublime.

I am guessing that if the auto complete works in Ubuntu, then the debug will work on Fedora?

So did the debug worked as you mentioned?
Regards.

I was able to reproduce the initial bug by not creating a sublime project and setting its sublimegdb settings.
While having the settings made the debugging work correctly.

I wasn't able to reproduce the issue with subprocess again.

Regarding the issues that you're facing with DKit, do you get any error in the console? If not, did you try restarting the DCD server? There is a command for that within Sublime as I find that DCD crashes sometimes.

About the projects, i am using a single file approach, the session you see in screenshot is a stand alone file. The settings are exactly the same as the ones I've posted in the wiki https://github.com/stef-k/SublimeGDB/wiki

In user's settings having the target file to noset the D branch of the plugin pick ups the current file as a debug target.

This is the relevant code at line 1614. I assume needs some work to add an else clause in order to pick a whole project, sorry.

               if (target_file == "notset" or target_file == "" or
                    not target_file):
                    target_file = filename + file_type

As for the DKit - DCD I am opening a new issue right now to report the details.

Hi, i've added a new testing branch to address the issues in non Ubuntu systems.

You can find the new branch here

I've also opened an issue for the problem you met here so you can report any progress or problems if the issue persists.

Regards,
Stef

I have updated the plugin to work with rdmd and have a second user confirming that it works for files (tested with 3 files in the working dir) but not with dub.

Can you please check if works for you? If not feel free to open an issue here i am closing this as it is not direclty related to DKit.

Currently there is an issue opened to my fork for dub support, if we could implement that, then SublimeGDB for D and DKit could make a strong base for D in Sublime Text.

Thanks for the input,
Stef