From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2119 invoked by alias); 20 Apr 2009 23:40:06 -0000 Received: (qmail 2109 invoked by uid 22791); 20 Apr 2009 23:40:05 -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.45.13) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 20 Apr 2009 23:40:00 +0000 Received: from wpaz21.hot.corp.google.com (wpaz21.hot.corp.google.com [172.24.198.85]) by smtp-out.google.com with ESMTP id n3KNdwJl012025 for ; Mon, 20 Apr 2009 16:39:58 -0700 Received: from qyk11 (qyk11.prod.google.com [10.241.83.139]) by wpaz21.hot.corp.google.com with ESMTP id n3KNduPt027570 for ; Mon, 20 Apr 2009 16:39:57 -0700 Received: by qyk11 with SMTP id 11so460928qyk.32 for ; Mon, 20 Apr 2009 16:39:56 -0700 (PDT) MIME-Version: 1.0 Received: by 10.229.110.16 with SMTP id l16mr735529qcp.92.1240270796568; Mon, 20 Apr 2009 16:39:56 -0700 (PDT) In-Reply-To: <592922.54823.qm@web52001.mail.re2.yahoo.com> References: <592922.54823.qm@web52001.mail.re2.yahoo.com> Date: Mon, 20 Apr 2009 23:48:00 -0000 Message-ID: <8ac60eac0904201639r19f7d539v2b301fcb24e82317@mail.gmail.com> Subject: Re: GDB using a lot of CPU time and writing a lot to disk on startup From: Paul Pluzhnikov To: Nick Savoiu 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/msg00162.txt.bz2 On Mon, Apr 20, 2009 at 3:40 PM, Nick Savoiu wrote: > I'm using GDB 6.8 (x86_64-unknown-linux-gnu) from within KDevelop > 3.5.4. I've noticed that for some projects GDB uses 1 minute of CPU time > and seems to do a lot of disk writing during this time. AFAIU, GDB doesn't write anything to disk (unless you ask it to with gcore that is). I don't see anything in your message which would substantiate your claim of disk writing either. How did you come to conclusion that GDB writes anything to disk? > =A0PID USER =A0 =A0 =A0PR =A0NI =A0VIRT =A0RES =A0SHR S %CPU %MEM =A0 =A0= TIME+ =A0COMMAND > =A03439 nsavoiu =A0 16 =A0 0 =A0600m 589m 2536 S =A0 =A00 15.2 =A0 1:13.6= 4 gdb > > I can't really figure out why this is happening and could use some help t= racking it down. > > I used pstack every second until the debugging actually starts and here > are all the unique #0 locations in the pstack output. > > #0 =A00x0000000000446d16 in msymbol_hash_iw () > #0 =A00x0000000000446f97 in lookup_minimal_symbol () > #0 =A00x00000000004bfda0 in symbol_natural_name () > #0 =A00x00000000004bffe4 in find_pc_sect_psymtab () > #0 =A00x00000000004c0118 in find_pc_sect_psymbol () > #0 =A00x00000000004fd755 in bcache_data () > #0 =A00x000000000050d11a in dwarf2_lookup_abbrev () > #0 =A00x0000000000610c67 in d_print_comp () > #0 =A00x00000035aae28250 in __ctype_b_loc () from /lib64/tls/libc.so.6 > #0 =A00x00000035aae68ced in _int_free () from /lib64/tls/libc.so.6 > #0 =A00x00000035aaeb94a5 in _xstat () from /lib64/tls/libc.so.6 > #0 =A00x00000035aaeb9545 in _lxstat () from /lib64/tls/libc.so.6 > #0 =A00x00000035aaeb9832 in __open_nocancel () from /lib64/tls/libc.so.6 > #0 =A00x00000035aaebe18f in poll () from /lib64/tls/libc.so.6 This output is bogus. It sounds like your GDB is compiled with -fomit-frame-pointers (default on x86_64 with optimization), and pstack doesn't know how to unwind stack for such code. Does your inferior program (the one you are debugging) have many (as in thousands) of shared libraries? If so, you might want to watch this thread: http://sourceware.org/ml/gdb-patches/2009-04/msg00548.html If not, you may want to build GDB from source with 'CFLAGS =3D -g -pg -O0',= run it on your inferior program, and collect the resulting profile with gprof. --=20 Paul Pluzhnikov