From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24761 invoked by alias); 22 Jan 2014 15:45:55 -0000 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 Received: (qmail 24750 invoked by uid 89); 22 Jan 2014 15:45:54 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 X-HELO: smtp5-g21.free.fr Received: from smtp5-g21.free.fr (HELO smtp5-g21.free.fr) (212.27.42.5) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 22 Jan 2014 15:45:53 +0000 Received: from [192.168.1.12] (unknown [86.193.110.90]) (Authenticated sender: sed) by smtp5-g21.free.fr (Postfix) with ESMTPSA id 3E9C6D480D0; Wed, 22 Jan 2014 16:45:42 +0100 (CET) Message-ID: <52DFE759.9040502@free.fr> Date: Wed, 22 Jan 2014 15:45:00 -0000 From: Cedric Roux User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.12) Gecko/20130116 Icedove/10.0.12 MIME-Version: 1.0 To: Sergio Durigan Junior CC: Hui Zhu , "gdb@sourceware.org" Subject: Re: "record save" failure References: <52DE76B2.3070302@free.fr> In-Reply-To: Content-Type: multipart/mixed; boundary="------------050907050702090204070004" X-IsSubscribed: yes X-SW-Source: 2014-01/txt/msg00023.txt.bz2 This is a multi-part message in MIME format. --------------050907050702090204070004 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit Content-length: 1832 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. --------------050907050702090204070004 Content-Type: text/x-csrc; name="recthr.c" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="recthr.c" Content-length: 1104 /* compile with: gcc -pthread -Wall recthr.c -o recthr */ #include #include #include 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(); } --------------050907050702090204070004--