From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29978 invoked by alias); 11 May 2009 17:21:38 -0000 Received: (qmail 29969 invoked by uid 22791); 11 May 2009 17:21:38 -0000 X-SWARE-Spam-Status: No, hits=-1.2 required=5.0 tests=AWL,BAYES_00,MIME_CHARSET_FARAWAY X-Spam-Check-By: sourceware.org Received: from smtp-outbound-1.vmware.com (HELO smtp-outbound-1.vmware.com) (65.115.85.69) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 11 May 2009 17:21:33 +0000 Received: from jupiter.vmware.com (mailhost5.vmware.com [10.16.68.131]) by smtp-outbound-1.vmware.com (Postfix) with ESMTP id 6A64613466; Mon, 11 May 2009 10:21:30 -0700 (PDT) Received: from [10.20.94.141] (msnyder-server.eng.vmware.com [10.20.94.141]) by jupiter.vmware.com (Postfix) with ESMTP id 61F1DDC4FA; Mon, 11 May 2009 10:21:30 -0700 (PDT) Message-ID: <4A085EDE.3060803@vmware.com> Date: Mon, 11 May 2009 17:21:00 -0000 From: Michael Snyder User-Agent: Thunderbird 1.5.0.12 (X11/20080411) MIME-Version: 1.0 To: =?Big5?B?qfrEsQ==?= CC: "gdb@sourceware.org" Subject: Re: how to debug this error by gdb? References: <6a8fced30905101934j2aa94d27i210484a99a523ce5@mail.gmail.com> In-Reply-To: <6a8fced30905101934j2aa94d27i210484a99a523ce5@mail.gmail.com> Content-Type: text/plain; charset=Big5 Content-Transfer-Encoding: 8bit X-IsSubscribed: yes Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2009-05/txt/msg00062.txt.bz2 ©úı wrote: > I'm debugging a application, for it crashes at line 660 of file > glxcmds.c, which is a file of mesa-7.4.1 > here is the source code at which it crashes: > --------------------------------------------------------------------------------------- > PUBLIC void glXWaitX(void) > { > ...... > if (psc->driScreen->waitX != NULL) > [line 660] (*psc->driScreen->waitX)(pdraw); > ..... > } > --------------------------------------------------------------------------------------- > > > and here is the gdb info: > --------------------------------------------------------------------------------------- > (gdb) break glxcmds.c:660 > Breakpoint 1 (glxcmds.c:660) pending. > (gdb) run > Breakpoint 1, glXWaitX () at glxcmds.c:660 > (gdb) print psc->driScreen->waitX > $3 = (void (*)(__GLXDRIdrawable *)) 0x47206769666e6f63 > (gdb) print *psc->driScreen->waitX > Cannot access memory at address > (gdb) step > Program received signal SIGSEGV, Segmentation fault. > --------------------------------------------------------------------------------------- First you need to "print psc", to see if that pointer is valid. Then print psc->driScreen, to see if that pointer is valid. Only then can you examine something pointed to by psc->driScreen.