* [BUG/discussion] set scheduler-locking on get internal-error(maybe about multi-inferior)
@ 2009-10-20 8:20 Hui Zhu
2009-10-20 15:31 ` Pedro Alves
0 siblings, 1 reply; 2+ messages in thread
From: Hui Zhu @ 2009-10-20 8:20 UTC (permalink / raw)
To: gdb
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 <stdio.h>
#include <pthread.h>
#include <assert.h>
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
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [BUG/discussion] set scheduler-locking on get internal-error(maybe about multi-inferior)
2009-10-20 8:20 [BUG/discussion] set scheduler-locking on get internal-error(maybe about multi-inferior) Hui Zhu
@ 2009-10-20 15:31 ` Pedro Alves
0 siblings, 0 replies; 2+ messages in thread
From: Pedro Alves @ 2009-10-20 15:31 UTC (permalink / raw)
To: gdb; +Cc: Hui Zhu
On Tuesday 20 October 2009 08:56:08, Hui Zhu wrote:
> 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.
Thanks.
> (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
> 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.
Right.
>
> 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));".
I'm testing a patch.
--
Pedro Alves
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2009-10-20 10:02 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-10-20 8:20 [BUG/discussion] set scheduler-locking on get internal-error(maybe about multi-inferior) Hui Zhu
2009-10-20 15:31 ` Pedro Alves
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox