UFO:Alien Invasion
Archive => Bugs prior to release 2.4 => Topic started by: jerikojerk on August 25, 2010, 12:14:02 am
-
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.
-
an other way to use it, if you already have a backtrace. You copy it in a file (backtrace_file) and then:
cat backtrace_file | php addr2line.php
it should work fine on window with any php.exe in CLI version, but i don't know how to pipe stdin and stdout on windows, sorry boys.
-
on windows is no backtrace anyway ;)
-
on windows is no backtrace anyway ;)
Well, I found this: http://code.google.com/p/backtrace-mingw/
Maybe an option for the debug build?
-
Here is an initial draft version of the backtrace in windows for an unhandled exception (segfault, e.g.).
Please apply patch in ascending order (0001, 0002)
Tested by adding following lines somewhere in code:
int *i = NULL;
*i = 4;
This caused the following backtrace in ufoconsole.log:
2010/10/14 20:19:48
----- network initialization -------
2010/10/14 20:19:48libcurl/7.21.1 zlib/1.2.3 initialized.
2010/10/14 20:19:48
------ server initialization -------
2010/10/14 20:19:48mapcycle add: '+africa small' type '1on1'
2010/10/14 20:19:48mapcycle add: '+frozen small' type '1on1'
2010/10/14 20:19:48mapcycle add: '+italy default' type '1on1'
2010/10/14 20:19:48mapcycle add: 'farm' type '1on1'
2010/10/14 20:19:48mapcycle add: 'estate' type '1on1'
2010/10/14 20:19:48mapcycle add: '+japan default' type '1on1'
2010/10/14 20:19:48mapcycle add: 'tower' type '1on1'
2010/10/14 20:19:48added 7 maps to the mapcycle
2010/10/14 20:19:48Stack trace:
0x41064f : E:\cpp\ufoai\ufo.exe : e:\cpp\ufoai/src/client/cl_main.c (1260) : in function (CL_Init)
0x4dc28a : E:\cpp\ufoai\ufo.exe : e:\cpp\ufoai/src/common/common.c (1105) : in function (Qcommon_Init)
0x53b433 : E:\cpp\ufoai\ufo.exe : e:\cpp\ufoai/src/ports/windows/win_main.c (149) : in function (WinMain@16)
0x53c676 : E:\cpp\ufoai\ufo.exe : main.c
0x4010db : E:\cpp\ufoai\ufo.exe : crt1.c
0x401158 : E:\cpp\ufoai\ufo.exe : crt1.c
Failed to init bfd from (C:\Windows\system32\kernel32.dll)
0x76d61194 : C:\Windows\system32\kernel32.dll : BaseThreadInitThunk
Failed to init bfd from (C:\Windows\SYSTEM32\ntdll.dll)
0x773ab495 : C:\Windows\SYSTEM32\ntdll.dll : RtlInitializeExceptionChain
Failed to init bfd from (C:\Windows\SYSTEM32\ntdll.dll)
0x773ab468 : C:\Windows\SYSTEM32\ntdll.dll : RtlInitializeExceptionChain
May it is helpful.
Regards
-
also see http://sourceforge.net/tracker/?func=detail&aid=3086573&group_id=157793&atid=805244
i've done the same - the problem is that bfd is missing in our mingw installation - so we can't provide cross-compiled binaries. that's why i haven't applied this yet. that must be fixed in mingw-cross-env first
-
I've included this lib in my new mingw
build it using this
http://ufoai.ninex.info/forum/index.php?action=dlattach;topic=5425.0;attach=5653
-
what was needed to build it? where did you get it? any special configure/make flags needed? tell me about this and i might be able to add this to mingw-cross-env to be able to provide cross-compile support for libfd
-
precompiled ;D
http://sourceforge.net/projects/mingw/files_beta/MinGW/BaseSystem/GNU-Binutils/binutils-2.20.51/
or
http://sourceforge.net/projects/mingw/files_beta/MSYS/binutils/binutils-2.19.51-3/
I'm using Mingw not msys lib
but http://sourceforge.net/projects/mingw/files/MSYS/binutils/binutils-2.19.51-3/binutils-2.19.51-3-msys-1.0.13-src.tar.lzma/download is more informative