Skip to main content



      Home
Home » Language IDEs » C / C++ IDE (CDT) » CDT's gdbserver feature fails where gdb does not
CDT's gdbserver feature fails where gdb does not [message #212886] Thu, 27 March 2008 14:43
Eclipse UserFriend
Hello,
From browsing FAQs, lists and bugs and looking at the UI, it seems
that with CDT 4.0.0.20080225 I should be able to debug remotely via
gdb/gdbserver. Independent of Eclipse, I am able to remote debug using
only gdb/gdbserver just fine (see section on what works fine for me
below).

But when I create a debug configuration for my C++ application (under
C/C++ Local Application under Open Debug Dialog...) I have the option to
choose "gdbserver Debugger" on the Debugger tab and I have tried almost
every combination of inputs and debugging does not launch successfully.
I actually see Eclipse/gdb connect successfully to gdbserver on my
remote system, but it looks like Eclipse/gdb always results in the
debugger not loading symbols and termination with a segfault. I suspect
that Eclipse is causing gdb to run my app locally (which will segfault)
although I'm not sure.

Help. Does this feature work? Has anybody been able to use this feature?
Am I doing something wrong? I have CDT version 4.0.0.20080225.

Thanks,
Castedo

Here is what works perfectly well when I'm not running gdb from Eclipse,
and just running gdb/gdbserver directly and manually (note, my work subdir
is mirrored to both my local and remote machines:

castedo@lynch:~$ ssh -L 4907:soros:4907 soros
castedo@soros:~> gdbserver :4907 work/advisor/slopt/src/slae
Process work/advisor/slopt/src/slae created; pid = 15892

Then from another xterm:

castedo@lynch:~$ gdb
GNU gdb 6.4.90-debian
...
This GDB was configured as "i486-linux-gnu".

(gdb) target remote localhost:4907
Remote debugging using localhost:4907
0x40001300 in ?? ()
(gdb) symbol work/advisor/slopt/src/slae
Reading symbols from /home/castedo/work/advisor/slopt/src/slae...done.
(gdb) break optim
Breakpoint 1 at 0x80664fd: file smartleaf.c, line 574.
(gdb) c
Continuing.
Breakpoint 1, optim (context=@0xbfffeb40, me=0x8312570, request=0x0)
at smartleaf.c:574
574 struct smartleaf *down = (struct smartleaf *)me;
(gdb) list
569 * recommendation and override it as deemed appropriate.
570 * We adjust the request on the way in and unadjust the
571 * portfolio on the way out.
572 */
573 {
574 struct smartleaf *down = (struct smartleaf *)me;
575
576 /* Instantiate a transition object, which is a factory
577 * object of acct_analytics.
578 */
(gdb) c
Continuing.

Program exited normally.
(gdb)

You can see my application runs normally, I am able to load symbols
(from the executable called slae) and see source because my source code
and executable are mirrored between my remote file system and local file
sytem (but the executable must run on the remote system).

Here's the verbose debug console spew I get when I run the debugger
under Eclipse with approprite gdbserver settings. No symbols are loaded
(even though I pointed the debug configuration to the value executable
(mirrored on local file system). And the application seg faults which is
odd because it does not do that when I'm not using Eclipse.
Interestingly, gdbserver on the remote machine reports that a connection
is made, but my application never seems to get run on the remote system.

&"info threads\n"
~" 1 thread 16056 0x40001300 in ?? ()\n"
&"warning: Couldn't restore frame in current thread, at frame 0\n"
~"0x40001300 in ?? ()\n"
272^done
273-data-list-register-names
(gdb)
273^done,register-names=["eax","ecx","edx","ebx","esp ","ebp","esi","edi","eip","eflags","cs","ss","ds ","es","fs","gs","st0","st1","st2","st3","st4 ","st5","st6","st7","fctrl","fstat","ftag","fiseg ","fioff","foseg","fooff","fop","xmm0","xmm1","xmm2 ","xmm3","xmm4","xmm5","xmm6","xmm7","mxcsr","orig_eax ","mm0","mm1","mm2","mm3","mm4","mm5","mm6","mm7 "]
(gdb)
274-stack-info-depth
274^done,depth="1"
275-stack-list-frames 0 1
(gdb)
275^done,stack=[frame={level="0",addr="0x40001300",func= "??"}]
(gdb)
276-break-insert slae:optim
&"No source file named slae.\n"
No source file named slae.
276^done
(gdb)
277-break-insert -t main
277^done,bkpt={number="1",type="breakpoint",disp="del",enabled= "y",addr="0x08051552",func="main",file="main.cc",fullname= "/home/castedo/work/advisor/slopt/src/main.cc",line="568",times= "0"}
278-exec-continue
(gdb)
278^running
279-stack-list-arguments 0 0 0
(gdb)
278*stopped,reason="signal-received",signal-name="SIGSEGV ",signal-meaning="Segmentation
fault",thread-id="0",frame={addr="0x4000cb2d",func="?? ",args=[]}
(gdb)
279^done,stack-args=[frame={level="0",args=[]}]
280-stack-list-locals 0
(gdb)
280^done,locals=[]
281 info threads
(gdb)
&"info threads\n"
~" 1 thread 16056 0x4000cb2d in ?? ()\n"
281^done
282-thread-select 1
(gdb)
282^done,new-thread-id="1",frame={level="0",addr="0x4000cb2d ",func="??",args=[]}
283-stack-info-depth
(gdb)
283^done,depth="3"
284-stack-info-depth
(gdb)
284^done,depth="3"
285-stack-list-frames 0 3
(gdb)
285^done,stack=[frame={level="0",addr="0x4000cb2d",func= "??"},frame={level="1",addr="0xbffff11c",func="??"},frame={level= "2",addr="0x00000000",func="??"}]
286-data-list-changed-registers
(gdb)
286^done,changed-registers=["0","1","2","3","4","5 ","6","7","8","9","10","11","12","13","24", "26","40","41"]
287 info sharedlibrary
(gdb)
&"info sharedlibrary\n"
~"No shared libraries loaded at this time.\n"
287^done
288 info signal SIGSEGV
(gdb)
&"info signal SIGSEGV\n"
~"Signal Stop\tPrint\tPass to program\tDescription\n"
~"SIGSEGV Yes\tYes\tYes\t\tSegmentation fault\n"
288^done
(gdb)
289-data-disassemble -s 0x40001300 -e 0x40001364 -- 0
289^done,asm_insns=[{address="0x40001300",inst="push %
esp"},{address="0x40001301",inst="call
0x40001690"},{address="0x40001306",inst="pop %
ebx"},{address="0x40001307",inst="mov %eax,%
edi"},{address="0x40001309",inst="call
0x400012f0"},{address="0x4000130e",inst="add $0x11dde,%
ebx"},{address="0x40001314",inst="mov 0x8c(%ebx),%
eax"},{address="0x4000131a",inst="mov %esp,(%
eax)"},{address="0x4000131c",inst="mov 0xdc(%ebx),%
eax"},{address="0x40001322",inst="mov (%eax),%
eax"},{address="0x40001324",inst="pop %
edx"},{address="0x40001325",inst="lea (%esp,%eax,4),%
esp"},{address="0x40001328",inst="sub %eax,%
edx"},{address="0x4000132a",inst="push %
edx"},{address="0x4000132b",inst="mov 0x15c(%ebx),%
esi"},{address="0x40001331",inst="lea 0x8(%esp,%edx,4),%
eax"},{address="0x40001335",inst="lea 0x4(%esp),%
ecx"},{address="0x40001339",inst="push %
eax"},{address="0x4000133a",inst="mov (%esi),%
eax"},{address="0x4000133c",inst="call
0x40001188"},{address="0x40001341",inst="mov 0xb0(%ebx),%
edx"},{address="0x40001347",inst="jmp *%
edi"},{address="0x40001349",inst="lea 0x0(%esi),%
esi"},{address="0x40001350",inst="push %
ebp"},{address="0x40001351",inst="mov %esp,%
ebp"},{address="0x40001353",inst="push %
edi"},{address="0x40001354",inst="push %
esi"},{address="0x40001355",inst="push %
ebx"},{address="0x40001356",inst="sub $0x1c,%
esp"},{address="0x40001359",inst="call
0x40003e08"},{address="0x4000135e",inst="add $0x11d8e,%ebx"}]
(gdb)
290-data-disassemble -s 0x4000cb2d -e 0x4000cb91 -- 0
290^done,asm_insns=[{address="0x4000cb2d",inst="add %al,(%
eax)"},{address="0x4000cb2f",inst="add %al,0xffffff8d(%
esi)"},{address="0x4000cb32",inst="add $0x92,%
al"},{address="0x4000cb34",inst="movzbl (%esi),%
ecx"},{address="0x4000cb37",inst="movsbl 0xfffffdf3(%ebp),%
edx"},{address="0x4000cb3e",inst="mov %cl,0xfffffdf3(%
ebp)"},{address="0x4000cb44",inst="lea 0xffffffd0(%edx,%eax,2),%
edx"},{address="0x4000cb48",inst="mov %cl,%
al"},{address="0x4000cb4a",inst="sub $0x30,%
al"},{address="0x4000cb4c",inst="cmp $0x9,%
al"},{address="0x4000cb4e",inst="jbe
0x4000cb30"},{address="0x4000cb50",inst="incl 0xfffffdf4(%
ebp)"},{address="0x4000cb56",inst="shl $0x8,%
edi"},{address="0x4000cb59",inst="or %edx,%
edi"},{address="0x4000cb5b",inst="inc %
esi"},{address="0x4000cb5c",inst="cmp $0x2e,%
cl"},{address="0x4000cb5f",inst="jne
0x4000cb6c"},{address="0x4000cb61",inst="movzbl (%esi),%
edx"},{address="0x4000cb64",inst="mov %dl,%
al"},{address="0x4000cb66",inst="sub $0x30,%
al"},{address="0x4000cb68",inst="cmp $0x9,%
al"},{address="0x4000cb6a",inst="jbe
0x4000cb10"},{address="0x4000cb6c",inst="cmpl $0x2,0xfffffdf4(%
ebp)"},{address="0x4000cb73",inst="jg
0x4000cb87"},{address="0x4000cb75",inst="mov 0xfffffdf4(%ebp),%
esi"},{address="0x4000cb7b",inst="mov $0x3,%
ecx"},{address="0x4000cb80",inst="sub %esi,%
ecx"},{address="0x4000cb82",inst="shl $0x3,%
ecx"},{address="0x4000cb85",inst="shl %cl,%
edi"},{address="0x4000cb87",inst="cmp $0x20204,%
edi"},{address="0x4000cb8d",inst="jbe 0x4000cc92"}]
(gdb)
Previous Topic:Convert to autotools project fails
Next Topic:how do I "Find All"?
Goto Forum:
  


Current Time: Fri Jul 18 10:41:28 EDT 2025

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

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

Back to the top