From owner-freebsd-questions@FreeBSD.ORG Sun Jun 30 18:57:42 2013 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 22A6F569 for ; Sun, 30 Jun 2013 18:57:42 +0000 (UTC) (envelope-from fernando.apesteguia@gmail.com) Received: from mail-wi0-x22a.google.com (mail-wi0-x22a.google.com [IPv6:2a00:1450:400c:c05::22a]) by mx1.freebsd.org (Postfix) with ESMTP id 9708E18A9 for ; Sun, 30 Jun 2013 18:57:41 +0000 (UTC) Received: by mail-wi0-f170.google.com with SMTP id ey16so3382904wid.1 for ; Sun, 30 Jun 2013 11:57:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=J2MdREHEJ/LTMGBJmW9qwnKKLIf29CbJZPcZMkgtRmQ=; b=V9V0OQXTL+24L/7ea+OzwJC0ABL04x6l62n1E73uBO2iUUMf7vScQYOAnjl1j/jTG5 n8Jlj05Nk9ziFZrYn1UBPjaIJr0d+vtAxQ2Yh/GLkm64bDGLtlrwtFQ7yDM8hC8Amlge dHZR5Ok72Oqf1GA6Q8WzHXvuN0zGyaoBsmUiVweQ0IkoxL0sNCZ0UXngBPXgnFujEds5 UHxXB0/FeXkQl3o7ZMl4/5e/WpofMAQSnpaT2KchPQXk2ELdJDaGnBpeTgUo1GZ6yICy odegaaIZxt8VsOmOG7QqjmVO5rko8mE6XATa/cebO5AxZhCYJrcTEsk8w/gcmrcKoB1/ jqjA== MIME-Version: 1.0 X-Received: by 10.180.160.165 with SMTP id xl5mr10022044wib.46.1372618660567; Sun, 30 Jun 2013 11:57:40 -0700 (PDT) Received: by 10.180.189.65 with HTTP; Sun, 30 Jun 2013 11:57:40 -0700 (PDT) In-Reply-To: <51D063A6.8030908@passap.ru> References: <51D05099.8060001@passap.ru> <51D063A6.8030908@passap.ru> Date: Sun, 30 Jun 2013 20:57:40 +0200 Message-ID: Subject: Re: Debugging a crash From: =?ISO-8859-1?Q?Fernando_Apestegu=EDa?= To: Boris Samorodov Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.14 Cc: "freebsd-questions@freebsd.org" X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 30 Jun 2013 18:57:42 -0000 On Sun, Jun 30, 2013 at 6:58 PM, Boris Samorodov wrote: > 30.06.2013 19:53, Fernando Apestegu=C3=ADa =D0=BF=D0=B8=D1=88=D0=B5=D1=82= : > > On Sun, Jun 30, 2013 at 5:36 PM, Boris Samorodov wrote= : > > > >> Hi All, > >> > >> I get an application crashing. Build some libs with debug symbols. > >> Here is the gdb log: > >> ----- > >> Program received signal SIGSEGV, Segmentation fault. > >> [Switching to Thread 809806400 (LWP 101133/photoprint)] > >> strtol_l (nptr=3D0x0, endptr=3D0x0, base=3D10, locale=3D) > >> at /usr/src/lib/libc/stdlib/strtol.c:73 > >> 73 } while (isspace_l((unsigned char)c, locale)); > >> Current language: auto; currently minimal > >> (gdb) bt > >> #0 strtol_l (nptr=3D0x0, endptr=3D0x0, base=3D10, locale=3D > > > ^^^^ > > It seems you are passing a NULL str to strtol. > > OK. So how to proceed in debugging it? > Assuming you have the source code of the application, you could try to set a break point right before the call to strtol. Or you can also try to printf some message in the case the pointer you are passing equals to NULL and try to figure out why that pointer is NULL. Since one of the previous frames is called ps_parameters, I assume it is trying to do something either with the program arguments or the environment stored in ps_strings so maybe the program is not fault tolerant to an unexpected environment/arguments? Cheers. > > >> out>) at /usr/src/lib/libc/stdlib/strtol.c:73 > >> #1 0x00000008017d951c in ps_parameters (v=3D0x809d0dc00, name=3D0x809= 96c120 > >> "JCLBOXHOLDTYPE", description=3D0x7fffffffd0a8) at print-ps.c:380 > >> #2 0x00000008017996df in stp_describe_parameter (v=3D0x809d0dc00, > >> name=3D0x80996c120 "JCLBOXHOLDTYPE", description=3D0x7fffffffd0a8) at > >> print-vars.c:1687 > >> #3 0x000000000046cfd2 in ?? () > >> #4 0x00000000004627a1 in ?? () > >> #5 0x0000000000461da4 in ?? () > >> #6 0x00000000004657fe in ?? () > >> #7 0x0000000000422863 in ?? () > >> #8 0x0000000000421f45 in ?? () > >> #9 0x000000000041054f in ?? () > >> #10 0x0000000800719000 in ?? () > >> #11 0x0000000000000000 in ?? () > >> (gdb) fr 0 > >> #0 strtol_l (nptr=3D0x0, endptr=3D0x0, base=3D10, locale=3D >> out>) at /usr/src/lib/libc/stdlib/strtol.c:73 > >> 73 } while (isspace_l((unsigned char)c, locale)); > >> (gdb) fr 1 > >> #1 0x00000008017d951c in ps_parameters (v=3D0x809d0dc00, name=3D0x809= 96c120 > >> "JCLBOXHOLDTYPE", description=3D0x7fffffffd0a8) at print-ps.c:380 > >> 380 num_choices =3D atoi(stp_mxmlElementGetAttr(option, > >> "num_choices")); > >> (gdb) fr 2 > >> #2 0x00000008017996df in stp_describe_parameter (v=3D0x809d0dc00, > >> name=3D0x80996c120 "JCLBOXHOLDTYPE", description=3D0x7fffffffd0a8) at > >> print-vars.c:1687 > >> 1687 stp_printer_describe_parameter(v, name, description); > >> (gdb) > >> ----- > >> > >> How should I proceed with debugging? Thanks! > > -- > WBR, Boris Samorodov (bsam) > FreeBSD Committer, http://www.FreeBSD.org The Power To Serve >