From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7483 invoked by alias); 5 Aug 2010 09:04:11 -0000 Received: (qmail 7373 invoked by uid 22791); 5 Aug 2010 09:04:09 -0000 X-SWARE-Spam-Status: No, hits=-1.7 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-ww0-f43.google.com (HELO mail-ww0-f43.google.com) (74.125.82.43) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 05 Aug 2010 09:04:05 +0000 Received: by wwb22 with SMTP id 22so1886614wwb.12 for ; Thu, 05 Aug 2010 02:04:03 -0700 (PDT) Received: by 10.216.88.204 with SMTP id a54mr1778998wef.30.1280999043019; Thu, 05 Aug 2010 02:04:03 -0700 (PDT) MIME-Version: 1.0 Received: by 10.216.186.205 with HTTP; Thu, 5 Aug 2010 02:03:42 -0700 (PDT) From: Hui Zhu Date: Thu, 05 Aug 2010 09:04:00 -0000 Message-ID: Subject: [RFC] make gdb handle weak function better To: gdb@sourceware.org Content-Type: text/plain; charset=ISO-8859-1 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/msg00037.txt.bz2 Hi, I meet following trouble: cat 1.c int main () { calloc (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 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 To Syms Read Shared Object Library 0xb7fe47f0 0xb7ff97df Yes (*) /lib/ld-linux.so.2 0xb7e80230 0xb7f80ea4 Yes (*) /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. When the search complete, if GDB get a simple symbol then return it. If 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. So 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