Bug 86676 - CDT ghosts resume/step when stack-info-depth fails
Summary: CDT ghosts resume/step when stack-info-depth fails
Status: RESOLVED FIXED
Alias: None
Product: CDT
Classification: Tools
Component: cdt-debug (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 5.0 M7   Edit
Assignee: Anton Leherbauer CLA
QA Contact:
URL:
Whiteboard:
Keywords: contributed
: 92574 (view as bug list)
Depends on:
Blocks:
 
Reported: 2005-02-25 14:04 EST by Oyvind Harboe CLA
Modified: 2008-06-22 03:52 EDT (History)
2 users (show)

See Also:


Attachments
"Step" should also be available as well as "Resume" (274.99 KB, image/jpeg)
2005-02-25 14:08 EST, Oyvind Harboe CLA
no flags Details
Patch to return a default stack size in case of an error while getting "stack-info-depth" (494 bytes, patch)
2007-10-14 09:28 EDT, Alexander Wunschik CLA
bjorn.freeman-benson: iplog+
Details | Diff
Putting the stack frame problem to rest (1.62 KB, patch)
2008-04-01 01:46 EDT, Oyvind Harboe CLA
no flags Details | Diff
Put finally clause back in (1.64 KB, patch)
2008-04-01 03:36 EDT, Oyvind Harboe CLA
bjorn.freeman-benson: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Oyvind Harboe CLA 2005-02-25 14:04:32 EST
It is normal under certain weirdo stack configurations when debugging embedded
interrupts and such that GDB fails to be able to single step.

The solution is to use "resume" or "step" until the app has left the screwed up
stack state.

Even if CDT fails to run "stack-info-depth", "Resume" and "Step" should still be
available as valid choice.

Øyvind
Comment 1 Oyvind Harboe CLA 2005-02-25 14:08:50 EST
Created attachment 18318 [details]
"Step" should also be available as well as "Resume"

It would be best to let GDB decide whether or not it can "step" in this case.
Comment 2 Nobody - feel free to take it CLA 2005-05-06 18:28:29 EDT
*** Bug 92574 has been marked as a duplicate of this bug. ***
Comment 3 Nobody - feel free to take it CLA 2005-07-21 13:56:30 EDT
Deferred.
Comment 4 Nobody - feel free to take it CLA 2005-09-09 15:27:15 EDT
Reassigning to the pool.
Comment 5 Doug Schaefer CLA 2007-08-21 11:05:26 EDT
Future means you commit to fix it in the Future. Inboxes can't make committments. Moving to '--'.
Comment 6 Alexander Wunschik CLA 2007-10-14 09:28:20 EDT
Created attachment 80316 [details]
Patch to return a default stack size in case of an error while getting "stack-info-depth"

In some circumstances the stack size can't be read. In this case eclipse can't continue debugging.
If we return a default stack size of 1, eclipse is still working perfectly.
We use this fix at SIEMENS and it's working fine.

Greedings, 
Alexander Wunschik, SIEMENS AG
Comment 7 Oyvind Harboe CLA 2007-11-14 15:11:50 EST
(In reply to comment #6)
> Created an attachment (id=80316) [details]
> Patch to return a default stack size in case of an error while getting
> "stack-info-depth"
> 
> In some circumstances the stack size can't be read. In this case eclipse can't
> continue debugging.
> If we return a default stack size of 1, eclipse is still working perfectly.
> We use this fix at SIEMENS and it's working fine.
> 
> Greedings, 
> Alexander Wunschik, SIEMENS AG


Thanks!!!!!! Any reason why this isn't applied?

 

Comment 8 Pawel Piech CLA 2007-11-14 15:17:05 EST
What does -stack-list-frames in this situation?
Comment 9 Oyvind Harboe CLA 2007-11-14 15:27:08 EST
(In reply to comment #8)
> What does -stack-list-frames in this situation?
> 

2332-stack-list-locals 0
Cannot access memory at address 0xdeadbeeb
2332^done,locals=[name="p2",name="start",name="end",name="p",name="len"]
Comment 10 Oyvind Harboe CLA 2007-11-14 15:36:14 EST
(In reply to comment #8)
> What does -stack-list-frames in this situation?

Good thing you asked.

How does CDT interpret such out of band messages? As an error message?
Comment 11 Oyvind Harboe CLA 2007-12-05 05:22:24 EST
Note that "info stack" works even if "stack-list-frames" fails.


(gdb) 
148-stack-list-frames
&"Cannot access memory at address 0xdeadbeeb\n"
148^error,msg="Cannot access memory at address 0xdeadbeeb"
(gdb) 
Cannot access memory at address 0xdeadbeeb
info stack
149-interpreter-exec console "info stack"
~"#0  zylinjtag_Jim_Command_poke (interp=0x341b0, argc=3, argv=0x23fb294) at /cygdrive/c/workspace/ecosboard/ecosboard/phi/openocd/rep/src/zylinjtag.c:854\n"
#0  zylinjtag_Jim_Command_poke (interp=0x341b0, argc=3, argv=0x23fb294) at /cygdrive/c/workspace/ecosboard/ecosboard/phi/openocd/rep/src/zylinjtag.c:854
~"#1  0x0210312c in Jim_EvalObj (interp=0x341b0, scriptObjPtr=0x3d210) at /tmp/ecosboard/packages/net/athttpd/current/src/jim.c:8270\n"
#1  0x0210312c in Jim_EvalObj (interp=0x341b0, scriptObjPtr=0x3d210) at /tmp/ecosboard/packages/net/athttpd/current/src/jim.c:8270
~"#2  0x02105270 in Jim_EvalFile (interp=0x341b0, filename=0x3b288 \"/ram/cgi/index.tcl\") at /tmp/ecosboard/packages/net/athttpd/current/src/jim.c:8495\n"
#2  0x02105270 in Jim_EvalFile (interp=0x341b0, filename=0x3b288 "/ram/cgi/index.tcl") at /tmp/ecosboard/packages/net/athttpd/current/src/jim.c:8495
~"#3  0x021176d4 in Jim_SourceCoreCommand (interp=0x341b0, argc=3, argv=0x23fb1fc) at /tmp/ecosboard/packages/net/athttpd/current/src/jim.c:11455\n"
#3  0x021176d4 in Jim_SourceCoreCommand (interp=0x341b0, argc=3, argv=0x23fb1fc) at /tmp/ecosboard/packages/net/athttpd/current/src/jim.c:11455
~"#4  0x0210312c in Jim_EvalObj (interp=0x341b0, scriptObjPtr=0x34350) at /tmp/ecosboard/packages/net/athttpd/current/src/jim.c:8270\n"
#4  0x0210312c in Jim_EvalObj (interp=0x341b0, scriptObjPtr=0x34350) at /tmp/ecosboard/packages/net/athttpd/current/src/jim.c:8270
~"#5  0x02105860 in Jim_Eval (interp=0x341b0, script=0x3 \"\\336\\030\\360\\237\\345\\030\\360\\237\\345\\030\\360\\237\\345\\030\\360\\237\\345\") at /tmp/ecosboard/packages/net/athttpd/current/src/jim.c:8418\n"
#5  0x02105860 in Jim_Eval (interp=0x341b0, script=0x3 "\336\030\360\237\345\030\360\237\345\030\360\237\345\030\360\237\345") at /tmp/ecosboard/packages/net/athttpd/current/src/jim.c:8418
~"#6  0x020f417c in cyg_httpd_exec_cgi () at /tmp/ecosboard/packages/net/athttpd/current/src/cgi.c:267\n"
#6  0x020f417c in cyg_httpd_exec_cgi () at /tmp/ecosboard/packages/net/athttpd/current/src/cgi.c:267
~"#7  0x02133528 in cyg_httpd_process_method () at /tmp/ecosboard/packages/net/athttpd/current/src/http.c:718\n"
#7  0x02133528 in cyg_httpd_process_method () at /tmp/ecosboard/packages/net/athttpd/current/src/http.c:718
~"#8  0x020f2d84 in cyg_httpd_daemon (data=213424) at /tmp/ecosboard/packages/net/athttpd/current/src/socket.c:268\n"
#8  0x020f2d84 in cyg_httpd_daemon (data=213424) at /tmp/ecosboard/packages/net/athttpd/current/src/socket.c:268
~"#9  0x00006c94 in Cyg_HardwareThread::thread_entry (thread=0x23fa11c) at /tmp/ecosboard/packages/kernel/current/src/common/thread.cxx:95\n"
#9  0x00006c94 in Cyg_HardwareThread::thread_entry (thread=0x23fa11c) at /tmp/ecosboard/packages/kernel/current/src/common/thread.cxx:95
~"#10 0x00006c60 in Cyg_Thread::exit () at /ecos-c/cygwin/tmp/ecosboard/ecos/install/include/cyg/kernel/sched.hxx:397\n"
#10 0x00006c60 in Cyg_Thread::exit () at /ecos-c/cygwin/tmp/ecosboard/ecos/install/include/cyg/kernel/sched.hxx:397
&"Cannot access memory at address 0xdeadbeeb\n"
149^done
Cannot access memory at address 0xdeadbeeb
(gdb) 
Comment 12 Oyvind Harboe CLA 2007-12-31 03:54:36 EST
This apparently is a bug in GDB that has been fixed.

http://sourceware.org/ml/gdb-patches/2006-08/msg00166.html

I'm going to test w/GDB from CVS HEAD...
Comment 13 Oyvind Harboe CLA 2007-12-31 06:19:25 EST
The problem still exists in GDB CVS HEAD: 6.7.50.20071227-cvs





663-gdb-set confirm off
663^done
664-gdb-set width 0
(gdb) 
664^done
(gdb) 
665-gdb-set height 0
665^done
(gdb) 
666-interpreter-exec console echo
666^done
667-gdb-show prompt
(gdb) 
(gdb) 
669 info threads
&"info threads\n"
&"No registers.\n"
669^error,msg="No registers."
(gdb) 
670-data-list-register-names
670^done,register-names=["r0","r1","r2","r3","r4","r5","r6","r7","r8","r9","r10","r11","r12","sp","lr","pc","f0","f1","f2","f3","f4","f5","f6","f7","fps","cpsr","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""]
(gdb) 
671-break-insert cyg_assert_fail
&"Function \"cyg_assert_fail\" not defined.\n"
671^error,msg="unknown error"
(gdb) 
672-break-insert _memcpy
Function "cyg_assert_fail" not defined.
672^done,bkpt={number="1",type="breakpoint",disp="keep",enabled="y",addr="0x0001e440",func="_memcpy",file="/tmp/ecosboard/packages/infra/current/src/memcpy.c",fullname="/tmp/ecosboard/packages/infra/current/src/memcpy.c",line="94",times="0"}
(gdb) 
673-break-disable 1
673^done,bkpt={number="1",type="breakpoint",disp="keep",enabled="n",addr="0x0001e440",func="_memcpy",file="/tmp/ecosboard/packages/infra/current/src/memcpy.c",fullname="/tmp/ecosboard/packages/infra/current/src/memcpy.c",line="94",times="0"}
(gdb) 
674-break-insert main
674^done,bkpt={number="2",type="breakpoint",disp="keep",enabled="y",addr="0x0202db98",func="main",file="/cygdrive/c/workspace/ecosboard/ecosboard/phi/openocd/rep/src/zylinjtag.c",fullname="/cygdrive/c/workspace/ecosboard/ecosboard/phi/openocd/rep/src/zylinjtag.c",line="1271",times="0"}
(gdb) 
675-break-insert malloc
675^done,bkpt={number="3",type="breakpoint",disp="keep",enabled="y",addr="0x020bbf00",func="malloc",file="/ecos-c/cygwin/tmp/ecosboard/ecos/install/include/cyg/hal/fastmem.inl",fullname="/ecos-c/cygwin/tmp/ecosboard/ecos/install/include/cyg/hal/fastmem.inl",line="175",times="0"}
(gdb) 
676-break-disable 3
676^done,bkpt={number="3",type="breakpoint",disp="keep",enabled="n",addr="0x020bbf00",func="malloc",file="/ecos-c/cygwin/tmp/ecosboard/ecos/install/include/cyg/hal/fastmem.inl",fullname="/ecos-c/cygwin/tmp/ecosboard/ecos/install/include/cyg/hal/fastmem.inl",line="175",times="0"}
677-break-insert tftp_client.c:0
(gdb) 
&"No line 0 in file \"/tmp/ecosboard/packages/net/common/current/src/tftp_client.c\".\n"
677^error,msg="No line 0 in file \"/tmp/ecosboard/packages/net/common/current/src/tftp_client.c\"."
(gdb) 
No line 0 in file "/tmp/ecosboard/packages/net/common/current/src/tftp_client.c".
678-break-insert _memset
678^done,bkpt={number="4",type="breakpoint",disp="keep",enabled="y",addr="0x00011410",func="_memset",file="/tmp/ecosboard/packages/infra/current/src/memset.c",fullname="/tmp/ecosboard/packages/infra/current/src/memset.c",line="85",times="0"}
(gdb) 
679-break-disable 4
679^done,bkpt={number="4",type="breakpoint",disp="keep",enabled="n",addr="0x00011410",func="_memset",file="/tmp/ecosboard/packages/infra/current/src/memset.c",fullname="/tmp/ecosboard/packages/infra/current/src/memset.c",line="85",times="0"}
(gdb) 
680 show version
&"show version\n"
~"GNU gdb 6.7.50.20071227-cvs\n"
GNU gdb 6.7.50.20071227-cvs
~"Copyright (C) 2007 Free Software Foundation, Inc.\n"
Copyright (C) 2007 Free Software Foundation, Inc.
show version
~"License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>\nThis is free software: you are free to change and redistribute it.\nThere is NO WARRANTY, to the extent permitted by law.  Type \"show copying\"\nand \"show warranty\" for details.\n"
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 \"--host=i686-pc-cygwin --target=arm-elf\".\n"
This GDB was configured as "--host=i686-pc-cygwin --target=arm-elf".
680^done
(gdb) 
681 set remotetimeout 100
&"set remotetimeout 100\n"
681^done
(gdb) 
set remotetimeout 100
682 set remote memory-write-packet-size fixed
&"set remote memory-write-packet-size fixed\n"
set remote memory-write-packet-size fixed
682^done
(gdb) 
683 set remote memory-write-packet-size 8192
&"set remote memory-write-packet-size 8192\n"
set remote memory-write-packet-size 8192
683^done
(gdb) 
684 target remote 10.0.0.66:3333
&"target remote 10.0.0.66:3333\n"
target remote 10.0.0.66:3333
~"0x00000018 in ?? ()\n"
0x00000018 in ?? ()
684^done
(gdb) 
685 monitor reg cpsr 0x000000D3
&"monitor reg cpsr 0x000000D3\n"
monitor reg cpsr 0x000000D3
@"cpsr (/32): 0x000000d3\n"
cpsr (/32): 0x000000d3
685^done
(gdb) 
686 monitor mww 0xFFE00000 0x0100273D
&"monitor mww 0xFFE00000 0x0100273D\n"
monitor mww 0xFFE00000 0x0100273D
686^done
(gdb) 
687 monitor mww 0xFFE00004 0x08002125
&"monitor mww 0xFFE00004 0x08002125\n"
monitor mww 0xFFE00004 0x08002125
687^done
(gdb) 
688 monitor mww 0xFFEe0008 0x02002125
&"monitor mww 0xFFEe0008 0x02002125\n"
monitor mww 0xFFEe0008 0x02002125
688^done
(gdb) 
689 monitor mww 0xFFE0000c 0x03002125
&"monitor mww 0xFFE0000c 0x03002125\n"
monitor mww 0xFFE0000c 0x03002125
689^done
(gdb) 
690 monitor mww 0xFFE00010 0x40000000
&"monitor mww 0xFFE00010 0x40000000\n"
monitor mww 0xFFE00010 0x40000000
690^done
(gdb) 
691 monitor mww 0xFFE00014 0x50000000
monitor mww 0xFFE00014 0x50000000
&"monitor mww 0xFFE00014 0x50000000\n"
691^done
(gdb) 
692 monitor mww 0xFFE00018 0x60000000
&"monitor mww 0xFFE00018 0x60000000\n"
monitor mww 0xFFE00018 0x60000000
692^done
(gdb) 
693 monitor mww 0xFFE0001c 0x70000000
monitor mww 0xFFE0001c 0x70000000
&"monitor mww 0xFFE0001c 0x70000000\n"
693^done
(gdb) 
694 monitor mww 0xFFE00020 0x00000001
monitor mww 0xFFE00020 0x00000001
&"monitor mww 0xFFE00020 0x00000001\n"
694^done
(gdb) 
695 monitor mww 0xFFE00024 0x00000000
&"monitor mww 0xFFE00024 0x00000000\n"
monitor mww 0xFFE00024 0x00000000
695^done
(gdb) 
696 monitor mww 0xFFFFF124 0xFFFFFFFF
&"monitor mww 0xFFFFF124 0xFFFFFFFF\n"
monitor mww 0xFFFFF124 0xFFFFFFFF
696^done
(gdb) 
697 monitor mww 0 0xdeadbabe
&"monitor mww 0 0xdeadbabe\n"
monitor mww 0 0xdeadbabe
697^done
(gdb) 
698 monitor mdw 0
&"monitor mdw 0\n"
monitor mdw 0
@"0x00000000: deadbabe \n"
0x00000000: deadbabe 
698^done
(gdb) 
699 monitor mdw 0x1000000
monitor mdw 0x1000000
&"monitor mdw 0x1000000\n"
@"0x01000000: ea00000e \n"
0x01000000: ea00000e 
699^done
(gdb) 
700 load
&"load\n"
load
~"Loading section .rom_vectors, size 0x40 lma 0x2000000\n"
Loading section .rom_vectors, size 0x40 lma 0x2000000
678+download,{section=".rom_vectors",section-size="64",total-size="7384881"}
~"Loading section .fastdata, size 0x2a860 lma 0x2000040\n"
Loading section .fastdata, size 0x2a860 lma 0x2000040
678+download,{section=".fastdata",section-size="174176",total-size="7384881"}
678+download,{section=".fastdata",section-sent="40720",section-size="174176",total-sent="40784",total-size="7384881"}
678+download,{section=".fastdata",section-sent="81424",section-size="174176",total-sent="81488",total-size="7384881"}
678+download,{section=".fastdata",section-sent="122048",section-size="174176",total-sent="122112",total-size="7384881"}
678+download,{section=".fastdata",section-sent="162736",section-size="174176",total-sent="162800",total-size="7384881"}
~"Loading section .text, size 0x1177a4 lma 0x202a8a0\n"
Loading section .text, size 0x1177a4 lma 0x202a8a0
678+download,{section=".text",section-size="1144740",total-size="7384881"}
678+download,{section=".text",section-sent="24336",section-size="1144740",total-sent="198576",total-size="7384881"}
678+download,{section=".text",section-sent="64736",section-size="1144740",total-sent="238976",total-size="7384881"}
678+download,{section=".text",section-sent="105312",section-size="1144740",total-sent="279552",total-size="7384881"}
678+download,{section=".text",section-sent="145808",section-size="1144740",total-sent="320048",total-size="7384881"}
678+download,{section=".text",section-sent="186368",section-size="1144740",total-sent="360608",total-size="7384881"}
678+download,{section=".text",section-sent="226912",section-size="1144740",total-sent="401152",total-size="7384881"}
678+download,{section=".text",section-sent="267488",section-size="1144740",total-sent="441728",total-size="7384881"}
678+download,{section=".text",section-sent="307936",section-size="1144740",total-sent="482176",total-size="7384881"}
678+download,{section=".text",section-sent="348320",section-size="1144740",total-sent="522560",total-size="7384881"}
678+download,{section=".text",section-sent="388832",section-size="1144740",total-sent="563072",total-size="7384881"}
678+download,{section=".text",section-sent="429360",section-size="1144740",total-sent="603600",total-size="7384881"}
678+download,{section=".text",section-sent="469824",section-size="1144740",total-sent="644064",total-size="7384881"}
678+download,{section=".text",section-sent="510352",section-size="1144740",total-sent="684592",total-size="7384881"}
678+download,{section=".text",section-sent="550944",section-size="1144740",total-sent="725184",total-size="7384881"}
678+download,{section=".text",section-sent="591664",section-size="1144740",total-sent="765904",total-size="7384881"}
678+download,{section=".text",section-sent="632368",section-size="1144740",total-sent="806608",total-size="7384881"}
678+download,{section=".text",section-sent="673088",section-size="1144740",total-sent="847328",total-size="7384881"}
678+download,{section=".text",section-sent="713824",section-size="1144740",total-sent="888064",total-size="7384881"}
678+download,{section=".text",section-sent="754512",section-size="1144740",total-sent="928752",total-size="7384881"}
678+download,{section=".text",section-sent="795200",section-size="1144740",total-sent="969440",total-size="7384881"}
678+download,{section=".text",section-sent="835920",section-size="1144740",total-sent="1010160",total-size="7384881"}
678+download,{section=".text",section-sent="876608",section-size="1144740",total-sent="1050848",total-size="7384881"}
678+download,{section=".text",section-sent="917312",section-size="1144740",total-sent="1091552",total-size="7384881"}
678+download,{section=".text",section-sent="957984",section-size="1144740",total-sent="1132224",total-size="7384881"}
678+download,{section=".text",section-sent="998736",section-size="1144740",total-sent="1172976",total-size="7384881"}
678+download,{section=".text",section-sent="1039440",section-size="1144740",total-sent="1213680",total-size="7384881"}
678+download,{section=".text",section-sent="1080128",section-size="1144740",total-sent="1254368",total-size="7384881"}
678+download,{section=".text",section-sent="1120800",section-size="1144740",total-sent="1295040",total-size="7384881"}
~"Loading section .rodata, size 0x32c34 lma 0x2142044\n"
Loading section .rodata, size 0x32c34 lma 0x2142044
678+download,{section=".rodata",section-size="207924",total-size="7384881"}
678+download,{section=".rodata",section-sent="16300",section-size="207924",total-sent="1335280",total-size="7384881"}
678+download,{section=".rodata",section-sent="57004",section-size="207924",total-sent="1375984",total-size="7384881"}
678+download,{section=".rodata",section-sent="97500",section-size="207924",total-sent="1416480",total-size="7384881"}
678+download,{section=".rodata",section-sent="138284",section-size="207924",total-sent="1457264",total-size="7384881"}
678+download,{section=".rodata",section-sent="179084",section-size="207924",total-sent="1498064",total-size="7384881"}
~"Loading section .data, size 0x4e14 lma 0x2174c78\n"
Loading section .data, size 0x4e14 lma 0x2174c78
678+download,{section=".data",section-size="19988",total-size="7384881"}
678+download,{section=".data",section-sent="8136",section-size="19988",total-sent="1535040",total-size="7384881"}
~"Start address 0x202a8a0, load size 1546892\n"
Start address 0x202a8a0, load size 1546892
~"Transfer rate: 69 KB/sec, 8014 bytes/write.\n"
Transfer rate: 69 KB/sec, 8014 bytes/write.
700^done
(gdb) 
monitor reg pc 0x02000000
701 monitor reg pc 0x02000000
&"monitor reg pc 0x02000000\n"
@"pc (/32): 0x02000000\n"
pc (/32): 0x02000000
701^done
(gdb) 
702 monitor arm7_9 force_hw_bkpts disable
monitor arm7_9 force_hw_bkpts disable
&"monitor arm7_9 force_hw_bkpts disable\n"
@"force hardware breakpoints disabled\n"
force hardware breakpoints disabled
702^done
(gdb) 
703 monitor arm7_9 sw_bkpts enable
&"monitor arm7_9 sw_bkpts enable\n"
monitor arm7_9 sw_bkpts enable
@"software breakpoints enabled\n"
software breakpoints enabled
703^done
(gdb) 
704 stepi
stepi
&"stepi\n"
~"0x0202a8a0 in reset_vector ()\n"
0x0202a8a0 in reset_vector ()
704^done
(gdb) 
705 info proc
&"info proc\n"
&"Undefined info command: \"proc\".  Try \"help info\".\n"
705^error,msg="Undefined info command: \"proc\".  Try \"help info\"."
(gdb) 
706 info program
&"info program\n"
~"Debugging a target over a serial line.\n"
~"Program stopped at 0x202a8a0.\n"
~"It stopped after being stepped.\n"
~"Type \"info stack\" or \"info registers\" for more information.\n"
706^done
(gdb) 
707 info threads
&"info threads\n"
&"warning: RMT ERROR : failed to get remote thread list.\n"
707^done
(gdb) 
708-stack-list-frames
708^done,stack=[frame={level="0",addr="0x0202a8a0",func="reset_vector"}]
(gdb) 
709-stack-info-depth
709^done,depth="1"
(gdb) 
710-stack-list-frames 0 1
710^done,stack=[frame={level="0",addr="0x0202a8a0",func="reset_vector"}]
(gdb) 
711-data-list-changed-registers
711^done,changed-registers=["0","1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25"]
(gdb) 
712-stack-list-arguments 0 0 0
712^done,stack-args=[frame={level="0",args=[]}]
(gdb) 
713-stack-list-locals 0
713^done,locals=[name="bit_reverse_table256"]
(gdb) 
714-var-create - * bit_reverse_table256
714^done,name="var1",numchild="256",value="[256]",type="const unsigned char [256]"
(gdb) 
715-var-create - * &(bit_reverse_table256)
715^done,name="var2",numchild="1",value="0x2163530",type="const unsigned char (*)[256]"
(gdb) 
716-var-set-format var2 hexadecimal
716^done,format="hexadecimal"
(gdb) 
717-var-evaluate-expression var2
717^done,value="0x2163530"
(gdb) 
718-exec-continue
718^running
(gdb) 
718*stopped,reason="breakpoint-hit",bkptno="2",thread-id="0",frame={addr="0x0202db98",func="main",args=[{name="argc",value="1"},{name="argv",value="0x23d8c"}],file="/cygdrive/c/workspace/ecosboard/ecosboard/phi/openocd/rep/src/zylinjtag.c",fullname="/cygdrive/c/workspace/ecosboard/ecosboard/phi/openocd/rep/src/zylinjtag.c",line="1271"}
(gdb) 
719 info threads
&"info threads\n"
&"warning: RMT ERROR : failed to get remote thread list.\n"
719^done
(gdb) 
720-stack-info-depth
720^done,depth="1"
(gdb) 
721-stack-list-frames 0 1
721^done,stack=[frame={level="0",addr="0x0202db98",func="main",file="/cygdrive/c/workspace/ecosboard/ecosboard/phi/openocd/rep/src/zylinjtag.c",fullname="/cygdrive/c/workspace/ecosboard/ecosboard/phi/openocd/rep/src/zylinjtag.c",line="1271"}]
(gdb) 
722-var-update var1
722^done,changelist=[]
(gdb) 
723-var-update var2
723^done,changelist=[]
(gdb) 
724-data-list-changed-registers
724^done,changed-registers=["1","2","3","4","5","7","11","12","13","14","15","25"]
(gdb) 
725-stack-list-arguments 0 0 0
725^done,stack-args=[frame={level="0",args=[name="argc",name="argv"]}]
(gdb) 
726-stack-list-locals 0
726^done,locals=[name="cfg_cmd_ctx",name="err",name="address",name="errVal",name="__FUNCTION__",name="retval"]
(gdb) 
727-var-create - * argc
727^done,name="var3",numchild="0",value="1",type="int"
(gdb) 
728-var-evaluate-expression var3
728^done,value="1"
729-var-create - * argv
(gdb) 
729^done,name="var4",numchild="1",value="0x23d8c",type="char **"
(gdb) 
730-var-create - * cfg_cmd_ctx
731-var-evaluate-expression var4
730^done,name="var5",numchild="6",value="0xdeadbeef",type="command_context_t *"
(gdb) 
731^done,value="0x23d8c"
(gdb) 
732 ptype command_context_t *
&"ptype command_context_t *\n"
~"type = struct command_context_s {\n"
~"    enum command_mode mode;\n"
~"    struct command_s *commands;\n"
~"    int current_target;\n"
~"    int echo;\n"
~"    int (*output_handler)(struct command_context_s *, char *);\n"
~"    void *output_handler_priv;\n"
~"} *\n"
732^done
(gdb) 
733-var-create - * err
734-var-evaluate-expression var5
733^done,name="var6",numchild="0",value="-559038737",type="int"
(gdb) 
734^done,value="0xdeadbeef"
(gdb) 
735-var-create - * address
736-var-evaluate-expression var6
735^done,name="var7",numchild="16",value="[16]",type="char [16]"
(gdb) 
736^done,value="-559038737"
(gdb) 
737-var-create - * &(address)
737^done,name="var8",numchild="1",value="0x23d5c",type="char (*)[16]"
(gdb) 
738-var-set-format var8 hexadecimal
738^done,format="hexadecimal"
(gdb) 
739-var-evaluate-expression var8
739^done,value="0x23d5c"
(gdb) 
740-var-create - * errVal
740^done,name="var9",numchild="0",value="-559038737",type="int"
(gdb) 
741-var-evaluate-expression var9
741^done,value="-559038737"
(gdb) 
742-var-create - * __FUNCTION__
742^done,name="var10",numchild="5",value="[5]",type="const char [5]"
(gdb) 
743-var-create - * &(__FUNCTION__)
743^done,name="var11",numchild="1",value="0x21574d4",type="const char (*)[5]"
(gdb) 
744-var-set-format var11 hexadecimal
744^done,format="hexadecimal"
(gdb) 
745-var-evaluate-expression var11
745^done,value="0x21574d4"
(gdb) 
746-exec-continue
746^running
(gdb) 
~"Current language:  auto; currently c++\n"
Current language:  auto; currently c++
746*stopped,reason="signal-received",signal-name="SIGINT",signal-meaning="Interrupt",thread-id="0",frame={addr="0x020c46e8",func="__strncmp",args=[{name="s1",value="0x2 \"\\255\\336\\030\\360\\237\\345\\030\\360\\237\\345\\030\\360\\237\\345\\030\\360\\237\\345\""},{name="s2",value="0x246fc70 \"script\""},{name="n",value="3"}],file="/tmp/ecosboard/packages/language/c/libc/string/current/src/strncmp.cxx",fullname="/tmp/ecosboard/packages/language/c/libc/string/current/src/strncmp.cxx",line="163"}
(gdb) 
747 info threads
&"info threads\n"
&"warning: RMT ERROR : failed to get remote thread list.\n"
747^done
(gdb) 
748-stack-info-depth
748^done,depth="7"
(gdb) 
749-stack-list-frames 0 7
749^done,stack=[frame={level="0",addr="0x020c46e8",func="__strncmp",file="/tmp/ecosboard/packages/language/c/libc/string/current/src/strncmp.cxx",fullname="/tmp/ecosboard/packages/language/c/libc/string/current/src/strncmp.cxx",line="163"},frame={level="1",addr="0x0207c86c",func="build_unique_lengths",file="/cygdrive/c/workspace/ecosboard/ecosboard/phi/openocd/rep/src/helper/command.c",fullname="/cygdrive/c/workspace/ecosboard/ecosboard/phi/openocd/rep/src/helper/command.c",line="62"},frame={level="2",addr="0x0207cb2c",func="register_command",file="/cygdrive/c/workspace/ecosboard/ecosboard/phi/openocd/rep/src/helper/command.c",fullname="/cygdrive/c/workspace/ecosboard/ecosboard/phi/openocd/rep/src/helper/command.c",line="131"},frame={level="3",addr="0x02032810",func="target_register_user_commands",file="/cygdrive/c/workspace/ecosboard/ecosboard/phi/openocd/rep/src/target/target.c",fullname="/cygdrive/c/workspace/ecosboard/ecosboard/phi/openocd/rep/src/target/target.c",line="927"},frame={level="4",addr="0x02030ab8",func="target_init",file="/cygdrive/c/workspace/ecosboard/ecosboard/phi/openocd/rep/src/target/target.c",fullname="/cygdrive/c/workspace/ecosboard/ecosboard/phi/openocd/rep/src/target/target.c",line="357"},frame={level="5",addr="0x0202aa00",func="launchTarget",file="/cygdrive/c/workspace/ecosboard/ecosboard/phi/openocd/rep/src/zylinjtag.c",fullname="/cygdrive/c/workspace/ecosboard/ecosboard/phi/openocd/rep/src/zylinjtag.c",line="131"},frame={level="6",addr="0x0202e260",func="main",file="/cygdrive/c/workspace/ecosboard/ecosboard/phi/openocd/rep/src/zylinjtag.c",fullname="/cygdrive/c/workspace/ecosboard/ecosboard/phi/openocd/rep/src/zylinjtag.c",line="1410"}]
(gdb) 
750-var-update var1
750^done,changelist=[]
(gdb) 
751-var-update var2
751^done,changelist=[]
(gdb) 
752-data-list-changed-registers
752^done,changed-registers=["0","1","2","3","4","11","12","13","14","15","25"]
(gdb) 
753 info signal SIGINT
&"info signal SIGINT\n"
~"Signal        Stop\tPrint\tPass to program\tDescription\n"
~"SIGINT        Yes\tYes\tNo\t\tInterrupt\n"
753^done
(gdb) 
754-stack-list-arguments 0 0 0
754^done,stack-args=[frame={level="0",args=[name="s1",name="s2",name="n"]}]
(gdb) 
755-stack-list-locals 0
755^done,locals=[name="aligned_s1",name="aligned_s2"]
(gdb) 
756-var-create - * s1
756^done,name="var12",numchild="1",value="0x2 \"\\255\\336\\030\\360\\237\\345\\030\\360\\237\\345\\030\\360\\237\\345\\030\\360\\237\\345\"",type="const char *"
(gdb) 
757-var-evaluate-expression var12
757^done,value="0x2 \"\\255\\336\\030\\360\\237\\345\\030\\360\\237\\345\\030\\360\\237\\345\\030\\360\\237\\345\""
(gdb) 
758-var-create - * s2
758^done,name="var13",numchild="1",value="0x246fc70 \"script\"",type="const char *"
(gdb) 
759-var-create - * n
760-var-evaluate-expression var13
759^done,name="var14",numchild="0",value="3",type="size_t"
(gdb) 
760^done,value="0x246fc70 \"script\""
(gdb) 
761 ptype size_t
&"ptype size_t\n"
~"type = long unsigned int\n"
761^done
(gdb) 
762-var-create - * aligned_s1
763-var-evaluate-expression var14
762^done,name="var15",numchild="1",value="0x246fa80",type="const CYG_WORD *"
(gdb) 
763^done,value="3"
(gdb) 
764 ptype const CYG_WORD *
&"ptype const CYG_WORD *\n"
~"type = unsigned int *\n"
764^done
(gdb) 
765-var-create - * aligned_s2
766-var-evaluate-expression var15
765^done,name="var16",numchild="1",value="0x246fc70",type="const CYG_WORD *"
(gdb) 
766^done,value="0x246fa80"
(gdb) 
767-var-evaluate-expression var16
767^done,value="0x246fc70"
(gdb) 
768-exec-continue
768^running
(gdb) 
768*stopped,reason="signal-received",signal-name="SIGINT",signal-meaning="Interrupt",thread-id="0",frame={addr="0x020c46e0",func="__strncmp",args=[{name="s1",value="0x2 \"\\255\\336\\030\\360\\237\\345\\030\\360\\237\\345\\030\\360\\237\\345\\030\\360\\237\\345\""},{name="s2",value="0x24baa40 \"mdb\""},{name="n",value="3"}],file="/tmp/ecosboard/packages/language/c/libc/string/current/src/strncmp.cxx",fullname="/tmp/ecosboard/packages/language/c/libc/string/current/src/strncmp.cxx",line="151"}
(gdb) 
769 info threads
&"info threads\n"
&"warning: RMT ERROR : failed to get remote thread list.\n"
769^done
(gdb) 
770-stack-info-depth
770^done,depth="6"
(gdb) 
771-stack-list-frames 0 6
771^done,stack=[frame={level="0",addr="0x020c46e0",func="__strncmp",file="/tmp/ecosboard/packages/language/c/libc/string/current/src/strncmp.cxx",fullname="/tmp/ecosboard/packages/language/c/libc/string/current/src/strncmp.cxx",line="151"},frame={level="1",addr="0x0207c86c",func="build_unique_lengths",file="/cygdrive/c/workspace/ecosboard/ecosboard/phi/openocd/rep/src/helper/command.c",fullname="/cygdrive/c/workspace/ecosboard/ecosboard/phi/openocd/rep/src/helper/command.c",line="62"},frame={level="2",addr="0x0207cb2c",func="register_command",file="/cygdrive/c/workspace/ecosboard/ecosboard/phi/openocd/rep/src/helper/command.c",fullname="/cygdrive/c/workspace/ecosboard/ecosboard/phi/openocd/rep/src/helper/command.c",line="131"},frame={level="3",addr="0x02087608",func="ocd_flash_init",file="/cygdrive/c/workspace/ecosboard/ecosboard/phi/openocd/rep/src/flash/flash.c",fullname="/cygdrive/c/workspace/ecosboard/ecosboard/phi/openocd/rep/src/flash/flash.c",line="117"},frame={level="4",addr="0x0202aa54",func="launchTarget",file="/cygdrive/c/workspace/ecosboard/ecosboard/phi/openocd/rep/src/zylinjtag.c",fullname="/cygdrive/c/workspace/ecosboard/ecosboard/phi/openocd/rep/src/zylinjtag.c",line="136"},frame={level="5",addr="0x0202e260",func="main",file="/cygdrive/c/workspace/ecosboard/ecosboard/phi/openocd/rep/src/zylinjtag.c",fullname="/cygdrive/c/workspace/ecosboard/ecosboard/phi/openocd/rep/src/zylinjtag.c",line="1410"}]
(gdb) 
772-var-update var1
772^done,changelist=[]
(gdb) 
773-var-update var2
773^done,changelist=[]
(gdb) 
774-var-update var12
774^done,changelist=[{name="var12",in_scope="false"}]
(gdb) 
775-var-delete var12
775^done,ndeleted="1"
(gdb) 
776-var-update var13
776^done,changelist=[{name="var13",in_scope="false"}]
(gdb) 
777-var-delete var13
777^done,ndeleted="1"
(gdb) 
778-var-update var14
778^done,changelist=[{name="var14",in_scope="false"}]
(gdb) 
779-var-delete var14
779^done,ndeleted="1"
(gdb) 
780-var-update var15
780^done,changelist=[{name="var15",in_scope="false"}]
(gdb) 
781-var-delete var15
781^done,ndeleted="1"
(gdb) 
782-var-update var16
782^done,changelist=[{name="var16",in_scope="false"}]
(gdb) 
783-var-delete var16
783^done,ndeleted="1"
(gdb) 
784-data-list-changed-registers
784^done,changed-registers=["0","1","3","4","11","13","14","15"]
(gdb) 
785-stack-list-arguments 0 0 0
785^done,stack-args=[frame={level="0",args=[name="s1",name="s2",name="n"]}]
(gdb) 
786-stack-list-locals 0
786^done,locals=[name="aligned_s1",name="aligned_s2"]
(gdb) 
787-var-create - * s1
788-exec-continue
787^done,name="var17",numchild="1",value="0x2 \"\\255\\336\\030\\360\\237\\345\\030\\360\\237\\345\\030\\360\\237\\345\\030\\360\\237\\345\"",type="const char *"
(gdb) 
788^running
(gdb) 
788*stopped,reason="signal-received",signal-name="SIGINT",signal-meaning="Interrupt",thread-id="0",frame={addr="0x00000018",func="??",args=[]}
(gdb) 
789 info threads
&"info threads\n"
&"warning: RMT ERROR : failed to get remote thread list.\n"
789^done
(gdb) 
790-stack-info-depth
&"Cannot access memory at address 0xdeadbeeb\n"
790^error,msg="Cannot access memory at address 0xdeadbeeb"
791-stack-info-depth
Cannot access memory at address 0xdeadbeeb
(gdb) 
Cannot access memory at address 0xdeadbeeb
&"Cannot access memory at address 0xdeadbeeb\n"
791^error,msg="Cannot access memory at address 0xdeadbeeb"
(gdb) 
info stack
792-interpreter-exec console "info stack"
~"#0  0x00000018 in ?? ()\n"
#0  0x00000018 in ?? ()
~"#1  0x000088d0 in Cyg_Thread::exit () at /ecos-c/cygwin/tmp/ecosboard/ecos/install/include/cyg/kernel/sched.hxx:397\n"
#1  0x000088d0 in Cyg_Thread::exit () at /ecos-c/cygwin/tmp/ecosboard/ecos/install/include/cyg/kernel/sched.hxx:397
&"Cannot access memory at address 0xdeadbeeb\n"
Cannot access memory at address 0xdeadbeeb
792^done
(gdb) 
Comment 14 Oyvind Harboe CLA 2007-12-31 06:19:56 EST
Here is the culprit: "info stack" works, but "stack-info-depth" fails...


790-stack-info-depth
&"Cannot access memory at address 0xdeadbeeb\n"
790^error,msg="Cannot access memory at address 0xdeadbeeb"
791-stack-info-depth
Cannot access memory at address 0xdeadbeeb
(gdb) 
Cannot access memory at address 0xdeadbeeb
&"Cannot access memory at address 0xdeadbeeb\n"
791^error,msg="Cannot access memory at address 0xdeadbeeb"
(gdb) 
info stack
792-interpreter-exec console "info stack"
~"#0  0x00000018 in ?? ()\n"
#0  0x00000018 in ?? ()
~"#1  0x000088d0 in Cyg_Thread::exit () at /ecos-c/cygwin/tmp/ecosboard/ecos/install/include/cyg/kernel/sched.hxx:397\n"
#1  0x000088d0 in Cyg_Thread::exit () at /ecos-c/cygwin/tmp/ecosboard/ecos/install/include/cyg/kernel/sched.hxx:397
&"Cannot access memory at address 0xdeadbeeb\n"
Cannot access memory at address 0xdeadbeeb
792^done
(gdb) 
Comment 15 Oyvind Harboe CLA 2008-04-01 01:46:13 EDT
Created attachment 94325 [details]
Putting the stack frame problem to rest

GDB has a known bug where it fails to evaluate the stack frame if stack frame evaluation accesses invalid memory(which can *easily* happen w/-O3). This is a known problem with GDB.

The attached patch adds a workaround for Eclipse.

Please apply and close this bug report as "this is now resolved as far as Eclipse can contribute to the problem".
Comment 16 Anton Leherbauer CLA 2008-04-01 03:28:23 EDT
(In reply to comment #15)

Your patch removes the finally clause. Is there a special reason for that?
Comment 17 Oyvind Harboe CLA 2008-04-01 03:35:34 EDT
(In reply to comment #16)
> (In reply to comment #15)
> 
> Your patch removes the finally clause. Is there a special reason for that?

That was unintentional, I'll attach an updated patch.

Actually this fix is no longer needed for my own purposes(I'm using OpenOCD and it has a different way of tackling the workaround), but this covers *other* hardware debuggers and also cases not covered by OpenOCD(that I haven't encountered yet).



Comment 18 Oyvind Harboe CLA 2008-04-01 03:36:03 EDT
Created attachment 94333 [details]
Put finally clause back in
Comment 19 Oyvind Harboe CLA 2008-04-01 03:38:00 EDT
Reproducing this problem/exercising the code path is pretty awkward as it requires a hardware debugger and an embedded target where stack evaluation happens to touch memory that generates a data abort and this data abort has to be propagated by the hardware debugger.

To exercise the code path I recommend modifying the Thread.java code temporarily.
Comment 20 Elena Laskavaia CLA 2008-04-01 09:27:42 EDT
I don't think it is a right fix. What if MIException is "target timout" of something else? Do you know what exact exception is thrown when gdb cannot indentify stacktrace?
Comment 21 Oyvind Harboe CLA 2008-04-01 09:30:46 EDT
(In reply to comment #20)
> I don't think it is a right fix. What if MIException is "target timout" of
> something else? Do you know what exact exception is thrown when gdb cannot
> indentify stacktrace?
> 

I have no idea what sort of exception CDT might throw when encountering the error below. From a testing point of view, this is a workaround for a bug in GDB afterall, I'm not sure I'd want to have a very complicated codepath in this case. If all other commands except stack-info-depth succeeds, then *probably* we're looking at this problem.



790-stack-info-depth
&"Cannot access memory at address 0xdeadbeeb\n"
790^error,msg="Cannot access memory at address 0xdeadbeeb"
791-stack-info-depth
Cannot access memory at address 0xdeadbeeb
(gdb) 



Comment 22 Elena Laskavaia CLA 2008-04-01 09:43:33 EDT
ok.. it would not be worse than before... In a first attempt to recover it does not check exception type either 
Comment 23 Anton Leherbauer CLA 2008-04-03 04:56:28 EDT
Patch applied to HEAD with minor modifications.
Comment 24 Anton Leherbauer CLA 2008-04-03 04:57:07 EDT
Fixed in 5.0 > 20080403.