Date: Sat, 17 Feb 2007 12:51:34 +0100 From: Michael Nottebrock <lofi@freebsd.org> To: Rink Springer <rink@freebsd.org> Cc: freebsd-stable@freebsd.org Subject: Re: sysctl segfaulting Message-ID: <200702171251.35639.lofi@freebsd.org> In-Reply-To: <20070217103904.GB91175@rink.nu> References: <200702170947.49001.lofi@freebsd.org> <200702171136.50919.lofi@freebsd.org> <20070217103904.GB91175@rink.nu>
next in thread | previous in thread | raw e-mail | index | archive | help
--nextPart5057270.5JxiCZcNEm Content-Type: text/plain; charset="iso-8859-6" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline On Saturday, 17. February 2007 11:39, Rink Springer wrote: > Hi Michael, > > On Sat, Feb 17, 2007 at 11:36:46AM +0100, Michael Nottebrock wrote: > > So I tried recompiling libc with debug cflags ("-g3 -O -pipe"), but this > > only makes the backtrace in gdb much longer, but still without any > > function names. > > Hmm, 'make install' appears to strip the debugging info. Duh, I keep forgetting that. > Please try=20 > gdb-ing /usr/obj/usr/src/sbin/sysctl/sysctl instead (assuming you use > default the /usr/obj path like I do) I recompiled/reinstalled both sysctl and libc with CFLAGS=3D-g3 and STRIP= =3D"" and=20 now I get: [lofi@lofi]:0:~ > gdb /sbin/sysctl GNU gdb 6.1.1 [FreeBSD] Copyright 2004 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain condition= s. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "i386-marcel-freebsd"... (gdb) set args kern.clockrate (gdb) run Starting program: /sbin/sysctl kern.clockrate kern.clockrate: Program received signal SIGSEGV, Segmentation fault. 0x08049696 in S_clockinfo (l2=3D20, p=3D0x804e000)=20 at /usr/src/sbin/sysctl/sysctl.c:333 333 printf(hflag ? "{ hz =3D %'d, tick =3D %'d, profhz =3D %'d,= stathz=20 =3D %'d }" : (gdb) bt #0 0x08049696 in S_clockinfo (l2=3D20, p=3D0x804e000) at /usr/src/sbin/sysctl/sysctl.c:333 #1 0x0804a5f2 in show_var (oid=3D0xbfbfea80, nlen=3D2) at /usr/src/sbin/sysctl/sysctl.c:690 #2 0x08049093 in parse (string=3D0xbfbfecb1 "kern.clockrate") at /usr/src/sbin/sysctl/sysctl.c:208 #3 0x08048e77 in main (argc=3D0, argv=3D0xbfbfeba0)=20 at /usr/src/sbin/sysctl/sysctl.c:152 (gdb) list 328 struct clockinfo *ci =3D (struct clockinfo*)p; 329 if (l2 !=3D sizeof(*ci)) { 330 warnx("S_clockinfo %d !=3D %d", l2, sizeof(*ci)); 331 return (0); 332 } 333 printf(hflag ? "{ hz =3D %'d, tick =3D %'d, profhz =3D %'d,= stathz=20 =3D %'d }" : 334 "{ hz =3D %d, tick =3D %d, profhz =3D %d, stathz = =3D %d }", 335 ci->hz, ci->tick, ci->profhz, ci->stathz); 336 return (0); 337 } (gdb) print ci->hz Error accessing memory address 0x804e000: Bad address. (gdb) print ci->tick Error accessing memory address 0x804e004: Bad address. (gdb) print ci->profhz Error accessing memory address 0x804e010: Bad address. (gdb) print ci->stathz Error accessing memory address 0x804e00c: Bad address. (gdb) print ci $1 =3D (struct clockinfo *) 0x804e000 (gdb) print p $2 =3D (void *) 0x804e000 (gdb) print l2 $3 =3D 20 =2D-=20 ,_, | Michael Nottebrock | lofi@freebsd.org (/^ ^\) | FreeBSD - The Power to Serve | http://www.freebsd.org \u/ | K Desktop Environment on FreeBSD | http://freebsd.kde.org --nextPart5057270.5JxiCZcNEm Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (FreeBSD) iD8DBQBF1uxHXhc68WspdLARAkkLAJ0YMd3Skwnlzt+uDpG4eoeOCoAljwCggIAC Rqd8CxgUTejj085rWzNYTXM= =1ROe -----END PGP SIGNATURE----- --nextPart5057270.5JxiCZcNEm--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200702171251.35639.lofi>