From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21549 invoked by alias); 18 Apr 2009 05:19:12 -0000 Received: (qmail 21535 invoked by uid 22791); 18 Apr 2009 05:19:10 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL,BAYES_00,SARE_MSGID_LONG40,SPF_PASS X-Spam-Check-By: sourceware.org Received: from smtp-out.google.com (HELO smtp-out.google.com) (216.239.33.17) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 18 Apr 2009 05:19:05 +0000 Received: from zps36.corp.google.com (zps36.corp.google.com [172.25.146.36]) by smtp-out.google.com with ESMTP id n3I5J0NO022424 for ; Sat, 18 Apr 2009 06:19:01 +0100 Received: from qw-out-1920.google.com (qwk4.prod.google.com [10.241.195.132]) by zps36.corp.google.com with ESMTP id n3I5Ixdx025740 for ; Fri, 17 Apr 2009 22:18:59 -0700 Received: by qw-out-1920.google.com with SMTP id 4so60039qwk.44 for ; Fri, 17 Apr 2009 22:18:58 -0700 (PDT) MIME-Version: 1.0 Received: by 10.224.6.147 with SMTP id 19mr4645893qaz.213.1240031938866; Fri, 17 Apr 2009 22:18:58 -0700 (PDT) In-Reply-To: <49E949EC.5020700@globalherald.net> References: <49E949EC.5020700@globalherald.net> Date: Sat, 18 Apr 2009 07:56:00 -0000 Message-ID: <8ac60eac0904172218r319f4ca7u3857f14e14150bda@mail.gmail.com> Subject: Re: GDB Hopelessly broken (CentOS 5.2, debugging Apache QPid) From: Paul Pluzhnikov To: Joshua Kramer Cc: gdb@sourceware.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-System-Of-Record: true 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-04/txt/msg00148.txt.bz2 On Fri, Apr 17, 2009 at 8:33 PM, Joshua Kramer wrot= e: > Hello Everyone, > > I'm having some really bizarre problems debugging Apache Qpid under CentOS > 5.2, and I'm wondering if anyone can shed some light on this. =A0The > application is compiled with -ggdb and no optimization (the -O2 specified= in > the makefile was removed). > > GDB (as supplied by the OS) is exhibiting odd behavior. =A0First, I keep > getting the error about the source files being newer than the executable, > even though: > > 1. I have manually deleted all object files and executables, then ran mak= e, > and > 2. I verified that the executable is 30 minutes newer than any source fil= e. > > Next, it appears that some code does not get compiled. =A0If I set a > breakpoint on line 335 of a certain file, it does not stop until line 339. > =A0Also, some variables do not get declared. =A0In the code example shown= below, > the seContext variable is never declared - that is, if I set the breakpoi= nt > on lines directly after I assign something to that variable, when gdb sto= ps > and I enter the command 'print seContext', gdb replies that there is no > seContext in this scope. > > Are these things a result of unseen compiler optimizations? =A0Any help is > greatly appreciated. The most likely cause is a "pilot error". Are you debugging the binary you just rebuilt? How do you invoke GDB? All the symptoms you've listed are consistent with you debugging some *other* optimized binary. > Thanks! > -Joshua Kramer > > (gdb) list > /home/josh/dev/qpid/trunk/qpid/cpp/src/qpid/broker/SessionAdapter.cpp:325 > 320 > 321 =A0 =A0 void SessionAdapter::QueueHandlerImpl::declare(const string& = name, > const string& alternateExchange, > 322 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0bool passive, bool > durable, bool exclusive, > 323 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0bool autoDelete, > const qpid::framing::FieldTable& arguments) > 324 =A0 =A0 { > 325 =A0 =A0 =A0 =A0 AclModule* acl =3D getBroker().getAcl(); > 326 =A0 =A0 =A0 =A0327 =A0 =A0 =A0 =A0 std::string seContext; > 328 =A0 =A0 =A0 =A0 //if (arguments.isSet("secontext")) > 329 =A0 =A0 =A0 =A0 { > > (gdb) list > /home/josh/dev/qpid/trunk/qpid/cpp/src/qpid/broker/SessionAdapter.cpp:343 > 338 =A0 =A0 =A0 =A0 =A0 =A0 params.insert(make_pair(acl::PROP_EXCLUSIVE, > std::string(exclusive ? "true" : "false"))); > 339 =A0 =A0 =A0 =A0 =A0 =A0 params.insert(make_pair(acl::PROP_AUTODELETE, > std::string(autoDelete ? "true" : "false"))); > 340 =A0 =A0 =A0 =A0 =A0 =A0341 =A0 =A0 =A0 =A0 =A0 =A0 // JPK: Create som= e parameters from the > arguments. > 342 =A0 =A0 =A0 =A0 =A0 =A0343 =A0 =A0 =A0 =A0 =A0 =A0 //if (arguments.is= Set("secontext")) > 344 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 { > 345 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 seContext =3D arguments.getAs= String("secontext"); > 346 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 params.insert(make_pair(acl::= PROP_SECONTEXT, > seContext)); > 347 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 } > (gdb) > > --=20 Paul Pluzhnikov