From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21845 invoked by alias); 19 Jun 2013 21:14:57 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 21822 invoked by uid 89); 19 Jun 2013 21:14:53 -0000 X-Spam-SWARE-Status: No, score=-6.9 required=5.0 tests=AWL,BAYES_00,RCVD_IN_HOSTKARMA_W,RCVD_IN_HOSTKARMA_WL,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.1 Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Wed, 19 Jun 2013 21:14:52 +0000 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r5JLEok5022697 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 19 Jun 2013 17:14:50 -0400 Received: from host2.jankratochvil.net (ovpn-116-40.ams2.redhat.com [10.36.116.40]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r5JLEicB010588 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Wed, 19 Jun 2013 17:14:47 -0400 Date: Wed, 19 Jun 2013 21:42:00 -0000 From: Jan Kratochvil To: gdb-patches@sourceware.org Cc: Markus Metzger Subject: [patch] Fix cleanup in finish_command Message-ID: <20130619211444.GA29379@host2.jankratochvil.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes X-SW-Source: 2013-06/txt/msg00522.txt.bz2 Hi, I was getting core files (despite GDB PASSes all tests) with the patchset [patch v3 00/23] record-btrace: reverse http://sourceware.org/ml/gdb-patches/2013-06/msg00214.html Message-Id: <1370851496-32313-1-git-send-email-markus.t.metzger@intel.com> It probably comes from: finish^M Run till exit from #0 0x00000000004005b5 in bar () at gdb/testsuite/gdb.btrace/x86-tailcall.c:24^M 0x00000000004005d5 in main () at gdb/testsuite/gdb.btrace/x86-tailcall.c:37^M 37 answer = foo ();^M This record target does not trace registers.^M (gdb) PASS: gdb.btrace/tailcall.exp: step, 1.1 It dumps core even without -lmcheck. (Regression test is still running here.) Jan #0 in delete_breakpoint (bpt=0x3ab0780) at breakpoint.c:13494 #1 in finish_command_continuation (arg=0x3a202c0, err=1) at infcmd.c:1593 #2 in do_my_continuations_1 (pmy_chain=0x7fff5c1c8178, err=1) at continuations.c:59 #3 in do_my_continuations (list=0x3916278, err=1) at continuations.c:83 #4 in do_all_continuations_ptid (ptid=..., continuations_p=0x3916278, err=1) at continuations.c:191 #5 in do_all_continuations_thread_callback (thread=0x3916190, data=0x7fff5c1c8254) at continuations.c:202 #6 in do_all_continuations_thread (thread=0x3916190, err=1) at continuations.c:211 #7 in clear_thread_inferior_resources (tp=0x3916190) at thread.c:123 #8 in delete_thread_1 (ptid=..., silent=0) at thread.c:296 #9 in delete_thread (ptid=...) at thread.c:313 #10 in delete_thread_of_inferior (tp=0x3916190, data=0x7fff5c1c83b0) at inferior.c:182 #11 in iterate_over_threads (callback=0x8805ba , data=0x7fff5c1c83b0) at thread.c:370 #12 in exit_inferior_1 (inftoex=0x37e3620, silent=0) at inferior.c:260 #13 in exit_inferior (pid=8817) at inferior.c:289 #14 in generic_mourn_inferior () at target.c:3679 #15 in inf_ptrace_mourn_inferior (ops=0x368a8f0) at inf-ptrace.c:179 #16 in linux_nat_mourn_inferior (ops=0x368a8f0) at linux-nat.c:4101 #17 in target_mourn_inferior () at target.c:2836 #18 in linux_nat_kill (ops=0x368a8f0) at linux-nat.c:4089 #19 in target_kill () at target.c:482 #20 in record_kill (t=0x1f1fca0 ) at record.c:185 #21 in target_kill () at target.c:482 #22 in kill_or_detach (inf=0x37e3620, args=0x7fff5c1c86d0) at top.c:1311 #23 in iterate_over_inferiors (callback=0x856ed9 , data=0x7fff5c1c86d0) at inferior.c:396 #24 in quit_force (args=0x0, from_tty=0) at top.c:1419 #25 in quit_command (args=0x0, from_tty=0) at ./cli/cli-cmds.c:334 #26 in quit_cover () at top.c:298 #27 in async_disconnect (arg=0x0) at event-top.c:860 #28 in invoke_async_signal_handlers () at event-loop.c:993 #29 in process_event () at event-loop.c:320 #30 in gdb_do_one_event () at event-loop.c:406 #31 in start_event_loop () at event-loop.c:431 #32 in cli_command_loop () at event-top.c:177 #33 in current_interp_command_loop () at interps.c:331 #34 in captured_command_loop (data=0x0) at main.c:260 #35 in catch_errors (func=0x751bbb , func_args=0x0, errstring=0xfdf1f4 "", mask=6) at exceptions.c:546 #36 in captured_main (data=0x7fff5c1c8a80) at main.c:1055 #37 in catch_errors (func=0x751e6e , func_args=0x7fff5c1c8a80, errstring=0xfdf1f4 "", mask=6) at exceptions.c:546 #38 in gdb_main (args=0x7fff5c1c8a80) at main.c:1064 #39 in main (argc=5, argv=0x7fff5c1c8b88) at gdb.c:34 gdb/ 2013-06-19 Jan Kratochvil * infcmd.c (finish_forward): Move discard_cleanups earlier. diff --git a/gdb/infcmd.c b/gdb/infcmd.c index 30621e4..4a32382 100644 --- a/gdb/infcmd.c +++ b/gdb/infcmd.c @@ -1691,9 +1691,9 @@ finish_forward (struct symbol *function, struct frame_info *frame) cargs->function = function; add_continuation (tp, finish_command_continuation, cargs, finish_command_continuation_free_arg); + discard_cleanups (old_chain); proceed ((CORE_ADDR) -1, GDB_SIGNAL_DEFAULT, 0); - discard_cleanups (old_chain); if (!target_can_async_p ()) do_all_continuations (0); }