11 April 2021, 16:48 | #1 |
Registered User
Join Date: Dec 2016
Location: Warsaw area
Posts: 152
|
vbcc memwatch, debugging, symbols
Hi All!
Im switching to VBCC (from Blitz Basic and some simple Asm code) with some good results so far (thanks to other thread about vbcc and Photon's tutorials in C). I'm using vbcc + fs-uae on Mac and on this setup I want to use internal fs-uae debugger which looks that has all I need. I have some questions regarding debugging: - how do I enable memwatch? - how to use Zf Zl Zc commands of the fs-uae debugger? - how to generate symbols and how to import them to debugger? - can fs-uae import all needed symbols automatically or it needs to be loaded manually by me? that's for a start I plan to develop mostly in C with some ASM functions here and there. So far I can't find options or tutorials how to generate symbols from C source file and use them in debugger. Thanks In Advance for any help/hints |
11 April 2021, 23:05 | #2 | ||
Natteravn
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,500
|
I never used FS-UAE, but may be the 'w' command.
Quote:
Quote:
https://github.com/prb28/vscode-amiga-assembly But this doesn't help you with your Mac, of course. Maybe you find more answers in an FS-UAE support thread? vasm and vbcc can generate standard Amiga symbol hunks and LINE debug hunks (for source level debugging), like SAS/C and other Amiga compilers. Just as a hint: if you want to set a breakpoint for UAE in your source, insert a very rare opcode which has no effect, like exg a7,a7. Then let the UAE debugger break on this opcode: fi cf4f. You can also do that in C: __asm("\tdc.w\t$cf4f"); |
||
12 April 2021, 09:04 | #3 |
Registered User
Join Date: Dec 2016
Location: Warsaw area
Posts: 152
|
thanks for quick reply.
I actually started using this __asm("\tdc.w\t$cf4f"); trick. but what I want to do is a way to show memory or disassemble parts of my program with commands like: Code:
m pictureData m copperList Code:
d myProcedure Im not sure I understand the debug hunk and/orthe line debug options. am I supposed to get additional files with symbols debug data after compiling. Or is it combined within the compiled files? |
12 April 2021, 17:45 | #4 | ||
Natteravn
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,500
|
When your program doesn't kill the OS I would try a real AmigaOS debugger, which offers all you need. I'm using BDebug (Aminet, comes with the Barfly assembler), which handles symbols and source-level debugging just fine. But then you have to compile the source on the same Amiga to get useful source-path information. Symbols will work in any case.
Quote:
Quote:
|
||
12 April 2021, 19:00 | #5 |
Registered User
Join Date: Dec 2016
Location: Warsaw area
Posts: 152
|
I use -g option for vc.
So you say I should see the symbols in debugger? hmmm. will try in a moment. but I did some tests before with and without -g and file size after compiling is the same. Is this ok? I assumed that -g option is not working. So assuming I have all the symbols in the compiled file is my approach possible to show parts of memory with "m" command and using symbol names like mentioned before? Code:
m copperList |
13 April 2021, 00:47 | #6 | |||
Natteravn
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,500
|
Quote:
Code:
frank@nerthus cat helloamiga.c #include <proto/dos.h> int main() { BPTR out = Output(); Write(out,"Hello World\n",12); return 0; } frank@nerthus vc +aos68k -o helloamiga helloamiga.c frank@nerthus ll helloamiga -rwxr-xr-x 1 frank users 1240 Apr 13 00:29 helloamiga frank@nerthus vc +aos68k -g -o helloamiga helloamiga.c frank@nerthus ll helloamiga -rwxr-xr-x 1 frank users 1884 Apr 13 00:29 helloamiga Quote:
-ldnodb=-s -Rshort, which are options passed to vlink meaning: strip all symbols (-s) and use short relocs, when possible (-Rshort). These are not present when calling "vc" with "-g" option. You can check that by compiling with -v (verbose). Without -g, vlink is called with -s and -Rshort: Code:
frank@nerthus vc +aos68k -o helloamiga helloamiga.c -v vc frontend for vbcc (c) in 1995-2020 by Volker Barthelmann vbccm68k -quiet -hunkdebug "helloamiga.c" -o= "/tmp/tmp.0.asm" -O=1 -I$VBCC/targets/m68k-amigaos/include -I/usr/local/vbcc/sdk/NDK_3.9/include_h vasmm68k_mot -quiet -Fhunk -phxass -opt-fconst -nowarn=62 "/tmp/tmp.0.asm" -o "/tmp/tmp.0.o" vlink -bamigahunk -x -Bstatic -Cvbcc -nostdlib -mrel $VBCC/targets/m68k-amigaos/lib/startup.o "/tmp/tmp.0.o" -s -Rshort -L$VBCC/targets/m68k-amigaos/lib -lvc -o helloamiga rm -f "/tmp/tmp.0.asm" rm -f "/tmp/tmp.0.o" Code:
frank@nerthus vc +aos68k -g -o helloamiga helloamiga.c -v vc frontend for vbcc (c) in 1995-2020 by Volker Barthelmann vbccm68k -quiet -hunkdebug "helloamiga.c" -o= "/tmp/tmp.0.asm" -g -O=1 -I$VBCC/targets/m68k-amigaos/include -I/usr/local/vbcc/sdk/NDK_3.9/include_h vasmm68k_mot -quiet -Fhunk -phxass -opt-fconst -nowarn=62 "/tmp/tmp.0.asm" -o "/tmp/tmp.0.o" vlink -bamigahunk -x -Bstatic -Cvbcc -nostdlib -mrel $VBCC/targets/m68k-amigaos/lib/startup.o "/tmp/tmp.0.o" -L$VBCC/targets/m68k-amigaos/lib -lvc -o helloamiga rm -f "/tmp/tmp.0.asm" rm -f "/tmp/tmp.0.o" Quote:
Note: Also remember when referencing C-symbols in a debugger or from an assembler program you have to add a leading underscore: _copperList. |
|||
13 April 2021, 10:50 | #7 |
Registered User
Join Date: Dec 2016
Location: Warsaw area
Posts: 152
|
ah yes... -s option was used in my vlink commnandline from makefile.
thanks for a hint! so now I can see the symbols in the file and after loading it into BDebug I can also move around by using symbols. and yes... _coperList is right way to use the C symbols in BDebug I have to get used to Debug for now before I figure out how to setup this in internal debugger of fs-uae. I will ask on proper thread now. I think I've found one. Thanks a lot for help! |
14 April 2021, 16:34 | #8 |
Registered User
Join Date: Mar 2020
Location: Boulder Creek / USA
Posts: 43
|
Coming from sas/c does anybody know if vbcc has the following like sas/c?
- auto open libraries - a function that executes when the program starts - a function that executes before the program exits Sorry for being off topic |
17 April 2021, 11:43 | #9 | ||
Natteravn
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,500
|
Yes. Link with -lauto (or -lautos for small data).
Quote:
_INIT_<pri>_<name>. Where <pri> is a priority between 1 and 9. 1 is called first. <name> is an optional function name. For example the clib-stdio is initialized on startup within void _INIT_2_stdio(void). If you need stdio in your constructor, don't use a priority < 3. Library auto-open functions have a default priority of 5. Quote:
_EXIT_<pri>_<name>. Destructor functions are called in reverse order (priority 9 first). They are called after the registered ISO-C atexit-functions. |
||
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
UAE debugger updates (executable debugging, segment tracking, symbols and more) | Toni Wilen | support.WinUAE | 171 | 02 December 2023 15:49 |
Debugging vbcc code | tolkien | Coders. C/C++ | 5 | 14 February 2015 06:45 |
Memwatch functions in Action Replay III don't work in WinUAE | Galahad/FLT | support.WinUAE | 12 | 11 May 2014 13:42 |
Memwatch+Arcadia | thor | support.WinUAE | 4 | 28 December 2013 17:28 |
Winuae - (debugger) Memwatch Problem | barny | support.WinUAE | 2 | 03 October 2005 12:30 |
|
|