aMule Forum
English => Backtraces => Topic started by: chance2105 on March 03, 2005, 02:29:08 AM
-
I have a crash on startup with aMule-cvs-20050302 -- this is Gentoo Linux on SPARC. I don't get anywhere with the program, it runs and crashes right off of the bat.
Initialising aMule
Saving userhash: 676EEEAEFC0E4D23A3BD135963506F62
Program received signal SIGBUS, Bus error.
0x002a05f0 in md4cpy (dst=0xefffea11, src=0x69a084) at OtherFunctions.h:293
293 ((uint32*)dst)[0] = ((uint32*)src)[0];
(gdb) bt
#0 0x002a05f0 in md4cpy (dst=0xefffea11, src=0x69a084) at OtherFunctions.h:293
#1 0x002d8bb4 in CPreferences::Save (this=0x6e0978) at Preferences.cpp:1055
#2 0x002d8a18 in CPreferences::SetStandartValues (this=0x6e0978)
at Preferences.cpp:1033
#3 0x002d0814 in CPreferences (this=0x6e0978) at Preferences.cpp:596
#4 0x003734b0 in CamuleApp::OnInit (this=0x6dabe0) at amule.cpp:522
#5 0x0037f638 in CamuleGuiApp::OnInit (this=0x6dabe0) at amule-gui.cpp:333
#6 0x702d7b58 in wxEntry () from /usr/lib/libwx_gtk-2.4.so
#7 0x0037eba0 in main (argc=1, argv=0xeffff464) at amule-gui.cpp:149
(gdb) bt full
#0 0x002a05f0 in md4cpy (dst=0xefffea11, src=0x69a084) at OtherFunctions.h:293
No locals.
#1 0x002d8bb4 in CPreferences::Save (this=0x6e0978) at Preferences.cpp:1055
prefsExt = {version = 20 '\024', userhash = '\0' ,
EmuleWindowPlacement = {length = 0, flags = 0, showCmd = 0, ptMinPosition = {
x = 0, y = 0}, ptMaxPosition = {x = 0, y = 0}, rcNormalPosition = {
left = 0, top = 0, right = 0, bottom = 0}}}
read = -1152944970361995264
fullpath =
error = false
preffile = {_vptr.CFile = 0x3fdf50, m_fd = 10, m_error = false,
fFilePath = }
shareddir =
sdirfile =
#2 0x002d8a18 in CPreferences::SetStandartValues (this=0x6e0978)
at Preferences.cpp:1033
defaultWPM = {length = 44, flags = 0, showCmd = 0, ptMinPosition = {
x = 0, y = 1109808101}, ptMaxPosition = {x = 1, y = 0},
rcNormalPosition = {left = 10, top = 10, right = 700, bottom = 500}}
#3 0x002d0814 in CPreferences (this=0x6e0978) at Preferences.cpp:596
prefsExt = {version = 0 '\0', userhash = '\0' ,
EmuleWindowPlacement = {length = 0, flags = 0, showCmd = 0, ptMinPosition = {
x = 0, y = 0}, ptMaxPosition = {x = 0, y = 0}, rcNormalPosition = {
left = 0, top = 0, right = 0, bottom = 0}}}
read = 0
fullpath =
preffile = {_vptr.CFile = 0x3fdf50, m_fd = 9, m_error = false,
fFilePath = }
sdirfile =
slistfile =
#4 0x003734b0 in CamuleApp::OnInit (this=0x6dabe0) at amule.cpp:522
cmdline =
geometry_enabled = false
geom_string =
server =
host =
IPC =
client = (struct wxTCPClient *) 0x6da660
conn = (struct wxConnectionBase *) 0x0
lMulePrefDir =
xMulePrefDir =
vfile =
newMule =
mnt_tab = (FILE *) 0x4400
msg =
ok = true
#5 0x0037f638 in CamuleGuiApp::OnInit (this=0x6dabe0) at amule-gui.cpp:333
No locals.
#6 0x702d7b58 in wxEntry () from /usr/lib/libwx_gtk-2.4.so
No symbol table info available.
#7 0x0037eba0 in main (argc=1, argv=0xeffff464) at amule-gui.cpp:149
No locals.
-
I am more than willing to help fixing the sparc issues, because we want to support as much arch and distros, and OS, and everything we can. This backtrace seems interesting, which is the standard way to check to sparc at compile time, codewise? #ifdef __SPARC__?
-
On my box, "__sparc__" is defined, so yeah:
#ifdef __sparc__
// blah blah
#endif
-
Seems that SPARC disallows unaligned access. We could probably catch most of it if not all by adding the flag "-Wcast-align" when debug is enabled. Doing a quick test.
-
Oh wait, it seems to only produce said errors on machines where it's actually illegal ... by any chance, could you recompile aMule with the CXXFLAG="-Wcast-align" and paste the output from std-err here?
-
Seems that SPARC disallows unaligned access.
Of cause it disallows ! Like all risc machines I know about. You can't just take any number, cast it to pointer and dereterence.
-
Originally posted by lfroen
Seems that SPARC disallows unaligned access.
Of cause it disallows ! Like all risc machines I know about. You can't just take any number, cast it to pointer and dereterence.
Hey, it's not my fault that I'm an IA32 kind of guy. :P
-
Hey, it's not my fault that I'm an IA32 kind of guy
I didn't say about someone's fault. As a matter of fact, md4cpy works ok on my sparc: UltraSPARC-IIi-Engine. Take a look at this:
#include
typedef unsigned long uint32;
inline void md4cpy(const void* dst, const void* src) {
((uint32*)dst)[0] = ((uint32*)src)[0];
((uint32*)dst)[1] = ((uint32*)src)[1];
((uint32*)dst)[2] = ((uint32*)src)[2];
((uint32*)dst)[3] = ((uint32*)src)[3];
}
int main()
{
printf("sizeof(uint32) = %d\n", sizeof(uint32));
unsigned char src[32], dst[32];
md4cpy(&dst[1], &src[1]);
return 0;
}
In Sparc:
./test
sizeof(uint32) = 4
Bus error (core dumped)
Code is ok, but alignment is NOT ! So, compiler flags will not help here - you just can't do it on Sparc. Replace [1] with
-
We know, lfroen :) And btw, if you have a sparc, how come you never tested aMule on it?
-
Working on it.
I'll commit a set of improved Peek/Poke function for direct access to bytestreams ASAP. I've changed all the occurrences of (someint*)somechararray I could find, but I've probably missed some, so lfroen, if you can compile aMule with that CXXFlag and report any remaining warnings after I've committed, it would be great.
-
Committed.
-
chance2105, is there any chance you could get on IRC? #amule @ irc.freenode.org