From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13498 invoked by alias); 20 Oct 2009 07:56:35 -0000 Received: (qmail 13489 invoked by uid 22791); 20 Oct 2009 07:56:34 -0000 X-SWARE-Spam-Status: No, hits=-1.7 required=5.0 tests=AWL,BAYES_00,SARE_MSGID_LONG40,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mail-pz0-f192.google.com (HELO mail-pz0-f192.google.com) (209.85.222.192) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 20 Oct 2009 07:56:29 +0000 Received: by pzk30 with SMTP id 30so4256674pzk.24 for ; Tue, 20 Oct 2009 00:56:28 -0700 (PDT) MIME-Version: 1.0 Received: by 10.142.6.8 with SMTP id 8mr425810wff.326.1256025388068; Tue, 20 Oct 2009 00:56:28 -0700 (PDT) From: Hui Zhu Date: Tue, 20 Oct 2009 08:20:00 -0000 Message-ID: Subject: [BUG/discussion] set scheduler-locking on get internal-error(maybe about multi-inferior) 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: 2009-10/txt/msg00314.txt.bz2 Hi guys, I got some error with multi-thread and low arch-linux-nat. I reproduced it in i386-linux, I am not sure it affect other arch or not. The following is how to reproduce it: cat 1.c #include #include #include void td1(void * i) { while (1) { printf ("1\n"); sleep (1); } return; } void td2(void * i) { while (1) { printf ("2\n"); sleep (1); } return; } int main(int argc,char *argv[],char *envp[]) { pthread_t t1,t2; pthread_create(&t1, NULL, (void*)td1, NULL); pthread_create(&t2, NULL, (void*)td2, NULL); while (1) { printf ("0\n"); sleep (1); } return (0); } gcc -lpthread -g 1.c gdb ./a.out (gdb) r Starting program: /home/teawater/gdb/rec/bgdbno/gdb/a.out [Thread debugging using libthread_db enabled] [New Thread 0xb7e52b90 (LWP 16277)] [New Thread 0xb7651b90 (LWP 16278)] 1 2 0 Program received signal SIGINT, Interrupt. 0xb7fe3410 in __kernel_vsyscall () (gdb) info threads During symbol reading, incomplete CFI data; unspecified registers (e.g., eax) at 0xb7fe3411. 3 Thread 0xb7651b90 (LWP 16278) 0xb7fe3410 in __kernel_vsyscall () 2 Thread 0xb7e52b90 (LWP 16277) 0xb7fe3410 in __kernel_vsyscall () * 1 Thread 0xb7e53ad0 (LWP 16274) 0xb7fe3410 in __kernel_vsyscall () (gdb) thread 2 [Switching to thread 2 (Thread 0xb7e52b90 (LWP 16277))]#0 0xb7fe3410 in __kernel_vsyscall () (gdb) set scheduler-locking on (gdb) si ../../src/gdb/target.c:2567: internal-error: Can't determine the current address space of thread process 16277 A problem internal to GDB has been detected, further debugging may prove unreliable. Quit this debugging session? (y or n) n The bt of this bug is: #0 internal_error (file=0x8518c77 "../../src/gdb/target.c", line=2567, string=0x8519634 "Can't determine the current address space of thread %s\n") at ../../src/gdb/utils.c:1002 #1 0x081c7259 in target_thread_address_space (ptid=...) at ../../src/gdb/target.c:2567 #2 0x08153006 in get_thread_arch_regcache (ptid=..., gdbarch=0x86a39d0) at ../../src/gdb/regcache.c:459 #3 0x0815312c in get_thread_regcache (ptid=...) at ../../src/gdb/regcache.c:482 #4 0x080dcc1c in i386_linux_resume (ops=0x85f2ea0, ptid=..., step=1, signal=TARGET_SIGNAL_0) at ../../src/gdb/i386-linux-nat.c:764 #5 0x080e4313 in linux_nat_resume (ops=0x861b920, ptid=..., step=1, signo=TARGET_SIGNAL_0) at ../../src/gdb/linux-nat.c:2019 #6 0x080dfe08 in thread_db_resume (ops=0x85f2ac0, ptid=..., step=1, signo=TARGET_SIGNAL_0) at ../../src/gdb/linux-thread-db.c:1543 #7 0x081c66e6 in target_resume (ptid=..., step=1, signal=TARGET_SIGNAL_0) at ../../src/gdb/target.c:2147 #8 0x08194d1a in resume (step=1, sig=TARGET_SIGNAL_0) at ../../src/gdb/infrun.c:1541 The bug issue is: In linux-nat.c:linux_nat_resume /* Convert to something the lower layer understands. */ ptid = pid_to_ptid (GET_LWP (lp->ptid)); In i386-linux-nat.c:i386_linux_resume int pid = PIDGET (ptid); struct regcache *regcache = get_thread_regcache (pid_to_ptid (pid)); The pid in i386_linux_resume is lwp, get_thread_regcache will not get the right ptid. I don't have any good idea with this bug. There is too much "int pid = PIDGET (ptid);" In arch-linux-nat function. I am not sure it can really work well with multi-inferior. This level code looks don't have good way if the ptid is get from " ptid = pid_to_ptid (GET_LWP (lp->ptid));". Thanks, Hui