Propeller-GCC 1_9_0 GDB
Started hooking up gdb to simpleide.
Having a bit of trouble. Is cogstart is supported yet?
Program running in LMM mode. Libraries built in LMM mode. Code attached.
Having a bit of trouble. Is cogstart is supported yet?
Program running in LMM mode. Libraries built in LMM mode. Code attached.
Starting gdb ... GNU gdb (propellergcc-alpha_v1_9_0_) 7.9.50.20150415-cvs
Copyright (C) 2015 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 "--host=i586-mingw32msvc --target=propeller-elf".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://code.google.com/p/propgcc/issues>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from lmm/PacketTest.elf...done.
(gdb) set listsize 1
(gdb) target remote | "C:/Program Files (x86)/SimpleIDE/propeller-gcc/bin/gdbstub.exe" -v -l gdblog.txt
Remote debugging using | "C:/Program Files (x86)/SimpleIDE/propeller-gcc/bin/gdbstub.exe" -v -l gdblog.txt
0x00000048 in start ()
(gdb) set remote hardware-breakpoint-limit 1
(gdb) break main
warning: Can not parse XML memory map; XML support was disabled at compile time
Breakpoint 1 at 0x488: file PacketTest.c, line 19.
(gdb) continue
Continuing.
Breakpoint 1, main () at PacketTest.c:19
19 {
(gdb) step
Breakpoint 1, main () at PacketTest.c:19
19 {
(gdb) step
main () at PacketTest.c:21
21 pktport = fdserial_open(PROD_RX, PROD_TX, PROD_MODE, PROD_BAUD);
(gdb) step
26 printi("Send packets\n");
(gdb) step
21 pktport = fdserial_open(PROD_RX, PROD_TX, PROD_MODE, PROD_BAUD);
(gdb) step
23 printi("Packet Test\n");
(gdb) step
21 pktport = fdserial_open(PROD_RX, PROD_TX, PROD_MODE, PROD_BAUD);
(gdb) step
23 printi("Packet Test\n");
(gdb) step
Packet Test
24 packet_start(pktport);
(gdb) step
packet_start (rec=0x2440) at packet.c:26
26 grec = rec;
(gdb) step
27 gcog = cogstart(packet_cog, 0, packet_stack, sizeof(packet_stack));
(gdb) step
26 grec = rec;
(gdb) step
27 gcog = cogstart(packet_cog, 0, packet_stack, sizeof(packet_stack));
(gdb) step
Remote failure reply: E04
warning: Error removing breakpoint 0
Program received signal SIGTRAP, Trace/breakpoint trap.
Cannot remove breakpoints because program is no longer writable.
Further execution is probably impossible.
0x00000000 in start ()
(gdb)
Project Directory: C:/Users/Steve/Documents/SimpleIDE/PacketProducer/
SimpleIDE Version 1.0.2
C:/Users/Steve/Documents/SimpleIDE/Learn/Simple Libraries/
C:/Users/Steve/Documents/SimpleIDE/ Updated on: 2015-01-13
propeller-elf-gcc.exe -v GCC 4.6.1 (propellergcc-alpha_v1_9_0_)
propeller-elf-gcc.exe -I . -L . -I C:/Users/Steve/Documents/SimpleIDE/Learn/Simple Libraries/TextDevices/libsimpletext -L C:/Users/Steve/Documents/SimpleIDE/Learn/Simple Libraries/TextDevices/libsimpletext/lmm/ -I C:/Users/Steve/Documents/SimpleIDE/Learn/Simple Libraries/TextDevices/libfdserial -L C:/Users/Steve/Documents/SimpleIDE/Learn/Simple Libraries/TextDevices/libfdserial/lmm/ -g -Os -mlmm -Wall -m32bit-doubles -fno-exceptions -std=c99 -g -c packet.c -o lmm/packet.o
propeller-elf-gcc.exe -I . -L . -I C:/Users/Steve/Documents/SimpleIDE/Learn/Simple Libraries/TextDevices/libsimpletext -L C:/Users/Steve/Documents/SimpleIDE/Learn/Simple Libraries/TextDevices/libsimpletext/lmm/ -I C:/Users/Steve/Documents/SimpleIDE/Learn/Simple Libraries/TextDevices/libfdserial -L C:/Users/Steve/Documents/SimpleIDE/Learn/Simple Libraries/TextDevices/libfdserial/lmm/ -g -o lmm/PacketTest.elf -Os -mlmm -Wall -m32bit-doubles -fno-exceptions -std=c99 -g lmm/packet.o PacketTest.c -lsimpletext -lfdserial -lsimpletext
propeller-load -s lmm/PacketTest.elf
propeller-elf-objdump -h lmm/PacketTest.elf
Done. Build Succeeded!
propeller-load.exe -Dreset=dtr -I C:/Program Files (x86)/SimpleIDE/propeller-gcc/propeller-load/ -b ACTIVITYBOARD lmm/PacketTest.elf -g -r -p COM4
Propeller Version 1 on COM4
patching for debug at offset 0x1fb0
Loading lmm/PacketTest.elf to hub memory
9464 bytes sent
Verifying RAM ...
OK
Comments
I made some attempts at having COGs be able to share the serial pins, but they all foundered on the shoals of the quickstart hardware (which I think you're well familiar with
Hi Eric,
The fdserial is running in another COG. It is also using pin 0/1 for communications instead of the default 30/31 pins. So, there shouldn't be any problems with pin fighting.
I'm also amazed it got as far as it did ... I only spent an hour on it this morning.
Thanks.
The -Os optimization reorders code quite a bit. I changed optimization to -O1, and the basic stepping order is normal.
Of course -O1 optimization is not very good for generating small code. Is there an optimization flag that I can add in the -Os case to maintain order and keep the binary code small?
I'll look at "hover-over variable" inspection next.
I haven't tried CMM since the help page suggests that it doen't work yet.
gcc5 has a -Og option which is supposed to enable all the optimizations that don't interfere with debugging. I haven't actually tried it out yet.
I think gdb for CMM will work in practice, it just hasn't been tested much. It's not like gdb on LMM has been tested very much either, though!
Should I be testing gcc5?
I suppose that would be the closest to integrating to the main GNU repo.
Tried CMM mode with libsimpletext, and found that "next" stumbles on the line below.
Using "step" through the function seemed to work. No trouble with LMM "next".
libsimpletext.c line 48: simpleterm_reopen(31,30,0,115200);
Thanks.
It's a fork of the main GNU repo, and we can periodically merge from that.
Sorry you had some trouble with CMM -- I guess there was a good reason we added that note to the docs
Eric
Observations:
1. gval is never "in context" in CMM or LMM
2. val is always "in context" in CMM or LMM
3. n is only "in context" before the for loop is started
Not sure if anyone will ever have time for the issues. At this point it may not be worth pursuing further unless Parallax wants it.
/** * This is the main gdbtest1 program file. */ #include "simpletext.h" int gval = 0x55; int main(void) { int n; int val; for (n = 0; n < 10; n++) { val = gval+n; printi("value[%d] %d\n", n, val); } return val; }
lmm gdb trace
Breakpoint 1, main () at gdbtest1.c:9 9 { (gdb) next main () at gdbtest1.c:12 12 for (n = 0; n < 10; n++) { (gdb) p n $1 = 0 (gdb) p n $2 = 0 (gdb) p val $3 = 0 (gdb) p gval No global symbol "gval". (gdb) next 13 val = gval+n; (gdb) next 14 printi("value[%d] %d\n", n, val); (gdb) next 13 val = gval+n; (gdb) p n $4 = <optimized out> (gdb) next 14 printi("value[%d] %d\n", n, val); (gdb) next value[0] 85 12 for (n = 0; n < 10; n++) { (gdb) next 13 val = gval+n; (gdb) next 14 printi("value[%d] %d\n", n, val); (gdb) p n $5 = <optimized out> (gdb) next value[1] 86 12 for (n = 0; n < 10; n++) { (gdb) p val $6 = 86 (gdb)
Eric