Locating crashes in ROM - going from address to code
Phil Pemberton (7989) 65 posts |
My apologies if there’s a page on the Wiki for this. I had a look around but couldn’t find one. I’m currently porting RISC OS 5 to the Bush Internet TV set-top box, and I’m having issues with crashes in wild and wonderful places in ROM. At the moment they’re mostly in modules, like this one:
File ‘where’ not found (Error number &D6) Is there a good way to take this crash address and pin it down to a specific line of code? Thanks |
Stuart Swales (8827) 1323 posts |
You have *Modules and *ShowRegs will give you R12 aka the Guilt register to pin down the module. Other than that, good luck! |
Phil Pemberton (7989) 65 posts |
Sadly ShowRegs doesn’t work unless the Debugger module has been loaded first … and in this case ScreenModes loads far before Debugger. The module init gives away that ScreenModes was responsible, but if it wasn’t clear, there is a way to look that up if you built the ROM from source and kept the log: look up the address in the ROM layout map that the ROM linker spits out. For single-file or “include all” assembly modules it’s comparatively easy to get back to a line of code:
I was trying to use the DecAOF method to debug the Debugger module last night. For some reason looking up the offset in the DecAOF output didn’t work, in the sense that the fault offset was greater than the AOF offset, but still within the module. I think that process needs a bit of refinement but it mostly-works for simple modules and is better than nothing! If you use StrongED watch out because the line numbers don’t account for text folding! (I miss Zap) Unfold the whole file before scrolling to the given line. The Debugger module can create exception dumps: https://www.riscosopen.org/wiki/documentation/show/Debugger%20Exception%20Dumps |
Stuart Swales (8827) 1323 posts |
Sure that Debugger used to be very early in the list in ye olden days… Whose daft idea was it to try and stick stuff in the ROM in sort-of-alphabetical order. |
Charles Ferguson (8243) 427 posts |
And to echo what Stuart said… why the heck is the WindowManager before anything else? It is a very high level module and should probably appear a long way down the initialisation list. In fact I’ll bet that’s probably part of what’s wrong here – many of the modules were unhappy if they didn’t have a messages file present. And none of FileSwitch, ResourcesFS, Messages or MessageTrans have initialised. Whilst they should work just fine without them, many do not. Well, it looks like ScreenModes doesn’t need to a Messages file (https://gitlab.riscosopen.org/RiscOS/Sources/Video/UserI/ScrModes/-/blob/master/c/ScrModes#L1920) but it’s always possible that the SharedCLibrary does, and is failing. Or that one of the other parts of the system being missing is causing it to fail. Like FPEmulator, maybe. That said, I can initialise older versions of those modules without any problem, so I presume it’s a little more involved than just missing some modules…. charles@phonewave ~/projects/RO/pyromaniac (report-error-vdu-experiment↑1)> ./pyro.py --config memorymap.zeropage_enable=true --load-module modules/SCL,ffa --load-module modules/ScrModes,ffa --config modules.unplug=MessageTrans --list-modules Number : Address : Private : Name ------ : -------- : -------- : ---------------- 0 : 03800404 : 07000034 : UtilityModule 1 : 0700013c : 00000000 : SharedCLibrary 2 : 0701751c : 0701ac7c : ScreenModes charles@phonewave ~/projects/RO/pyromaniac (report-error-vdu-experiment↑1)> I’d ensure that you have Debugger early in the list so that you can work out what’s wrong. And put your filesystems in there first. Even chuck |
Jeffrey Lee (213) 6048 posts |
The Debugger module can create exception dumps: https://www.riscosopen.org/wiki/documentation/show/Debugger%20Exception%20Dumps You can change dumps to be enabled by default by changing the value of Another tool which might be useful is my fiqprof/profanal – the analysis tool (profanal) can load most of the symbols from a build tree, allowing you to do address-to-line lookup of ROM locations, e.g.: * profanal > loadrom <build$dir> <build$imagename> > info FC1B4240 |
Simon Willcocks (1499) 505 posts |
I use a bash script that find the right line of source most of the time. |