News: 11 March 2016 - Forum Rules

Author Topic: Tracing Crashes?  (Read 2706 times)

justin3009

  • Hero Member
  • *****
  • Posts: 1666
  • Welp
    • View Profile
Tracing Crashes?
« on: January 20, 2013, 11:30:26 am »
I'm going through Tales of Phantasia and the game will suddenly crash on Mint's attack because I'm shuffling data around.  It gets to a certain point then.. just blows up.  I've tried tracing it and seeing what could go wrong but it seems everything loads up perfectly fine up until a point and then it just dies.  I can't seem to find anything before or after the initialization or even during it that would cause this crash.

How does one go and find this?
« Last Edit: January 20, 2013, 11:47:31 am by justin3009 »
'We have to find some way to incorporate the general civilians in the plot.'

'We'll kill off children in the Juuban district with an infection where they cough up blood and are found hanging themselves from cherry blossom trees.'

tryphon

  • Hero Member
  • *****
  • Posts: 737
    • View Profile
Re: Tracing Crashes?
« Reply #1 on: January 20, 2013, 02:43:48 pm »
Your question is too vague to be answered. What did you do precisely ? Just adding datas ? In that case maybe you added too much, or forgot to fix a pointer ?

Did you play with the ASM code ? Which emulator do you use ? Does it crash on others ?

Gideon Zhi

  • Discord Staff
  • Hero Member
  • *****
  • Posts: 3536
    • View Profile
    • Aeon Genesis
Re: Tracing Crashes?
« Reply #2 on: January 20, 2013, 02:50:25 pm »
In cases where the crash isn't immediately apparent, I often load up a "good" trace, obtained from a working version of the ROM, and a "bad" trace from the bugged version in a text editor, then compare them side-by-side to see where they differ substantially from one another.

justin3009

  • Hero Member
  • *****
  • Posts: 1666
  • Welp
    • View Profile
Re: Tracing Crashes?
« Reply #3 on: January 20, 2013, 07:15:03 pm »
I moved all data to another bank,  changed all mentions of JSR  to JSL and altered the return byte.  Made sure the branches were updated to.  The code works exactly the same as a good one but  then suddenly after the very last  return byte,  game explodes.
« Last Edit: January 20, 2013, 11:42:01 pm by justin3009 »
'We have to find some way to incorporate the general civilians in the plot.'

'We'll kill off children in the Juuban district with an infection where they cough up blood and are found hanging themselves from cherry blossom trees.'

LostTemplar

  • Hero Member
  • *****
  • Posts: 910
    • View Profile
    • au-ro-ra.net
Re: Tracing Crashes?
« Reply #4 on: January 21, 2013, 03:57:44 am »
Sounds like a problem with the stack. Does it return to the correct address after the last RTL? If yes, does the stack contain the same values as the unchanged game?

justin3009

  • Hero Member
  • *****
  • Posts: 1666
  • Welp
    • View Profile
Re: Tracing Crashes?
« Reply #5 on: January 21, 2013, 12:48:35 pm »
That's the problem.  Even when stepping slowly into, after it hits the RTL the game just dies.  I can't trace it nor can I see what's going on.  It's very strange but it SHOULD return correctly because it's straight from a regular JSL in the first place that wasn't loaded by me.  Which sends me through a loop.

It's hard to get an exact trace as well since it takes about 10 tries to get the code to load since Mint's AI is horrifyingly annoying and won't attack at the appropriate time.

Edit: Maybe getting closer?  I was able to step through a huge portion this time with the bad log and it.. works up to a point.  I'm not sure which point as it crashed as I tried something near the end of the file.  I'm assuming maybe there's another JSR somewhere in the data that needs to be JSL which is causing a bad return.  I'll see if I can trace it further now.

Edit 2: Fixed it -_-  It ends up being is was right in the code I bumped.  There was a repeated value that screwed up one single jump and bam, fixed the issue.  Haha.  Now THAT'S out of the way!
« Last Edit: January 21, 2013, 02:04:03 pm by justin3009 »
'We have to find some way to incorporate the general civilians in the plot.'

'We'll kill off children in the Juuban district with an infection where they cough up blood and are found hanging themselves from cherry blossom trees.'