From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2351 invoked by alias); 3 Aug 2010 08:49:00 -0000 Received: (qmail 2334 invoked by uid 22791); 3 Aug 2010 08:48:59 -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,TW_BJ 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; Tue, 03 Aug 2010 08:48:52 +0000 Received: by wyg36 with SMTP id 36so4564425wyg.0 for ; Tue, 03 Aug 2010 01:48:50 -0700 (PDT) Received: by 10.216.19.203 with SMTP id n53mr2668354wen.21.1280825330349; Tue, 03 Aug 2010 01:48:50 -0700 (PDT) MIME-Version: 1.0 Received: by 10.216.186.205 with HTTP; Tue, 3 Aug 2010 01:48:30 -0700 (PDT) From: Hui Zhu Date: Tue, 03 Aug 2010 08:49:00 -0000 Message-ID: Subject: [RFA]corelow.c: Add tid to add_to_thread_list To: gdb-patches ml Content-Type: text/plain; charset=ISO-8859-1 X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2010-08/txt/msg00006.txt.bz2 Hi, I found that from gdb 7.1 to gdb-cvs-head cannot analyze the core file that get from kdump. What I got: [New
] [New Thread 2719] ../../src/gdb/thread.c:884: internal-error: switch_to_thread: Assertion `inf != NULL' failed. A problem internal to GDB has been detected, further debugging may prove unreliable. Quit this debugging session? (y or n) That is because: objdump -h ./vmcore ./vmcore: file format elf64-x86-64 Sections: Idx Name Size VMA LMA File off Algn 0 note0 00000a48 0000000000000000 0000000000000000 00000238 2**0 CONTENTS, READONLY 1 .reg/0 000000d8 0000000000000000 0000000000000000 000002bc 2**2 CONTENTS 2 .reg 000000d8 0000000000000000 0000000000000000 000002bc 2**2 CONTENTS 3 .reg/2719 000000d8 0000000000000000 0000000000000000 00000420 2**2 CONTENTS 4 .reg/0 000000d8 0000000000000000 0000000000000000 00000584 2**2 CONTENTS 5 .reg/0 000000d8 0000000000000000 0000000000000000 000006e8 2**2 CONTENTS Each of reg/n is a cpu core note. It will be a GDB thread. n is the prstatus.pr_pid that will be the thread lwpid. Because the 3 threads pid is same, so GDB get error. I make a patch for kernel (http://lkml.org/lkml/2010/8/3/75) but they think it should be fixed in user space. So I add the tid to add_to_thread_list. Please help me review it. Thanks, Hui 2010-08-03 Hui Zhu * corelow.c(add_to_thread_list): Add tid. --- corelow.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) --- a/corelow.c +++ b/corelow.c @@ -244,7 +244,7 @@ add_to_thread_list (bfd *abfd, asection { ptid_t ptid; int core_tid; - int pid, lwpid; + int pid, lwpid, tid; asection *reg_sect = (asection *) reg_sect_arg; if (strncmp (bfd_section_name (abfd, asect), ".reg/", 5) != 0) @@ -278,7 +278,14 @@ add_to_thread_list (bfd *abfd, asection if (current_inferior ()->pid == 0) inferior_appeared (current_inferior (), pid); - ptid = ptid_build (pid, lwpid, 0); + tid = 0; +get_ptid: + ptid = ptid_build (pid, lwpid, tid); + if (find_thread_ptid (ptid)) + { + tid ++; + goto get_ptid; + } add_thread (ptid);