Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » GDB crashing when started from CDT(GDB failing to launch)
GDB crashing when started from CDT [message #521054] Tue, 16 March 2010 10:51 Go to next message
Oliver Hall is currently offline Oliver HallFriend
Messages: 6
Registered: March 2010
Junior Member
Hi,

Please excuse this if it's so painfully obvious that I should be ashamed of myself! I've been searching the web and this forum but can't find anyone with the same problem as I have.

The symptom:
I have a C++ multithreaded project - nothing very flash (I've really only just started). Other than using a 3rd party library (upnp), itis standard C++ - nothing fancy, no extra Eclipse plugins. It compiles without warnings or errors. If I run the exe under a Cygwin console, it works fine. If I run the exe under command line gdb at the console it runs fine (though I have no idea how to use "nude" gdb Wink. I've not tinkered with any debug settings (i.e. using the default DSF-GDB mode), and I'm running a Debug build(!)

However - if I try to debug from within Eclipse, on the first attempt, the exe will launch (I don't get asked to change perspective - which seems odd) and when I look in the Debug perspective, I see my exe, with 3 child processes (gdb/mi, gdb and my executable). gdb/mi has a little "cog" icon next to it,the other two show the green "play" icon.

What's odd is, my breakpoint (start of main) hasn't been hit (which I guess is why the perspective hasn't changed), and none of the processes allow me to see where they are or step through the code. There's no output I can see to give me any idea where things have gone wrong.

If I then try to terminate the processes, I get Termination failed after a timeout.

Now... if I try to Debug again, the process tree appears and then terminates immediately and I wind up with a stackdump from gdb (attached below).

I'm sure I'm doing something stupid - but can anyone shed any light on where I might be going wrong or where I could look to find the error?

I should mention - I built the default "Hello World" CDT app and it works perfectly! Very frustrating.

Please help!
Ol

Environment:
Windows Vista 32-bit
Cygwin (CYGWIN_NT-6.0 1.7.1)
Eclipse IDE for C++ developers package (build 20100209-1602)
(built with Eclipse 3.5.2, CDT 6.0.2)
GDB 6.8.0.200803280-cvs (cygwin-special)

--- gdb.exe.stackdump
Exception: STATUS_ACCESS_VIOLATION at eip=75D6EDBC
eax=00007FFB ebx=00000000 ecx=021A001C edx=008D0146 esi=00000000 edi=7FFDEC00
ebp=0022BA84 esp=0022B7AC program=C:\Tools\Cygwin\bin\gdb.exe, pid 4260, thread main
cs=001B ds=0023 es=0023 fs=003B gs=0000 ss=0023
Stack trace:
Frame Function Args
0022BA84 75D6EDBC (7FFDEC00, 00000000, 0022BAC4, 00000000)
0022BD18 75D5899D (006D9950, 0022BD60, 10581F50, 6106EBD4)
0022C1E8 00461CC6 (00000000, 00000000, 106371D0, 00000000)
0022C238 004136CB (00461C50, 00000000, 0064D968, 00000006)
0022C2C8 004637F2 (0022C348, FFFFFFFF, 00000000, 00000000)
0022C3A8 00429CC2 (00000000, 00000000, 00000060, 75D7AEB6)
0022C3C8 004628CB (000001DC, 0022C400, 00000000, 00000000)
0022C708 004632A0 (10525570, 1063E938, 10510228, 00000000)
0022C738 00413C8B (00000000, 00000000, 00000000, 00000000)
0022C778 00402519 (10639EAC, 00000000, 1063E340, 0040C69B)
0022C7C8 00516404 (00000000, 00000000, 00000000, 00000024)
0022C848 00515D37 (1051F0A0, 0022C8B0, 10582320, 00000000)
0022C878 00413482 (0022C8A0, 1051F0A0, 00515C50, 0022C8B0)
0022C8C8 00515A0E (10578470, 00000001, 0022C8F8, 004363BA)
0022C8D8 0049E729 (10578470, 00000000, 0022C8A0, 0022C880)
0022C8F8 004363BA (00000000, 00000000, 0022C918, 00435D95)
End of stack trace (more stack frames may be present)
Re: GDB crashing when started from CDT [message #521082 is a reply to message #521054] Tue, 16 March 2010 12:45 Go to previous messageGo to next message
Marc Khouzam is currently offline Marc KhouzamFriend
Messages: 285
Registered: July 2009
Senior Member
If you are using DSF-GDB, one of the consoles is called 'gdb traces'. That can help in figuring out what is going on with GDB and why it crashes.

Are you sure you are using DSF-GDB? It is not the default for CDT 6.0.
Re: GDB crashing when started from CDT [message #521095 is a reply to message #521082] Tue, 16 March 2010 13:09 Go to previous messageGo to next message
Oliver Hall is currently offline Oliver HallFriend
Messages: 6
Registered: March 2010
Junior Member
Hi Marc,

Thanks for the quick reply.

Is it possible that the "all-in-one" CDT/Eclipse download has a different default? My project settings are set to use the workspace's default lanucher (which is set to GDB (DSF)).

Also, do I need to do anything to enable the "gdb traces" console? I can't see any checkboxes to enable it, and I only get the standard console, which is empty.

Sorry for asking all these questions - I haven't used Eclipse for a while and it's obviously come on a long way since then!

Thanks again,
Ol
Re: GDB crashing when started from CDT [message #521124 is a reply to message #521095] Tue, 16 March 2010 14:18 Go to previous messageGo to next message
Marc Khouzam is currently offline Marc KhouzamFriend
Messages: 285
Registered: July 2009
Senior Member
> Is it possible that the "all-in-one" CDT/Eclipse download
> has a different default? My project settings are set to
> use the workspace's default lanucher (which is set to
> GDB (DSF)).

Maybe you had set your workspace to DSF-GDB before?
Also, in CDT 7.0 latest build, DSF-GDB is the default.
I'm asking just to make sure I understand what CDT your are running.

> Also, do I need to do anything to enable the "gdb traces"
> console? I can't see any checkboxes to enable it, and I
> only get the standard console, which is empty.

It is always enabled. In the console view, there is a little TV icon with an arrow. If you click the arrow, you can choose a different console. You'll see 'gdb traces' there.

Re: GDB crashing when started from CDT [message #521126 is a reply to message #521124] Tue, 16 March 2010 14:25 Go to previous messageGo to next message
Oliver Hall is currently offline Oliver HallFriend
Messages: 6
Registered: March 2010
Junior Member
Hi Marc,

I see!

Here's the output, but to my untrained eye, I'm not sure what migth be wrong here. I'd read somewhere that the missing .gdbinit isn't anything to worry about?

198,817 1source .gdbinit
198,820 &"source .gdbinit\n"
198,851 &".gdbinit: No such file or directory.\n"
198,852 1^error,msg=".gdbinit: No such file or directory."
198,858 (gdb)
198,864 2-file-exec-and-symbols F:/Ultamation/software/Eclipse/ControlPoint/Debug/ControlPoi nt.exe
199,780 2^done
199,780 (gdb)
199,787 3-environment-cd F:/Ultamation/software/Eclipse/ControlPoint
199,791 3^done
199,791 (gdb)
199,796 4-gdb-set auto-solib-add on
199,797 4^done
199,797 (gdb)
199,815 5-environment-directory F:/Ultamation/software/Eclipse/ControlPoint F:/Ultamation/software/E\
clipse/ControlPoint/.settings F:/Ultamation/software/Eclipse/ControlPoint/Debug F:/Ultamation/softwa\
re/Eclipse/ControlPoint/Debug/outputmanager F:/Ultamation/software/Eclipse/ControlPoint/Release F:/U\
ltamation/software/Eclipse/ControlPoint/outputmanager
199,827 5^done,source-path=" F:/Ultamation/software/Eclipse/ControlPoint:F:/Ultamation/so ftware/Eclip\
se/ControlPoint/.settings:F:/Ultamation/software/Eclipse/Con trolPoint/Debug:F:/Ultamation/software/E\
clipse/ControlPoint/Debug/outputmanager:F:/Ultamation/softwa re/Eclipse/ControlPoint/Release:F:/Ultam\
ation/software/Eclipse/ControlPoint/outputmanager:$cdir:$cwd "
199,828 (gdb)
199,856 6-break-insert main.cpp:80
199,902 6^done,bkpt={number="1",type="breakpoint",disp="keep",enabled= "y",addr="0x00402558",func="ma\
in",file="../main.cpp",fullname=" /cygdrive/f/Ultamation/software/Eclipse/ControlPoint/main.cp p ",line\
="80",times="0"}
199,913 (gdb)
199,985 7-break-insert -t main
199,997 7^done,bkpt={number="2",type="breakpoint",disp="del",enabled= "y",addr="0x0040256e",func="mai\
n",file="../main.cpp",fullname=" /cygdrive/f/Ultamation/software/Eclipse/ControlPoint/main.cp p ",line=\
"80",times="0"}
199,998 (gdb)
200,000 8-exec-run
200,001 8^running
200,002 (gdb)
200,059 ~"[New thread 1016.0x1df8]\n"

That's it... and a terminated process Sad
Re: GDB crashing when started from CDT [message #521162 is a reply to message #521126] Tue, 16 March 2010 15:45 Go to previous messageGo to next message
Marc Khouzam is currently offline Marc KhouzamFriend
Messages: 285
Registered: July 2009
Senior Member
Nothing jumps at me.
And you say GDB has crashed after that?

Next step is to copy/paste the same commands into a command-line GDB to see if it crashes.

You would launch GDB like this:

gdb -nx -i mi2

Re: GDB crashing when started from CDT [message #521170 is a reply to message #521162] Tue, 16 March 2010 16:08 Go to previous messageGo to next message
Oliver Hall is currently offline Oliver HallFriend
Messages: 6
Registered: March 2010
Junior Member
Hi Marc,

One step further Wink

As per your instructions, I typed in each of the gdb trace console commands into gdb started at the command line (with the options you gave) and the results are identical... until I get to step 8.

I've clipped the intial stuff as it's the same as the CDT instance, but the "8-exec-run" line starts the program and successfully halts on the breakpoint at main.

7-break-insert -t main
7^done,bkpt={number="2",type="breakpoint",disp="del",enabled= "y",addr="0x0040259
2",func="main",file="../main.cpp",fullname="/cygdrive/f/Ultamation/software/Ecli
pse/ControlPoint/main.cpp",line="80",times="0"}
(gdb)
8-exec-run
8^running
(gdb)
~"[New thread 6060.0x141c]\n"
~"[New thread 6060.0x17ec]\n"
8*stopped,reason="breakpoint-hit",bkptno="1",thread-id="1 ",frame={addr="0x004025
7c",func="main",args=[],file="../main.cpp",fullname="/cygdrive/f/Ultamation/soft
ware/Eclipse/ControlPoint/main.cpp",line="80"}
(gdb)

If I type continue here, gdb resumes and the whole thing runs as expected. Now I'm more confused than ever! Smile

Edit: I should point out, there was a breakpoint defined just before step 7, with address 0x004025, and I had to "continue" twice to resume properly.

[Updated on: Tue, 16 March 2010 16:13]

Report message to a moderator

Re: GDB crashing when started from CDT [message #521201 is a reply to message #521170] Tue, 16 March 2010 17:46 Go to previous messageGo to next message
Marc Khouzam is currently offline Marc KhouzamFriend
Messages: 285
Registered: July 2009
Senior Member

This could be caused by https://bugs.eclipse.org/bugs/show_bug.cgi?id=304754

If you are able to try this with 3.6M6 and CDT 7.0M6, you may have better luck.

Another option if you need to stay with CDT 6.0, is to use the "Standard" debugging integration, but selecting the hyperlink at the bottom of the launch tabs. That would be CDI-GDB, and it does not have the problem that was fixed in bug 304754

(and just to be really sure, I would remove that extra breakpoint on main and try again... just in case)
icon6.gif  Re: GDB crashing when started from CDT [message #521203 is a reply to message #521201] Tue, 16 March 2010 17:50 Go to previous messageGo to next message
Oliver Hall is currently offline Oliver HallFriend
Messages: 6
Registered: March 2010
Junior Member
Thanks for all the help Marc - I'll try the various things out and report back!

Edit: I've tried using the standad gdb integration and this fails in the same place (though I've lost the gdb trace output too) - so I guess I can't be sure.

Is there any way to rebuild the Eclipse project settings etc. in case there's somehing up there?

I might try creating a new project and gradually migrate things across...

[Updated on: Tue, 16 March 2010 18:02]

Report message to a moderator

Re: GDB crashing when started from CDT [message #521219 is a reply to message #521203] Tue, 16 March 2010 18:37 Go to previous messageGo to next message
Oliver Hall is currently offline Oliver HallFriend
Messages: 6
Registered: March 2010
Junior Member
This is nuts... but I think I've found a hint at the cause.

I created a new, empty, project within the same directory structure as the problematic one. I copied each of the source files over and hit debug - same behaviour as before (i.e. crash).

Then I did the same thing (copied the source files) over to the test "Hello World" project I'd previously created - removed the original main source file and - it works!

The only significant difference is the path:
/cygdrive/c/Tools/Test: this one works
/cygdrive/f/Ultamation/software/Eclipse/ControlPoint: broken

Surely GDB should be able to cope with a longer path??

I've just created a new Hello World project under the longer path and once again, it fails to work. Drive F: is a standard partition on my machine - no network mounts etc.

Very bizarre...
Re: GDB crashing when started from CDT [message #531728 is a reply to message #521054] Wed, 05 May 2010 23:02 Go to previous message
David Komanek is currently offline David KomanekFriend
Messages: 2
Registered: July 2009
Junior Member
Yeah, I can confirm this. It depends on the position of the project's directory in the filesystem, probably on the lenght of the path to it. I just filled a bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=311807 with reference to your post here

David
Previous Topic:Importing XCode C/C++ projects into CDT?
Next Topic:managed make - excluding some source
Goto Forum:
  


Current Time: Sun Dec 21 17:24:49 GMT 2014

Powered by FUDForum. Page generated in 0.06408 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software