From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22213 invoked by alias); 11 Aug 2010 03:21:43 -0000 Received: (qmail 22203 invoked by uid 22791); 11 Aug 2010 03:21:42 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: sourceware.org Received: from mail-wy0-f169.google.com (HELO mail-wy0-f169.google.com) (74.125.82.169) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 11 Aug 2010 03:21:37 +0000 Received: by wyg36 with SMTP id 36so13229429wyg.0 for ; Tue, 10 Aug 2010 20:21:35 -0700 (PDT) Received: by 10.216.5.79 with SMTP id 57mr4662294wek.93.1281496895261; Tue, 10 Aug 2010 20:21:35 -0700 (PDT) MIME-Version: 1.0 Received: by 10.216.186.205 with HTTP; Tue, 10 Aug 2010 20:21:14 -0700 (PDT) In-Reply-To: References: From: Hui Zhu Date: Wed, 11 Aug 2010 03:21:00 -0000 Message-ID: Subject: Re: [RFC] make gdb handle weak function better To: gdb@sourceware.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable 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: 2010-08/txt/msg00059.txt.bz2 Ping. On Thu, Aug 5, 2010 at 17:03, Hui Zhu wrote: > Hi, > > I meet following trouble: > cat 1.c > int > main () > { > =A0 =A0 =A0 =A0calloc (3, 1); > } > gcc -g 1.c > gdb ./a.out > (gdb) start > Temporary breakpoint 1 at 0x8048385: file 1.c, line 4. > Starting program: /home/teawater/gdb/bgdbno/gdb/a.out > > Temporary breakpoint 1, main () at 1.c:4 > 4 =A0 =A0 =A0 =A0 =A0 =A0 =A0 calloc (3, 1); > (gdb) b calloc > During symbol reading, incomplete CFI data; unspecified registers > (e.g., eax) at 0x8048382. > Breakpoint 2 at 0xb7ff82a6 > (gdb) info sharedlibrary > From =A0 =A0 =A0 =A0To =A0 =A0 =A0 =A0 =A0Syms Read =A0 Shared Object Lib= rary > 0xb7fe47f0 =A00xb7ff97df =A0Yes (*) =A0 =A0 /lib/ld-linux.so.2 > 0xb7e80230 =A00xb7f80ea4 =A0Yes (*) =A0 =A0 /lib/tls/i686/cmov/libc.so.6 > (*): Shared library is missing debugging information. > (gdb) c > Continuing. > > Program exited with code 010. > > The inferior is not break because gdb set breakpoint in the weak > function calloc in lib/ld-linux.so.2. > But the inferior call the calloc in /lib/tls/i686/cmov/libc.so.6. > > And I check the lookup_symbol and lookup_minimal_symbol, both of them > are return the first symbol that they found. > What about do some work on it? > > What I think is: > In lookup_symbol and lookup_minimal_symbol, when it get a weak symbol, > just record it but keep search. =A0When the search complete, if GDB get > a simple symbol then return it. =A0If GDB doesn't get a simple symbol. > Then return the weak symbol. > > BTW, looks minimal_symbol and symbol don't have interface access to > asymbol. =A0So I suggest we can extend "struct general_symbol_info" and > elf_symtab_read to make minimal_symbol and symbol have the weak > message. > > Thanks, > Hui >