Debugging homebrew

Discussion in '3DS - Homebrew Development and Emulators' started by capz, Jul 25, 2015.

  1. capz
    OP

    capz Advanced Member

    Newcomer
    70
    23
    Nov 28, 2014
    Netherlands
    cake town
    So i've been poking around with the homebrew sdk for a little while now and want to port some existing code that I have to it. I got things to compile, but it's really hard to see which parts are malfunctioning on the 3ds because i can't debug it. I dont get any stdout messages in citra (can't seem to find anything) either so I was wondering.. A few people have written homebrew apps/games, so I figured I'd ask here; how do you guys and girls test/debug your code?
     
  2. elhobbs

    elhobbs GBAtemp Advanced Fan

    Member
    811
    299
    Jul 28, 2008
    United States
    I generally try to make my projects so they can cross compile to windows as well. That way I can test core logic in windows first. For 3ds specific code I will usually start adding print statements. If it gets really bad then I use a function that prints a debug string to the console and waits for a key press (and waits for the release too). And I add it liberally to the code I am troubleshooting in order to isolate the issue. It can take a few builds to find the issue. If you test frequently then you know where to start looking.
     
  3. hippy dave

    hippy dave BBMB

    Member
    2,598
    1,809
    Apr 30, 2012
    United Kingdom
    ctrulib has a console that you can activate on one or other screen and print messages to, very useful for narrowing down where/what the problem is in your code. NTR (v1.x for o3ds or v2 for n3ds) actually has a real debugger, haven't used it personally tho.
     
  4. Rinnegatamante

    Rinnegatamante GBAtemp Psycho!

    Member
    3,127
    3,271
    Nov 24, 2014
    Italy
    Bologna

    For me, i just use my O3DS ejecting SD card during tests including in the LUA script a button who just crash my LUA interpreter so i can restart the code instantly without going back to hb_menu or home menu.
     
  5. capz
    OP

    capz Advanced Member

    Newcomer
    70
    23
    Nov 28, 2014
    Netherlands
    cake town
    Yeah I've been trying to shoehorn my desktop code into the 3ds on and off but until i get to the level of crossplatform support that would allow that, I guess I'll need to build minimal test cases first.

    that would be great for C++ :P I envy this

    That might be worth looking into, I haven't attempted to play around with NTR yet