From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32544 invoked by alias); 17 Dec 2003 21:15:40 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 32535 invoked from network); 17 Dec 2003 21:15:36 -0000 Received: from unknown (HELO touchme.toronto.redhat.com) (207.219.125.105) by sources.redhat.com with SMTP; 17 Dec 2003 21:15:36 -0000 Received: from redhat.com (toocool.toronto.redhat.com [172.16.14.72]) by touchme.toronto.redhat.com (Postfix) with ESMTP id 2333080018E for ; Wed, 17 Dec 2003 16:15:36 -0500 (EST) Message-ID: <3FE0C778.8010606@redhat.com> Date: Wed, 17 Dec 2003 21:15:00 -0000 From: Jeff Johnston User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 MIME-Version: 1.0 To: gdb-patches@sources.redhat.com Subject: [RFA]: Fix for do_mixed_source_and_assembly in disasm.c Content-Type: multipart/mixed; boundary="------------000507010909040001080100" X-SW-Source: 2003-12/txt/msg00419.txt.bz2 This is a multi-part message in MIME format. --------------000507010909040001080100 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-length: 1080 There are a few bugs in do_mixed_source_and_assembly() when dealing with the ia64. One problem is that cleanups for tuples and lists can possibly be deferred to a future iteration of a loop, however, the values are reinitialized to NULL each time at the start of the loop. Another problem is that the code to figure out if the list/tuple should be closed off is inside a block of code that is not always reached in every iteration. These two problems combined to cause a SIGSEGV in gdb because a NULL pointer gets passed into do_cleanups() which causes all cleanups to be performed up the chain. I have submitted a separate patch to prevent running the entire chain when NULL input is passed. Ok to commit? -- Jeff J. 2003-12-17 Jeff Johnston * disasm.c (do_mixed_source_and_assembly): For uiout asm list and tuple cleanups, don't reset to NULL until we close off the tuple/list. Also move check for whether to close off the asm tuple/list to where it will be run on each iteration of the loop. --------------000507010909040001080100 Content-Type: text/plain; name="disasm.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="disasm.patch" Content-length: 1760 Index: disasm.c =================================================================== RCS file: /cvs/src/src/gdb/disasm.c,v retrieving revision 1.17 diff -u -p -r1.17 disasm.c --- disasm.c 24 Oct 2003 17:37:03 -0000 1.17 +++ disasm.c 17 Dec 2003 20:37:25 -0000 @@ -164,6 +164,8 @@ do_mixed_source_and_assembly (struct ui_ CORE_ADDR pc; int num_displayed = 0; struct cleanup *ui_out_chain; + struct cleanup *ui_out_tuple_chain = NULL; + struct cleanup *ui_out_list_chain = NULL; mle = (struct dis_line_entry *) alloca (nlines * sizeof (struct dis_line_entry)); @@ -221,8 +223,6 @@ do_mixed_source_and_assembly (struct ui_ for (i = 0; i < newlines; i++) { - struct cleanup *ui_out_tuple_chain = NULL; - struct cleanup *ui_out_list_chain = NULL; int close_list = 1; /* Print out everything from next_line to the current line. */ @@ -275,19 +275,21 @@ do_mixed_source_and_assembly (struct ui_ next_line = mle[i].line + 1; ui_out_list_chain = make_cleanup_ui_out_list_begin_end (uiout, "line_asm_insn"); - /* Don't close the list if the lines are not in order. */ - if (i < (newlines - 1) && mle[i + 1].line <= mle[i].line) - close_list = 0; } + /* Don't close the list if the lines are not in order. */ + if (i < (newlines - 1) && mle[i + 1].line <= mle[i].line) + close_list = 0; + num_displayed += dump_insns (uiout, di, mle[i].start_pc, mle[i].end_pc, how_many, stb); if (close_list) { do_cleanups (ui_out_list_chain); do_cleanups (ui_out_tuple_chain); + ui_out_tuple_chain = NULL; + ui_out_list_chain = NULL; ui_out_text (uiout, "\n"); - close_list = 0; } if (how_many >= 0) if (num_displayed >= how_many) --------------000507010909040001080100--