i made a script to pipe ufo output to replace object addresses to file/line/function
example:
./ufo(CL_ReadSinglePlayerData+0x15d)[0x80c2fa5]
./ufo(GAME_CP_InitStartup+0x137)[0x8070671]
./ufo(GAME_SetMode+0x100)[0x806e634]
./ufo(GAME_ReloadMode+0x34)[0x806e396]
./ufo[0x80eff36]
./ufo[0x80f0cae]
by something more human readable
./ufo(CL_ReadSinglePlayerData+0x15d)[./src/client/campaign/cp_parse.c:728 CP_ItemsSanityCheck()]
./ufo(GAME_CP_InitStartup+0x137)[./src/client/cl_game_campaign.c:491 GAME_CP_InitStartup()]
./ufo(GAME_SetMode+0x100)[./src/client/cl_game.c:308 GAME_SetMode()]
./ufo(GAME_ReloadMode+0x34)[./src/client/cl_game.c:117 GAME_GenerateTeam()]
./ufo[./src/client/campaign/cp_save.c:158 SAV_GameLoad()]
./ufo[./src/client/campaign/cp_save.c:390 SAV_GameReadGameComment()]
now the bad new is that's a php5 shell script, i provided in attached file.
if you are still interested, you have to use it like this
- you have to put the script addr2line.php in the same directory as your ufo binary. I mean, if you're running from trunk, you just have to copy it in trunk directory.
- you run ufo binary from shell using ./ufo 2>&1 | php addr2line.php
- you can enjoy the game as usual.
as ufo writes both on stderr and stdout the pipe may mix the two streams from time to time. i don't think you care a lot about it.
the script assume addr2line is available in /usr/bin/addr2line. if not just edit line 29. It will not try to install addr2line if you don't have it.
feel free to improve it or to port it into what you want.