gdb for morphos? How do you debug your beasts?
  • Priest of the Order of the Butterfly
    Priest of the Order of the Butterfly
    tolkien
    Posts: 544 from 2013/5/29
    My toys are easy to debug for pro coders but they are growing and Its tedious to use printf everywhere. Can we have gdb or similar tools to debug our babys?

    How do you do it?
    MorphOS: PowerMac G5 - PowerBook G4 - MacMini.
    Classic: Amiga 1200/060 - A500 PiStorm
  • »22.11.13 - 23:01
    Profile
  • Priest of the Order of the Butterfly
    Priest of the Order of the Butterfly
    ausPPC
    Posts: 543 from 2007/8/6
    From: Pending...
    Apparently, supervisor mode or at least interrupts are required for debuggers but that's not available in the a-box.

    Never mind that low level drivers still work somehow...
    PPC assembly ain't so bad... ;)
  • »24.11.13 - 03:29
    Profile Visit Website
  • MorphOS Developer
    itix
    Posts: 1520 from 2003/2/24
    From: Finland
    Quote:

    tolkien wrote:
    My toys are easy to debug for pro coders but they are growing and Its tedious to use printf everywhere. Can we have gdb or similar tools to debug our babys?

    How do you do it?



    Using serial debug. That is, adding NewRawDoFmt("DEBUG PRINT", (APTR)1, NULL, ...) to interesting locations. In PowerSDL development I can build debug builds with debug prints enabled and analyze program flow.

    Sometimes it could be useful to add break points (although it is not always safe on Amiga) and I workaround it using those debug prints to see what is going on.

    If there is a hit I take chunk offset and dump (objdump --disassemble-all --reloc executable >executable.s) my program to find out where in the code that hit took place. It is sometimes tedious since I only get function name but not exact location (line number) to my code. If functions is longer I have to analyze it further from disassembly.
    1 + 1 = 3 with very large values of 1
  • »24.11.13 - 10:18
    Profile
  • Priest of the Order of the Butterfly
    Priest of the Order of the Butterfly
    tolkien
    Posts: 544 from 2013/5/29
    Interesting.
    Can I use a notebook with a terminal linked with a serial cable??? need it to be a special cable?

    Thanks
    MorphOS: PowerMac G5 - PowerBook G4 - MacMini.
    Classic: Amiga 1200/060 - A500 PiStorm
  • »24.11.13 - 13:58
    Profile
  • MorphOS Developer
    itix
    Posts: 1520 from 2003/2/24
    From: Finland
    I have used only good old serial cable from Efika to another computer. But you dont need to use another computer if you redirect serial debug to ram (which is default on all machines, IIRC). Just make sure get dead lock so you can continue inspecting logs.

    Ram logs can also survive reboot (not sure on Macs though) but OTOH it is easier if you have clean logs after reboot.

    Enabling INVZEROPAGE might be good idea so you can track down illegal reads from zero page (writes to zero page are always illegal).
    1 + 1 = 3 with very large values of 1
  • »24.11.13 - 14:30
    Profile
  • Moderator
    Kronos
    Posts: 2431 from 2003/2/24
    As long as you don't write lowlevel stuff or your app is totally crash happy, the use of kprintf() RamDebug and logtool should suffice.

    You may also want to look at the macros used by Ambient (found in the download section on morphos.de).

    In debug.h you will find PDB() which add sourcefile, function and linenumber to the output.

    This will only be active while you have "DEBUG" defined (globally), so you can easily create a debug-free release by just removing that.
  • »24.11.13 - 14:34
    Profile
  • Butterfly
    Butterfly
    dekanyz
    Posts: 94 from 2013/2/6
    From: Hungary
    Quote:

    Using serial debug.

    Is there any advantage of using serial debug over an own debug message printing system?
    (I mean, for not kernel/driver/... development)

    I have made something similar what Kronos mentioned and works very well, but I also miss a real debugger very much.
  • »25.11.13 - 09:56
    Profile
  • Priest of the Order of the Butterfly
    Priest of the Order of the Butterfly
    MarK
    Posts: 641 from 2004/1/25
    From: Prague, The Cz...
    afaik, the only working debugger with abilities to stop running programm, trace single line code etc is my own debugger, but it's for PowerD language only...
  • »25.11.13 - 14:32
    Profile
  • MorphOS Developer
    Krashan
    Posts: 1107 from 2003/6/11
    From: Białystok...
    afaik, the only working debugger with abilities to stop running programm, trace single line code etc is my own debugger

    Don't forget about LuaExplorador :-).
  • »26.11.13 - 06:53
    Profile Visit Website
  • Priest of the Order of the Butterfly
    Priest of the Order of the Butterfly
    MarK
    Posts: 641 from 2004/1/25
    From: Prague, The Cz...
    Quote:

    Krashan wrote:
    afaik, the only working debugger with abilities to stop running programm, trace single line code etc is my own debugger

    Don't forget about LuaExplorador :-).


    Unfortunately the link doesn't work :(
  • »27.11.13 - 10:04
    Profile