aMule Forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

We're back! (IN POG FORM)

Author Topic: Backtrace: Crash on Sparc / Gentoo Linux  (Read 4261 times)

chance2105

  • Newbie
  • Karma: 0
  • Offline Offline
  • Posts: 2
    • http://chance.freeshell.org/
Backtrace: Crash on Sparc / Gentoo Linux
« 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.


Code: [Select]
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.
Logged

Kry

  • Ex-developer
  • Retired admin
  • Hero Member
  • *****
  • Karma: -665
  • Offline Offline
  • Posts: 5795
Re: Backtrace: Crash on Sparc / Gentoo Linux
« Reply #1 on: March 03, 2005, 02:43:11 AM »

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__?
Logged

chance2105

  • Newbie
  • Karma: 0
  • Offline Offline
  • Posts: 2
    • http://chance.freeshell.org/
Re: Backtrace: Crash on Sparc / Gentoo Linux
« Reply #2 on: March 03, 2005, 06:14:15 AM »

On my box, "__sparc__" is defined, so yeah:

Code: [Select]
#ifdef __sparc__
// blah blah
#endif
Logged

Xaignar

  • Admin and Code Junky
  • Hero Member
  • *****
  • Karma: 19
  • Offline Offline
  • Posts: 1103
Re: Backtrace: Crash on Sparc / Gentoo Linux
« Reply #3 on: March 03, 2005, 09:49:21 AM »

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.
Logged

Xaignar

  • Admin and Code Junky
  • Hero Member
  • *****
  • Karma: 19
  • Offline Offline
  • Posts: 1103
Re: Backtrace: Crash on Sparc / Gentoo Linux
« Reply #4 on: March 03, 2005, 10:04:37 AM »

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?
Logged

lfroen

  • Guest
Re: Backtrace: Crash on Sparc / Gentoo Linux
« Reply #5 on: March 03, 2005, 12:11:43 PM »

Quote
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.
Logged

Xaignar

  • Admin and Code Junky
  • Hero Member
  • *****
  • Karma: 19
  • Offline Offline
  • Posts: 1103
Re: Backtrace: Crash on Sparc / Gentoo Linux
« Reply #6 on: March 03, 2005, 02:18:24 PM »

Quote
Originally posted by lfroen
Quote
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
Logged

lfroen

  • Guest
Re: Backtrace: Crash on Sparc / Gentoo Linux
« Reply #7 on: March 03, 2005, 03:10:02 PM »

Quote
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:
Code: [Select]
#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
  • - and it works.
Logged

Kry

  • Ex-developer
  • Retired admin
  • Hero Member
  • *****
  • Karma: -665
  • Offline Offline
  • Posts: 5795
Re: Backtrace: Crash on Sparc / Gentoo Linux
« Reply #8 on: March 03, 2005, 03:32:20 PM »

We know, lfroen :) And btw, if you have a sparc, how come you never tested aMule on it?
Logged

Xaignar

  • Admin and Code Junky
  • Hero Member
  • *****
  • Karma: 19
  • Offline Offline
  • Posts: 1103
Re: Backtrace: Crash on Sparc / Gentoo Linux
« Reply #9 on: March 03, 2005, 06:34:32 PM »

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.
Logged

Xaignar

  • Admin and Code Junky
  • Hero Member
  • *****
  • Karma: 19
  • Offline Offline
  • Posts: 1103
Re: Backtrace: Crash on Sparc / Gentoo Linux
« Reply #10 on: March 03, 2005, 06:48:01 PM »

Committed.
Logged

Xaignar

  • Admin and Code Junky
  • Hero Member
  • *****
  • Karma: 19
  • Offline Offline
  • Posts: 1103
Re: Backtrace: Crash on Sparc / Gentoo Linux
« Reply #11 on: March 03, 2005, 07:42:43 PM »

chance2105, is there any chance you could get on IRC? #amule @ irc.freenode.org
Logged