I think I need to be held by the hand, if possible. There are too many variables..
1. If I make a function that's local in a file, that sets my port pins fine, let's call it safeStop, can I just name it in the GDB file? XC won't let me place that function anywhere, since it handles pin handling so well. The example shows use of a breakpoint, but this function isn't called anywhere in the scope around exiting GDB. The example would give "break safeStop" then "run" but I would rather force run safeStop it. Is this possible?
2. You say that "You could trivially test this for your situation to see if it is the right place to call your safeStop() function automatically." Well.. How?
3. Do I make a file as mentioned and call it cmds.txt and in case where do I place it? Or "If you are using xTimeComposer, you will need to add the above to your debug session details - once.". Well.. How?
I do hope others could also be helped by all this work that I trigger you Bristol guys to do. Would this make for a separate report that covers all of this? I would fully understand if you were unable to help all the way here.
Debugger exit code or action
-
- Respected Member
- Posts: 510
- Joined: Wed Apr 25, 2012 8:52 pm
--
Øyvind Teig
Trondheim (Norway)
https://www.teigfam.net/oyvind/home/
Øyvind Teig
Trondheim (Norway)
https://www.teigfam.net/oyvind/home/
-
- XCore Addict
- Posts: 169
- Joined: Fri Oct 23, 2015 10:23 am
Hi
My previous comments were written as a command-line user - I assume you are using xtimecomposer.
Regrettably it is not possible to request xTimeComposer to automatically load a file containing a set of command when ever the debugger start.
This has been registered as a missing feature needing to be fixed in future versions.
So, assuming you are happy to type at least 'source myfile' once per debugging session.
First test if the hook is what you want.
Run up the debugger and on the console window click the 'Display Selected Console' button and chose the '... xgdb ...' option (3rd for me).
(this will allow you to communicate directly with the debugger in the console)
In the console type (the '>' are printed by the debugger):
Then do what you normally do.
You should find that each time the code stops running the message is echoed.
If all is well, create a file (cmds.txt) in the 'project' level containing:
Instead of 'defining' the hook-stop each time you start the debugger, you can now just load the file:
As I said above, there is currently no way to have the file automatically loaded for you each time the debugger is started.
This has been registered as a missing feature.
To remove the hook you will need to type (source a command file) an empty hook:
I hope that does what you want.
Robert
My previous comments were written as a command-line user - I assume you are using xtimecomposer.
Regrettably it is not possible to request xTimeComposer to automatically load a file containing a set of command when ever the debugger start.
This has been registered as a missing feature needing to be fixed in future versions.
So, assuming you are happy to type at least 'source myfile' once per debugging session.
First test if the hook is what you want.
Run up the debugger and on the console window click the 'Display Selected Console' button and chose the '... xgdb ...' option (3rd for me).
(this will allow you to communicate directly with the debugger in the console)
In the console type (the '>' are printed by the debugger):
Code: Select all
define hook-stop
> echo stopping...\n
> end
You should find that each time the code stops running the message is echoed.
If all is well, create a file (cmds.txt) in the 'project' level containing:
Code: Select all
echo creating stop hook\n
define hook-stop
echo stopping...\n
call safeStop
end
Code: Select all
source cmds.txt
This has been registered as a missing feature.
To remove the hook you will need to type (source a command file) an empty hook:
Code: Select all
define hook-stop
end
Robert
-
- Respected Member
- Posts: 510
- Joined: Wed Apr 25, 2012 8:52 pm
Robert! Thanks! I will try to read that fine print and see what I can do. I'll be back.
--
Øyvind Teig
Trondheim (Norway)
https://www.teigfam.net/oyvind/home/
Øyvind Teig
Trondheim (Norway)
https://www.teigfam.net/oyvind/home/
-
- Respected Member
- Posts: 510
- Joined: Wed Apr 25, 2012 8:52 pm
Hi. Writing into the xgdb console gives me green characters in competition with my red printf lines. Even when I manage to type "define hook-stop" I don't seem to get any response from the debugger. The debugger is set with Common | Standard Input and Output | Allocate console (necessary for input) ticked on. Is there any more settings? So I'm stranded at the first point.
--
Øyvind Teig
Trondheim (Norway)
https://www.teigfam.net/oyvind/home/
Øyvind Teig
Trondheim (Norway)
https://www.teigfam.net/oyvind/home/
-
- XCore Addict
- Posts: 169
- Joined: Fri Oct 23, 2015 10:23 am
> Run up the debugger and on the console window click the 'Display Selected Console' button and chose the '... xgdb ...' option (3rd for me).
Try changing to one of the other options and then changing back to the 'xgdb' option.
If you are getting no response to what you type into the console, it is not connected to the debugger.
I too am stuck at this point - sorry.
Try changing to one of the other options and then changing back to the 'xgdb' option.
If you are getting no response to what you type into the console, it is not connected to the debugger.
I too am stuck at this point - sorry.
-
- Respected Member
- Posts: 510
- Joined: Wed Apr 25, 2012 8:52 pm
This is what I have. The debugger info stack and the startup console. I'd say the debugger is running:
_Aquarium.xe [xCORE Application]
xCORE Debugger (12:34 07.02.17)
tile[0] core[0] (Running)CDTDebugModelPresentation.12=signal
xgdb (12:34 07.02.17)
/Users/teig/workspace/_Aquarium/bin/_Aquarium.xe (12:34 07.02.17)
.gdbinit: No such file or directory.
connect --adapter-id 0A27uNkwiG.9f --xscope-realtime --xscope-port localhost:10101
0x00010000 in _start ()
load
Loading section .text, size 0x130 lma 0x10000
Loading section .cp.rodata, size 0x18 lma 0x10130
Loading section .dp.data, size 0x14 lma 0x10148
Start address 0x10000, load size 348
Transfer rate: 84 KB/sec, 116 bytes/write.
Loading section .text, size 0x9a6e lma 0x10000
Loading section .init, size 0x1a lma 0x19a6e
Loading section .fini, size 0x2e lma 0x19a88
Loading section .eh_frame, size 0x24 lma 0x19ab8
Loading section .cp.rodata, size 0xa52 lma 0x19adc
Loading section .cp.const4, size 0x28 lma 0x1a530
Loading section .cp.rodata.const4, size 0x4 lma 0x1a558
Loading section .cp.rodata.cst16, size 0x20 lma 0x1a55c
Loading section .cp.rodata.cst4, size 0xe8 lma 0x1a57c
Loading section .cp.rodata.cst8, size 0x8 lma 0x1a664
Loading section .cp.rodata.string, size 0x11d lma 0x1a66c
Loading section .ctors, size 0x38 lma 0x1a78c
Loading section .dtors, size 0x30 lma 0x1a7c4
Loading section .dp.data, size 0x638 lma 0x1a7f4
Loading section .dp.rodata, size 0x24 lma 0x1ae2c
Start address 0x10000, load size 44617
Transfer rate: 142 KB/sec, 2974 bytes/write.
info program
Program stopped at 0x10000.
It stopped with signal SIGTRAP, Trace/breakpoint trap.
Type "info stack" or "info registers" for more information.
Here come my printfs
ASIDE: I tried "Attach to running process" but then (I think) I experienced that pushing a button in xTIMEcomposer killed all the other programs: iTunes (that was playing Regina Spektor, who stopped), Safari, Grab etc. Unbelievable. But it happened two times! In the OS X ASL-log I think it starts with this: "7. feb. 2017, 12.32.40 xtimecomposer[48825]: LaunchServices: disconnect event received for service com.apple.lsd.mapdb." I have all of it, but I won't paste it here. Tell me if you would want an xmos case on it.
_Aquarium.xe [xCORE Application]
xCORE Debugger (12:34 07.02.17)
tile[0] core[0] (Running)CDTDebugModelPresentation.12=signal
xgdb (12:34 07.02.17)
/Users/teig/workspace/_Aquarium/bin/_Aquarium.xe (12:34 07.02.17)
.gdbinit: No such file or directory.
connect --adapter-id 0A27uNkwiG.9f --xscope-realtime --xscope-port localhost:10101
0x00010000 in _start ()
load
Loading section .text, size 0x130 lma 0x10000
Loading section .cp.rodata, size 0x18 lma 0x10130
Loading section .dp.data, size 0x14 lma 0x10148
Start address 0x10000, load size 348
Transfer rate: 84 KB/sec, 116 bytes/write.
Loading section .text, size 0x9a6e lma 0x10000
Loading section .init, size 0x1a lma 0x19a6e
Loading section .fini, size 0x2e lma 0x19a88
Loading section .eh_frame, size 0x24 lma 0x19ab8
Loading section .cp.rodata, size 0xa52 lma 0x19adc
Loading section .cp.const4, size 0x28 lma 0x1a530
Loading section .cp.rodata.const4, size 0x4 lma 0x1a558
Loading section .cp.rodata.cst16, size 0x20 lma 0x1a55c
Loading section .cp.rodata.cst4, size 0xe8 lma 0x1a57c
Loading section .cp.rodata.cst8, size 0x8 lma 0x1a664
Loading section .cp.rodata.string, size 0x11d lma 0x1a66c
Loading section .ctors, size 0x38 lma 0x1a78c
Loading section .dtors, size 0x30 lma 0x1a7c4
Loading section .dp.data, size 0x638 lma 0x1a7f4
Loading section .dp.rodata, size 0x24 lma 0x1ae2c
Start address 0x10000, load size 44617
Transfer rate: 142 KB/sec, 2974 bytes/write.
info program
Program stopped at 0x10000.
It stopped with signal SIGTRAP, Trace/breakpoint trap.
Type "info stack" or "info registers" for more information.
Here come my printfs
ASIDE: I tried "Attach to running process" but then (I think) I experienced that pushing a button in xTIMEcomposer killed all the other programs: iTunes (that was playing Regina Spektor, who stopped), Safari, Grab etc. Unbelievable. But it happened two times! In the OS X ASL-log I think it starts with this: "7. feb. 2017, 12.32.40 xtimecomposer[48825]: LaunchServices: disconnect event received for service com.apple.lsd.mapdb." I have all of it, but I won't paste it here. Tell me if you would want an xmos case on it.
--
Øyvind Teig
Trondheim (Norway)
https://www.teigfam.net/oyvind/home/
Øyvind Teig
Trondheim (Norway)
https://www.teigfam.net/oyvind/home/