[Klone-users] klone segfaults
Mark Richards
mark.richards at massmicro.com
Mon Feb 11 16:53:27 EST 2008
thomas fossati wrote:
> Hi Mark,
>
> On Feb 10, 2008, at 8:23 PM, Mark Richards wrote:
>>
>> When my index.kl1 starts and hits this code it segfaults:
>>
>> # kloned (pid 792) segfaults for page address 00082000 at pc 00097198
>
> could you please take a look at what's actually happening at pc 00097198
> (via objdump) ? Perhaps it's just a matter of uninitialized memory.
>
> In this regard you could also do something like "struct _sysinfo
> *sysinfo = NULL;" in the library code and then request explicit
> initialization by the callers - i.e. "if
sysinfo == NULL) dbg_err_if
> (_sysinfo_init(&sysinfo));" or similar ...
>
> ciao, t.
>
>
Hi Thomas,
This may quickly devolve into a discussion best put to lang.c :)
It's been quite some time since I've debugged assembler ):} but I
managed to get a dump (opposed to taking one).
If you might suggest a method of linking in with symbols, I can then see
what source is involved.
Here's where it blows:
kloned (pid 834) segfaults for page address 00000000 at pc 000973ac
97308: 6f9e b4bf 0d00 move.d 0xdbfb4,$r9
9730e: ee9b move.d $r9,[$sp]
97310: 4f9c 6f00 movu.b 0x6f,$r9
97314: 04e1 e99b move.d $r9,[$sp+4]
97318: 6f9e f0bf 0d00 move.d 0xdbff0,$r9
9731e: 08e1 e99b move.d $r9,[$sp+8]
97322: 6f9e fcbf 0d00 move.d 0xdbffc,$r9
97328: 0ce1 e99b move.d $r9,[$sp+12]
9732c: 6f9e e8c0 0d00 move.d 0xdc0e8,$r9
97332: 10e1 e99b move.d $r9,[$sp+16]
97336: 7f0d 6c77 0e00 6aaa move.d [0xe776c],$r10
9733e: 47b2 moveq 7,$r11
97340: 41c2 moveq 1,$r12
97342: 7d86 clear.d $r13
97344: 3fbd 6cc6 0b00 jsr 0xbc66c
9734a: 7f0d 8c7f 0e00 6aaa move.d [0xe7f8c],$r10
97352: 6fbe 20c1 0d00 move.d 0xdc120,$r11
97358: 3fbd 3a4f 0900 jsr 0x94f3a
9735e: 7f0d 8c7f 0e00 6aaa move.d [0xe7f8c],$r10
97366: 3fbd 5c6c 0b00 jsr 0xb6c5c
9736c: 4192 moveq 1,$r9
9736e: 5f8d 76df e99b move.d $r9,[$r8-8330]
97374: 4fac 3200 movu.b 0x32,$r10
97378: 3fbd 141c 0800 jsr 0x81c14
9737e: 6a96 move.d $r10,$r9
97380: 5f8d 06df e99b move.d $r9,[$r8-8442]
97386: 5f8d 06df 6aaa move.d [$r8-8442],$r10
9738c: 4fbc 3200 movu.b 0x32,$r11
97390: 6fce fcbf 0d00 move.d 0xdbffc,$r12
97396: 6fde 2cc1 0d00 move.d 0xdc12c,$r13
9739c: 3fbd b822 0800 jsr 0x822b8
973a2: 5f8d 0adf 699a move.d [$r8-8438],$r9
973a8: 1491 a00b test.d [$r9+20]
-->> 973ac: 3430 beq 0x973e2 <<--
973ae: 0f05 nop
973b0: 7f0d 8c7f 0e00 6aaa move.d [0xe7f8c],$r10
973b8: 6fbe 38c1 0d00 move.d 0xdc138,$r11
973be: 3fbd 3a4f 0900 jsr 0x94f3a
973c4: 6fae 2cc1 0d00 move.d 0xdc12c,$r10
973ca: 47b2 moveq 7,$r11
973cc: 3fbd 0823 0800 jsr 0x82308
973d2: 6fae 48c1 0d00 move.d 0xdc148,$r10
973d8: 3fbd ac1f 0800 jsr 0x81fac
973de: 24e0 ba 0x97404
973e0: 0f05 nop
973e2: 7f0d 8c7f 0e00 6aaa move.d [0xe7f8c],$r10
973ea: 6fbe 38c1 0d00 move.d 0xdc138,$r11
973f0: 3fbd 3a4f 0900 jsr 0x94f3a
973f6: 6fae 2cc1 0d00 move.d 0xdc12c,$r10
973fc: 46b2 moveq 6,$r11
All this said... I managed to solve the problem (although I still don't
know exactly what's going on) by doing this in my master shared library:
struct _sysinfo
{
...
} sysinfo;
rather than
struct _sysinfo sysinfo;
This assures me that sysinfo will be global (it's instantiated at the
top of my master shared library code).
I was incorrect when I stated that the code wasn't breaking in my other
apps. Actually, in my other apps, I am not directly accessing a member
of the structure (only in my Klone app was I attempting this). Instead,
I use public functions in the master shared library to do the job.
Is it correct that, should two apps run and each accesses sysinfo, they
will have separate copies of memory containing the structure and
therefore not clobber one another? Seems to me there's a way to
establish shared memory between apps (never had a need for this) and
perhaps I have stumbled into this hole?
/m
More information about the klone-users
mailing list