Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Hui Zhu <teawater@gmail.com>
To: gdb@sourceware.org
Subject: [BUG/discussion] set scheduler-locking on get internal-error(maybe  	about multi-inferior)
Date: Tue, 20 Oct 2009 08:20:00 -0000	[thread overview]
Message-ID: <daef60380910200056q69e7b8f8v817b2f743d4c77cd@mail.gmail.com> (raw)

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


             reply	other threads:[~2009-10-20  7:56 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-20  8:20 Hui Zhu [this message]
2009-10-20 15:31 ` Pedro Alves

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=daef60380910200056q69e7b8f8v817b2f743d4c77cd@mail.gmail.com \
    --to=teawater@gmail.com \
    --cc=gdb@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox