FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Can't make GDB debug
Goto page 1, 2  Next
 
Post new topic   Reply to topic     Forum Index -> Descent
View previous topic :: View next topic  
Author Message
MageSlayer



Joined: 29 Sep 2007
Posts: 5

PostPosted: Sat Sep 29, 2007 11:57 am    Post subject: Can't make GDB debug Reply with quote

Hi.

I'm trying to make gdb stop on breakpoints, but no luck. It just tells something like:

Code:
GNU gdb 6.6
Copyright (C) 2006 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i686-pc-linux-gnu"...
Using host libthread_db library "/lib/libthread_db.so.1".
(gdb) Make breakpoint pending on future shared library load? (y or [n]) [answered N; input not from terminal]
(gdb) (gdb) Starting program: /home/denis/workspace/Test3/hello
No source file named /home/denis/workspace/Test3/hello.d.
Failed to read a valid object file image from memory.
[Thread debugging using libthread_db enabled]
[New Thread -1209795904 (LWP 15598)]
hello world
args.length = 1
args[0] = '/home/denis/workspace/Test3/hello'

Program exited normally.
(gdb)


AFAIU, I've done my settings as your page says. That message about hello.d is also strange, source file is there.
Back to top
View user's profile Send private message
L



Joined: 01 Sep 2007
Posts: 21
Location: Germany

PostPosted: Sun Sep 30, 2007 1:18 pm    Post subject: Reply with quote

Hi,

I've also got problems with the debugger. Does yours ever hit any breakpoint? Have you compiled your program with the -g switch?

I've also got the problem, that gdb did not want to find the source file, but I can't remember, what I've done, so that it finally worked. I guess, it was the descent update.

[url] http://www.dsource.org/forums/viewtopic.php?t=2900 [/url]

I'm using descent v0.4.3.20070907 from svn and it still does not work as expected. The debugger hits the breakpoints and pauses the program, but descent doesn't switch to the debug view and I've got to use it manually, e.g. typing continue and so on...


Code:

GNU gdb 6.5
Copyright (C) 2006 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i686-pc-linux-gnu"...Using host libthread_db library "/lib/tls/i686/cmov/libthread_db.so.1".

(gdb) Breakpoint 1 at 0x805bd8f: file /home/lucom/data/work/eclipse-workspaces/runtime-EclipseApplication/Test1/src/main.d, line 29.
(gdb) Breakpoint 2 at 0x805bdfb: file /home/lucom/data/work/eclipse-workspaces/runtime-EclipseApplication/Test1/src/main.d, line 31.
(gdb) Breakpoint 3 at 0x805be4d: file /home/lucom/data/work/eclipse-workspaces/runtime-EclipseApplication/Test1/src/main.d, line 34.
(gdb) (gdb) Starting program: /home/lucom/data/work/eclipse-workspaces/runtime-EclipseApplication/Test1/main
[Thread debugging using libthread_db enabled]
[New Thread -1210468672 (LWP 9041)]
[Switching to Thread -1210468672 (LWP 9041)]

Breakpoint 1, D main ()
    at /home/lucom/data/work/eclipse-workspaces/runtime-EclipseApplication/Test1/src/main.d:29
/home/lucom/data/work/eclipse-workspaces/runtime-EclipseApplication/Test1/src/main.d:29:232:beg:0x805bd8f
Current language:  auto; currently d
(gdb) continue
Continuing.

Breakpoint 2, D main ()
Back to top
View user's profile Send private message
MageSlayer



Joined: 29 Sep 2007
Posts: 5

PostPosted: Mon Oct 01, 2007 4:17 am    Post subject: Reply with quote

Quote:
Does yours ever hit any breakpoint?


No, no breakpoint worked.

Quote:
Have you compiled your program with the -g switch?


Yes, I've included -g option using http://www.dsource.org/projects/descent/wiki/DebuggingPrograms guide. I also check the executable. strip utility cuts off 400k when using it.

Quote:
I've also got the problem, that gdb did not want to find the source file, but I can't remember, what I've done, so that it finally worked. I guess, it was the descent update. I'm using descent v0.4.3.20070907 from svn and it still does not work as expected.


I also use this version.

Quote:
The debugger hits the breakpoints and pauses the program, but descent doesn't switch to the debug view and I've got to use it manually, e.g. typing continue and so on...


Mine doesn't hit any breakpoint Sad. Somebody wrote about gdb 6.6 incompatibity with D, but I see you use gdb 6.5 and have the same effect.
It seems we must wait for Descent developer to comment the issue.
Back to top
View user's profile Send private message
asterite



Joined: 01 Jun 2006
Posts: 235
Location: Buenos Aires, Argentina

PostPosted: Mon Oct 01, 2007 8:57 am    Post subject: Reply with quote

Sorry for the delay, I wanted to see what others commented about this issue. If I test gdb in my virtual machine, it works. If you can send me a directory tree of the files you use for debugging, and also the functions, so that I can reproduce the problem, it would be great. You can generate di interface files for that.

Or maybe a description on what steps you use to compile and start debugging, where is the executable in relation to the project's path, etc. Another thing: I downloaded gdb and started using it: I applied no patch. (I'll tell you which version I'm using when I get home).
Back to top
View user's profile Send private message Yahoo Messenger MSN Messenger
MageSlayer



Joined: 29 Sep 2007
Posts: 5

PostPosted: Mon Oct 01, 2007 9:11 am    Post subject: Reply with quote

Quote:
If you can send me a directory tree of the files you use for debugging, and also the functions, so that I can reproduce the problem, it would be great.


Well, it's just hello world application. Here is complete directory under ~/workspace - http://rapidshare.com/files/59531729/Test3.tar.bz2.html

Quote:
Or maybe a description on what steps you use to compile and start debugging


Well, steps:
- rebuild, using external tools
Main-Location = /usr/bin/rebuild
Working directory = ${project_loc}
Arguments = ${resource_loc} -g
-navigator-click at hello (executable)-Debug as-D application[/img]
Back to top
View user's profile Send private message
asterite



Joined: 01 Jun 2006
Posts: 235
Location: Buenos Aires, Argentina

PostPosted: Mon Oct 01, 2007 9:14 am    Post subject: Reply with quote

Cool, I'll test it at home this night and report back.
Back to top
View user's profile Send private message Yahoo Messenger MSN Messenger
asterite



Joined: 01 Jun 2006
Posts: 235
Location: Buenos Aires, Argentina

PostPosted: Tue Oct 02, 2007 9:36 pm    Post subject: Reply with quote

Well, I tested your code. Compiling with gdc it works. I didn't test it with rebuild, but it should be the same. Can you try compiling it with gdb?

I'm using gdb 6.6-debian (I think it came installed in the Ubuntu I downloaded).

Also, if gdb doesn't find the source files, you can try sending it the following command:
directory <source_path>

After that, check if Descent finds a subsequent breakpoint. If it does, tell me so because that's the problem...
Back to top
View user's profile Send private message Yahoo Messenger MSN Messenger
MageSlayer



Joined: 29 Sep 2007
Posts: 5

PostPosted: Tue Oct 02, 2007 11:34 pm    Post subject: Reply with quote

Quote:
Can you try compiling it with gdb?


I didn't catch you. gdb is debugger, and AFAIU it doesn't compile anything. Correct me, if I'm wrong.

Quote:
I'm using gdb 6.6-debian


Well, then question with version is solved Smile.

Quote:
Also, if gdb doesn't find the source files, you can try sending it the following command:
directory <source_path>


I managed gdb to see my debug info. I'm on Gentoo and I took another ebuild with dmd,phobos lib installing separately. It seems after that gdb was able to see debug info. Don't ask me why Smile

Quote:
After that, check if Descent finds a subsequent breakpoint. If it does, tell me so because that's the problem...


Now, gdb finds my breakpoints and stops at them, but now I have the same issue as L has. I can use only gdb commands to debug. For example, variables window doesn't show my local vars and so on. Eclipse shotcuts to step-over, step-into also does not work.[/quote]
Back to top
View user's profile Send private message
asterite



Joined: 01 Jun 2006
Posts: 235
Location: Buenos Aires, Argentina

PostPosted: Wed Oct 03, 2007 7:37 am    Post subject: Reply with quote

Sorry, I meant compiling with gdc.

I'll see what I can do with the other problem (the problem is, I can't reproduce it).
Back to top
View user's profile Send private message Yahoo Messenger MSN Messenger
MageSlayer



Joined: 29 Sep 2007
Posts: 5

PostPosted: Wed Oct 03, 2007 9:16 am    Post subject: Reply with quote

Quote:
Sorry, I meant compiling with gdc.


It's gdc compiled case.
Compiling with dmd gives quite usable executable, but when I try to debug:

Code:
GNU gdb 6.6
Copyright (C) 2006 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i686-pc-linux-gnu"...
(gdb) Die: DW_TAG_<unknown> (abbrev = 5, offset = 361)
   has children: FALSE
   attributes:
      DW_AT_byte_size (DW_FORM_data1) constant: 8
      DW_AT_type (DW_FORM_ref4) constant ref: 355 (adjusted)
Dwarf Error: Cannot find type of die [in module /home/denis/workspace/Test3/hello]
Die: DW_TAG_<unknown> (abbrev = 5, offset = 361)
   has children: FALSE
   attributes:
      DW_AT_byte_size (DW_FORM_data1) constant: 8
      DW_AT_type (DW_FORM_ref4) constant ref: 355 (adjusted)
Dwarf Error: Cannot find type of die [in module /home/denis/workspace/Test3/hello]
(gdb) Die: DW_TAG_<unknown> (abbrev = 5, offset = 361)
   has children: FALSE
   attributes:
      DW_AT_byte_size (DW_FORM_data1) constant: 8
      DW_AT_type (DW_FORM_ref4) constant ref: 355 (adjusted)
Dwarf Error: Cannot find type of die [in module /home/denis/workspace/Test3/hello]
(gdb) (gdb) Starting program: /home/denis/workspace/Test3/hello
Using host libthread_db library "/lib/libthread_db.so.1".
Failed to read a valid object file image from memory.
[Thread debugging using libthread_db enabled]
[New Thread -1209981264 (LWP 5662)]
hello world
args.length = 1
args[0] = '/home/denis/workspace/Test3/hello'
a=3, b=4
Program exited normally.
(gdb)


Later, when I found workaround for problem (http://d.puremagic.com/issues/show_bug.cgi?id=1079). Problem still seems to be not solved. So I applied -gc flag, instead of -g. After that I ran into exactly the same issue as with gdc. Breakpoints trigger, but shortcuts don't work.

P.S. I added a small procedure justing printing variable values.
P.P.S. Maybe some more close operation needed? I stored my ICQ in profile. So welcome.
Back to top
View user's profile Send private message
L



Joined: 01 Sep 2007
Posts: 21
Location: Germany

PostPosted: Fri Jun 20, 2008 4:18 am    Post subject: Reply with quote

I've still got that problem with debugging D-programs

    descent 5.2.20080501
    gdb 6.8-debian, gdc (GCC) 4.2.3 20080225 (prerelease gdc 0.25 20071215, using dmd 1.022) (Ubuntu 0.25-4.2.3-2ubuntu2),
    rebuild 0.75,
    eclipse 3.4 RC4,
    java 1.6.0_06
    on ubuntu 8.04 LTS.
    tango/tangobos - gdc


Symptoms: Everything works, except the automatic switch to the debug-view and debug-features.
I can run a small test application in debug mode. The debugger starts, but descent seems to behave as if a normal program has been run. I get the following output:

I installed the same deb-packages for rebuild/dsss, tango and tangobos from
http://download.palos.ro/Debian%20D%20Packages/binary/i386/
on a debian (etch?) system and the debug-view worked there.

Code:

GNU gdb 6.8-debian
Copyright (C) 2008 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 "i486-linux-gnu"...
(gdb) Breakpoint 1 at 0x8060645: file /home/lucom/data/work/eclipse-workspaces/L/Client/gui/main.d, line 9.
(gdb) (gdb) Starting program: /home/lucom/data/work/eclipse-workspaces/L/Client/bin/debug/main
[Thread debugging using libthread_db enabled]
[New Thread 0xb7db56b0 (LWP 13324)]
[Switching to Thread 0xb7db56b0 (LWP 13324)]

Breakpoint 1, _Dmain ()
    at /home/lucom/data/work/eclipse-workspaces/L/Client/gui/main.d:9
/home/lucom/data/work/eclipse-workspaces/L/Client/gui/main.d:9:75:beg:0x8060645
Current language:  auto; currently minimal
(gdb)


The test application:

Code:

module gui.main;

import std.stdio;

int main(char[][] args) {
   writefln("foo");//here's the breakpoint
   writefln("foo");
   return 0;
}
Back to top
View user's profile Send private message
asterite



Joined: 01 Jun 2006
Posts: 235
Location: Buenos Aires, Argentina

PostPosted: Fri Jun 20, 2008 7:06 pm    Post subject: Reply with quote

Ok... Now that I've switched to Ubuntu 8.04 (I used Windows before) I was able to test it... Indeed, the gdb version I used printed a breakpoint as

#n location at file:lineNumber address

but in the current gdb it's

#n location
at file:lineNumber address

I've fixed this in trunk. Since it'll be some time until the next release, the best you can do is use a trunk copy...
Back to top
View user's profile Send private message Yahoo Messenger MSN Messenger
3-S-E



Joined: 16 Jun 2008
Posts: 54

PostPosted: Sat Jun 21, 2008 4:15 am    Post subject: Reply with quote

But how to use a trunk copy? All I see are java-source-files there!
Is there an wiki / tutorial for this?

Why not releasing nightly builds of descent beside the stable-releases over svn. This would help us a lot and would give you better feedback!

EDIT: Okay, I've figured it out by myself and gdb works fine. There is only no console-output of your application because gdb uses console to tell you what it is doing...

For all who don't know how to update from trunk, here is my solution:

First you have to go here: http://www.dsource.org/projects/descent/browser/trunk

At the bottom of this page you will find a link with the headline "Download in other formats:".
Click on "Zip Archive" and a while later a download will start.

After download unpack the archive.
Open Eclipse with a new Workspace like "decent_trunk" in a directory of your choice
Click on "File" -> "Import"
Then "General" -> "Existing Projects into Workspace"
At "Select root directory" click an "Browse" and select the directory where you unpack the trunk-zip-file. This directory has to contain a lot of subdirectories like "decent.debug.core"

If you choose the proper directory a lot of projects will appear in the "Import Projects"-form.
Select "Copy projects into workspace" (if your trunk-folder isn't already in the workspace-folder). I didn't select this checkbox because I've already copied the trunk folder properly into workspace before import. Try it out by yourself.

Click "Finish"!

Okay, now a bunch of projects should appear at the "Project Explorer"
Eclipse should now do a full rebuild on this workspace... if it doesn't, click on "Project" at the upper menu and "Build all", or try "F5" for an refresh...
After a while of rebuilding there should be at least no errors (red crosses beside the icons at Project-Explorer) at the descent.debug.core project.

And now how I managed to update the plug-in (I did it with Windows and 7Zip):

(Make sure eclipse is closed!)

I've opened the directory containing the newly build class-files at my workspace-directory -> "descent.debug.core/bin/descent/internal/debug/core/model/gdb"
Then I've opened the jar-archive at the eclipse installation directory (linux: "/home/USERNAME/.eclipse/org.eclipse.sdk.ide/updates/eclipse/plugins" - file: "descent.debug.core_0.5.2.20080501.jar") with 7zip and replaced
the "Running.class"-File with the newly build one (at ubuntu 8.04 you have the "archive-manager" for this).

Okay... that's it!

Run Eclipse, open a Workspace / D-Project and do your gdb-debugging.

Hope that will help some of you.
Back to top
View user's profile Send private message
asterite



Joined: 01 Jun 2006
Posts: 235
Location: Buenos Aires, Argentina

PostPosted: Sat Jun 21, 2008 12:56 pm    Post subject: Reply with quote

Wow, S-3-E, that's very useful, thank you! I don't know if I have to give permissions to allow anyone to write in the wiki. If you could do a wiki page in Descent for it, that would be great.

Instead of replacing the class files in the plugins, you can create them from the project itself. Just open the file site.xml in the descent.update-site project and click "Build All". After the build is finished, you should have the new plugins in the plugins directory.

I would like to have nightly builds, but I'm not familiar with how to do that, nor I have the time for it. Also, there are times where the code is kind of unstable, mostly because the project is just beginning... If anyone wants to care about nightly builds (I guess it's just about updating to the latest trunk and building all... maybe an ant.xml for that), he's welcome to join the project. Smile

I'm glad the debugger is finally working for you. Very Happy
Back to top
View user's profile Send private message Yahoo Messenger MSN Messenger
3-S-E



Joined: 16 Jun 2008
Posts: 54

PostPosted: Sat Jun 21, 2008 4:00 pm    Post subject: Reply with quote

No problem! I like D and I think Descent is one of the most promising plug-ins for the brilliant Eclipse-IDE.

I would love to have access privilege to the wiki, though my english is not that good... Embarassed

Nontheless it would be a pleasure for me to help, maybe I can do some translation of the ui into german language?!

Back to topic: The debugging works fine now under Ubuntu, but the gdc support lacks further on. Atm I switched back to windows to work on my project (with dmd). Tomorrow, if I have some time left over, I'll try to figure out, what's wrong with my config!
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> Descent All times are GMT - 6 Hours
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group