lkcd
[Top] [All Lists]

RE: Alpha lkcd port: bzero problem

To: "'lkcd@xxxxxxxxxxx'" <lkcd@xxxxxxxxxxx>, "Hall, Brian" <Brianw.Hall@xxxxxxxxxx>
Subject: RE: Alpha lkcd port: bzero problem
From: "Jerry Feldman" <Gerry.Feldman@xxxxxxxxxx>
Date: Tue, 18 Apr 2000 16:07:58 -0400
Cc: clinux@xxxxxxxxxxx, "'lkcd@xxxxxxxxxxx'" <lkcd@xxxxxxxxxxx>
In-reply-to: <9996FB0C6AB3D111B9FB0000F81E38A20731EB66@lkgexc1.tay.dec.com>
Organization: eInfrastructure Partner Engineering
Sender: owner-lkcd@xxxxxxxxxxx
The problem here is with the bzero. First, as top stated, the pointer, klp 
is uninitialized. bzero attempts to write zeros to whatever klp points to for 
a length of sizeof(klib_t ). As Tom states in his reply, uncommenting the 
lines before and after will improve the situation. 

On 18 Apr 2000, at 15:50, Evans, Tom wrote:

> 
> Umm your arguments are invalid.
> From klib.c, allock_klib:
> 
> static klib_t *
> alloc_klib()
> {
>         klib_t *klp;
> 
> /*      if (klp = (klib_t *)malloc(sizeof(klib_t))) { */
>                 bzero(klp, sizeof(klib_t));
> /*      }*/
>         return(klp);
> }
> 
> 
> klp is a stack allocated pointer to a klib_t type, but that klib_t
> isn't allocated in the context of alloc_klib and was not passed
> into alloc_klib directly as an argument.
> 
> So, the klp points to junk (it wasn't initialized
> and will just be garbage that was on the stack, on other platforms,
> that stack junk might just happen to be the desired klib_t,
> but that would just be an artifact of the calling sequence).
> 
> I'm reasonably sure that bzero is fine, uncommenting the line before and
> after
> would probably help because then you would actually have a klib_t to
> initialize.
> 
> ...tom
> 
> -----Original Message-----
> From: Hall, Brian 
> Sent: Tuesday, April 18, 2000 3:23 PM
> To: lkcd@xxxxxxxxxxx
> Cc: axp-list@xxxxxxxxxx; clinux@xxxxxxxxxxx
> Subject: Alpha lkcd port: bzero problem
> 
> 
> I have made my attempt at integrating the Alpha debugger from gdb-4.1.8 into
> lcrash. However, now when I run lcrash (directly at the command line or via
> a
> real crash), I get this in gdb:
> 
> Starting program: /CDR_UPLOAD/hallb/linux-2.2.13-1.0.3/cmd/lcrash/./lcrash
> map = /boot/System.map, vmdump = /dev/mem, outfile = stdout
>  
> Please wait...
> Program received signal SIGSEGV, Segmentation fault.
> __bzero () at ../sysdeps/alpha/bzero.S:107
> 107     ../sysdeps/alpha/bzero.S: No such file or directory.
> Current language:  auto; currently asm
> (gdb) where
> #0  __bzero () at ../sysdeps/alpha/bzero.S:107
> #1  0x12002b7e8 in alloc_klib () at klib.c:191
> #2  0x12002b8f0 in kl_init_klib (map=0x120164c30 "/boot/System.map",
> vmdump=0x120164f30 "/dev/mem", namelist=0x120164d30 "",
>     flags=0) at klib.c:220
> #3  0x1200029b0 in main (argc=1, argv=0x11ffffc28) at main.c:182   
> 
> 
> 
> From klib.c, allock_klib:
> 
> static klib_t *
> alloc_klib()
> {
>         klib_t *klp;
> 
> /*      if (klp = (klib_t *)malloc(sizeof(klib_t))) { */
>                 bzero(klp, sizeof(klib_t));
> /*      }*/
>         return(klp);
> }
> 
> Does bzero work correctly on Alpha? Or are my arguments invalid?
> 
> 
> -- 
> http://www.bigfoot.com/~brihall
> Linux Consultant
> 
> **********************************************************
> To unsubscribe from this list, send mail to
> majordomo@xxxxxxxxxxx with the following text in the
> *body* (*not* the subject line) of the letter:
> unsubscribe clinux
> **********************************************************
> 
> **********************************************************
> To unsubscribe from this list, send mail to
> majordomo@xxxxxxxxxxx with the following text in the
> *body* (*not* the subject line) of the letter:
> unsubscribe clinux
> **********************************************************


--
Jerry Feldman
Contractor, eInfrastructure Partner Engineering   
508-467-4315 http://www.testdrive.compaq.com/linux/

Compaq Computer Corp.
200 Forest Street MRO1-3/F1
Marlboro, Ma. 01752

<Prev in Thread] Current Thread [Next in Thread>