AHCC debugger?

C and PASCAL (or any other high-level languages) in here please

Moderators: simonsunnyboy, Mug UK, Zorro 2, Moderator Team

Post Reply
User avatar
AndresPlaza
Atariator
Atariator
Posts: 22
Joined: Mon Apr 29, 2019 2:30 pm
Location: Boston, MA, USA
Contact:

AHCC debugger?

Post by AndresPlaza »

Hello,

I was wondering what people use as a debugger in AHCC... I think Pure C has its own, but I'm pretty sure AHCC doesn't. What are the options? Can I use the Pure C debugger with AHCC?

Thanks,

Andres.
joska
Hardware Guru
Hardware Guru
Posts: 4893
Joined: Tue Oct 30, 2007 2:55 pm
Location: Florø, Norway
Contact:

Re: AHCC debugger?

Post by joska »

With AHCC (and every other C compiler except Pure C) I use printf() ;) No, you can't use the Pure Debugger with AHCC, atleast not on the source level. I asked Henk about this some years ago, and IIRC he could not add the necessary debug information as he hadn't figured out the format.
Jo Even

VanillaMiNT - Falcon060 - Milan060 - Falcon040 - MIST - Mega STE - Mega ST - STM - STE - Amiga 600 - Sharp MZ700 - MSX - Amstrad CPC - C64
User avatar
AndresPlaza
Atariator
Atariator
Posts: 22
Joined: Mon Apr 29, 2019 2:30 pm
Location: Boston, MA, USA
Contact:

Re: AHCC debugger?

Post by AndresPlaza »

Hi Jo,

Ah!!! Jajajaja, yes, that was my next step, if I could not find a debugger (use printf). Thanks for the info!

Take care,

Andres.
simonsunnyboy
Moderator
Moderator
Posts: 5309
Joined: Wed Oct 23, 2002 4:36 pm
Location: Friedrichshafen, Germany
Contact:

Re: AHCC debugger?

Post by simonsunnyboy »

If you are developing with Hatari, I created my own set of printf() style debugging which outputs to the NATFEATS console on the host.

See https://www.atari-forum.com/viewtopic.p ... 12#p288112

I combine C style asserts with printf-style. For my needs with Hatari it works well.
Simon Sunnyboy/Paradize - http://paradize.atari.org/

Stay cool, stay Atari!

1x2600jr, 1x1040STFm, 1x1040STE 4MB+TOS2.06+SatanDisk, 1xF030 14MB+FPU+NetUS-Bee
User avatar
AndresPlaza
Atariator
Atariator
Posts: 22
Joined: Mon Apr 29, 2019 2:30 pm
Location: Boston, MA, USA
Contact:

Re: AHCC debugger?

Post by AndresPlaza »

simonsunnyboy wrote: Fri Nov 20, 2020 4:17 pm If you are developing with Hatari, I created my own set of printf() style debugging which outputs to the NATFEATS console on the host.
Thanks a lot, Simon!
ThorstenOtto
Atari God
Atari God
Posts: 1331
Joined: Sun Aug 03, 2014 5:54 pm

Re: AHCC debugger?

Post by ThorstenOtto »

Note that the NF_STDERR api just outputs a single string. If you prefer to use a printf() style format with arguments, you can find similar code to the one linked in the other thread in the current mintlib repo.
joska
Hardware Guru
Hardware Guru
Posts: 4893
Joined: Tue Oct 30, 2007 2:55 pm
Location: Florø, Norway
Contact:

Re: AHCC debugger?

Post by joska »

You can also redirect stdout to the serial port, this way you don't need any special code. I have only used this on real hardware but I don't see why it shouldn't work with Hatari's serial port emulation.
Jo Even

VanillaMiNT - Falcon060 - Milan060 - Falcon040 - MIST - Mega STE - Mega ST - STM - STE - Amiga 600 - Sharp MZ700 - MSX - Amstrad CPC - C64
ThorstenOtto
Atari God
Atari God
Posts: 1331
Joined: Sun Aug 03, 2014 5:54 pm

Re: AHCC debugger?

Post by ThorstenOtto »

Depends on what your are debugging. Calling the NF-Api functions works from everywhere, even from interrupts. But you cannot use printf() from there, because a) it would finally call GEMDOS and b) because its stack usage is usually too high.
User avatar
Eero Tamminen
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 2315
Joined: Sun Jul 31, 2011 1:11 pm

Re: AHCC debugger?

Post by Eero Tamminen »

Hatari debugger loads automatically debug symbols from a program launched from GEMDOS HD (emulating directory as a drive). Both DRI and a.out debug symbol formats are supported: https://hatari.tuxfamily.org/doc/debugg ... ug_symbols

If one enables profiling in the debugger ("profile on" command), debugger will also show call backtraces whenever debugger is invoked.

Debugger is assembly level one though, one doesn't see C etc. code, just the compiled instructions and address symbols (for functions etc).
vinz6751
Atari User
Atari User
Posts: 32
Joined: Sat Nov 15, 2014 10:35 am
Location: France
Contact:

Re: AHCC debugger?

Post by vinz6751 »

About the format of the Pure C debugger: the debugger ADEBUG from Brainstorm understands PureC debug info, and it's open source now (search for ADEBUG RELOADED), I use it sometimes and it's quite good !

E.g. this file could be of interest https://github.com/frost242/adebug/blob ... /pcdebug.s to understand PureC debug info...
ThorstenOtto
Atari God
Atari God
Posts: 1331
Joined: Sun Aug 03, 2014 5:54 pm

Re: AHCC debugger?

Post by ThorstenOtto »

Interesting, wasn't aware that a debugger that was mainly used on AMIGA is capable of reading Pure-C debug info. Unfortunately, they don't document the format, only kind of information is the source file itself (~3000 lines of assembler...)
vinz6751
Atari User
Atari User
Posts: 32
Joined: Sat Nov 15, 2014 10:35 am
Location: France
Contact:

Re: AHCC debugger?

Post by vinz6751 »

Assemble (the editor) is quite nice, it has a coloring editor. The assembler is faster than devpack's. The linker can link Pure C objects too. The debugger is very powerful, it's a very nice package on the Atari. I was told recently (2 months or so ago) that the author is willing to put everything in GPL and has given the sources so somebody can do it, ADEBUG reloaded was then made but the rest of the package was never published for lack of time. The sources are not lost though (hopefully, unless a hard drive died) and there is still hope to have the whole package released as open source, which together with AHCC would be a full open source/free alternative to GCC which is almost unusable on a plain ST and hardly usable on Falcon.
Post Reply

Return to “C / PASCAL etc.”