From: Cedric Roux <sed@free.fr>
To: Sergio Durigan Junior <sergiodj@redhat.com>
Cc: Hui Zhu <teawater@gmail.com>, "gdb@sourceware.org" <gdb@sourceware.org>
Subject: Re: "record save" failure
Date: Wed, 22 Jan 2014 15:45:00 -0000 [thread overview]
Message-ID: <52DFE759.9040502@free.fr> (raw)
In-Reply-To: <m338kgyal3.fsf@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 1833 bytes --]
On 01/22/2014 04:11 AM, Sergio Durigan Junior wrote:
> On Tuesday, January 21 2014, Hui Zhu wrote:
>
>> Prec didn't support multithread.
>
> Even so, GDB shouldn't segfault like that.
>
> Cedric, thanks for the report. Would it be possible for you to test
> this with our git HEAD? Also, if you still find the issue with git
> HEAD, could you please file a bug in our bugzilla about this issue?
> Thanks.
fails too with GNU gdb (GDB) 7.7.50.20140121-cvs (git cloned yesterday)
Attached is a little C program that exhibits the problem.
You need two terminals: Tprog and Tgdb.
In Tprog: compile and run recthr.
When it stops, in Tgdb, launch gdb.
Then press enter in Tprog, and, well, follow what the program
asks you to do.
What it does is: create a thread th1, wait for gdb, th1 quits
(so that gdb sees th1 leaving, I think that's the triggering
event) and th2 is created, then gdb records a function run by that
thread and when it's done the user asks for "record save"
which fails. Then the user types "info record" and everyone
goes back to nowhere. (Maybe th2 is not necessary here.)
I think you set a global variable to the TID of th1. But th1 has gone
away when I record th2, so asking the kernel for th1's registers' values
fails. Or something like that.
I still have a 64b computer here, with debian. But I bet it would fail
with something else. (Maybe you have to run the linux kernel, not
even sure about that...)
I let you deal with your bug tracking stuff, I'm not good with those. :)
On my side I will try to change the TID for the one I record but since
you don't support multi-threading recording I won't bother you with my
little hacks, which, I fear, will be terribly dirty. (Note though
that the recording is done with "scheduler-locking on", which means I
record a single thread.)
Happy hacking!
Cédric.
[-- Attachment #2: recthr.c --]
[-- Type: text/x-csrc, Size: 1104 bytes --]
/* compile with: gcc -pthread -Wall recthr.c -o recthr */
#include <stdio.h>
#include <pthread.h>
#include <unistd.h>
volatile int th1_done;
void *th1(void *_)
{
printf("run\ngdb -p %d\nthen in gdb type:\ncont\nand press enter in this term\n", getpid());
getchar();
th1_done = 1;
return 0;
}
int traceme(void)
{
int x=0;
int i=0;
for (x = 0; x < 10; x++) i += x*2;
return i;
}
void after_traceme(int x)
{
printf("%d\n", x);
}
void *th2(void *x)
{
int i = traceme();
after_traceme(i);
return 0;
}
void new_thread(void *(*f)(void *))
{
pthread_t th;
pthread_create(&th, 0, f, 0);
}
int main(void)
{
new_thread(th1);
while (!th1_done) usleep(10*1000);
printf("type:\nctrl+c\nhb *%p\nhb *%p\ncont\nin gdb and press enter in this term\n",
traceme, after_traceme);
getchar();
printf("type:\nset scheduler-locking on\nrecord full\ncont\nin gdb\n");
printf("then:\nrecord save /tmp/XX\nit should fail\n");
printf("then type:\ninfo record\nit should segfault\n");
printf("and happy debugging to you too.:)\n");
new_thread(th2);
while (1) pause();
}
prev parent reply other threads:[~2014-01-22 15:45 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-21 13:32 Cedric Roux
2014-01-22 1:26 ` Hui Zhu
2014-01-22 3:11 ` Sergio Durigan Junior
2014-01-22 15:45 ` Cedric Roux [this message]
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=52DFE759.9040502@free.fr \
--to=sed@free.fr \
--cc=gdb@sourceware.org \
--cc=sergiodj@redhat.com \
--cc=teawater@gmail.com \
/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