From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2161 invoked by alias); 18 Dec 2003 23:07:07 -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 2140 invoked from network); 18 Dec 2003 23:07:06 -0000 Received: from unknown (HELO touchme.toronto.redhat.com) (207.219.125.105) by sources.redhat.com with SMTP; 18 Dec 2003 23:07:06 -0000 Received: from redhat.com (toocool.toronto.redhat.com [172.16.14.72]) by touchme.toronto.redhat.com (Postfix) with ESMTP id 8B76580018E; Thu, 18 Dec 2003 18:07:05 -0500 (EST) Message-ID: <3FE23319.9000009@redhat.com> Date: Thu, 18 Dec 2003 23:07:00 -0000 From: "J. Johnston" Organization: Red Hat Inc. User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 MIME-Version: 1.0 To: Jason Molenda Cc: gdb-patches@sources.redhat.com Subject: Re: [RFA]: Fix for do_mixed_source_and_assembly in disasm.c References: <3FE0C778.8010606@redhat.com> <4C0916E8-31A7-11D8-BFBD-000393D457E2@apple.com> In-Reply-To: <4C0916E8-31A7-11D8-BFBD-000393D457E2@apple.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-SW-Source: 2003-12/txt/msg00441.txt.bz2 Jason Molenda wrote: > Hi Jeff, > > On Dec 17, 2003, at 1:15 PM, Jeff Johnston wrote: > >> There are a few bugs in do_mixed_source_and_assembly() when dealing >> with the ia64. > > > I hit one of the two bugs you're fixing last week, namely the double > call to close off the list/tuple. My first fix looked like yours, but I > think a slight reworking of the loop is very desirable here. Right now > this loop looks approximately like this: > > > Set close_list to 1 (the list/tuple will be closed at the end of this > loop) > > First entry of a new source line number: > Start a "src_and_asm_line" tuple, print the source line. > Start a "line_asm_insn" list where instructions will be emitted. > If we're not at the end of the mle array, and the next mle entry's > source line number is not greater than the current source line entry, > DON'T close off the list (close_list = 0) > > Print the assembly instructions for the current address range. > > If close_list is 1, close the tuple/list. > > > Which is a very convoluted way of writing a loop, and more importantly, > this only works correctly for one or two assembly ranges for a single > source line. If you have a third, on the 2nd iter the tuple/list are > closed and then on the 3rd you close them again. > > Instead, this is more clear: > > > First entry of a new source line number: > Start a "src_and_asm_line" tuple, print the source line. > Start a "line_asm_insn" list where instructions will be emitted. > > Print the assembly instructions for the current address range. > > If we're at the end of the mle array or the next entry in the array is > a new source line, close off the list and tuple. > > > I also took the opportunity to combine two conditional statements - I > won't push hard for that part of the change, but the rest is a clear > improvement IMHO. > > We only had this code path executed when we were using a compiler with a > bug in it internally, so it's not too easy for me to reproduce/test > this. I've tried to combine my patch and yours against the current FSF > TOT. What do you think of my suggested additional change? Can you try > it on the IA64 test case you have? > > > Jason > Works fine. I like the revision you made. I don't know if the powers-that-be will review this patch before the New Year. -- Jeff J.