From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25255 invoked by alias); 7 Aug 2013 11:37:07 -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 25242 invoked by uid 89); 7 Aug 2013 11:37:07 -0000 X-Spam-SWARE-Status: No, score=-4.1 required=5.0 tests=AWL,BAYES_00,KHOP_THREADED,RCVD_IN_DNSWL_MED,RDNS_NONE,SPF_PASS autolearn=ham version=3.3.1 Received: from Unknown (HELO e28smtp07.in.ibm.com) (122.248.162.7) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Wed, 07 Aug 2013 11:36:36 +0000 Received: from /spool/local by e28smtp07.in.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 7 Aug 2013 16:57:56 +0530 Received: from d28dlp02.in.ibm.com (9.184.220.127) by e28smtp07.in.ibm.com (192.168.1.137) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Wed, 7 Aug 2013 16:57:53 +0530 Received: from d28relay04.in.ibm.com (d28relay04.in.ibm.com [9.184.220.61]) by d28dlp02.in.ibm.com (Postfix) with ESMTP id 616F2394004E for ; Wed, 7 Aug 2013 17:06:16 +0530 (IST) Received: from d28av04.in.ibm.com (d28av04.in.ibm.com [9.184.220.66]) by d28relay04.in.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id r77BaGNJ29950058 for ; Wed, 7 Aug 2013 17:06:16 +0530 Received: from d28av04.in.ibm.com (localhost [127.0.0.1]) by d28av04.in.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id r77BaJKs010578 for ; Wed, 7 Aug 2013 17:06:19 +0530 Received: from d23ml188.in.ibm.com (d23ml188.in.ibm.com [9.182.8.144]) by d28av04.in.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id r77BaIDR010537; Wed, 7 Aug 2013 17:06:18 +0530 In-Reply-To: References: Subject: [PATCH 2/5] powerpc64-aix processing xlC generated line table X-KeepSent: 01E8FD54:0C7BFC8C-65257BC0:003F914D; type=4; name=$KeepSent To: gdb-patches@sourceware.org Cc: brobecker@adacore.com, tromey@redhat.com, Pedro Alves Message-ID: From: Raunaq 12 Date: Wed, 07 Aug 2013 11:37:00 -0000 MIME-Version: 1.0 Content-type: text/plain; charset=US-ASCII X-TM-AS-MML: No X-Content-Scanned: Fidelis XPS MAILER x-cbid: 13080711-8878-0000-0000-0000084A76C7 X-SW-Source: 2013-08/txt/msg00187.txt.bz2 xlc generated binaries have a line table which is not the same as GCC. GCC compiled binaries have an extra line entry in the line table to signify start of a function whereas xlc does not have this entry. Due to this difference, commands like break and list give wrong results. To fix this issue I have written a function modify_xlc_linenos which will add a line table entry at the function start points if there is no extra entry in the line table as in the case of xlc. Hence, breakpoints and listing functions will work as expected even for xlc compiled binaries. --- ChangeLog :- * xcoffread.c (modify_xlc_linenos): New function to modify xlc generated linetables. (process_linenos): Make calls to the 'modify_xlc_linenos' to correctly process linenos is case of xlc compiled binaries. --- ./gdb/xcoffread.c =================================================================== --- ./gdb.orig/xcoffread.c +++ ./gdb/xcoffread.c @@ -241,6 +241,8 @@ static struct linetable *arrange_linetable (struct linetable *); +static struct linetable *modify_xlc_linenos (struct linetable *); + static void record_include_end (struct coff_symbol *); static void process_linenos (CORE_ADDR, CORE_ADDR); @@ -589,6 +591,24 @@ } } +/* xlc compiled binaries have one less entry in the line table. + So the function entry lines marked as line number equal to 0 + will be retained in the line table with line numbers equal + to its succeeding line table entry. */ + +static struct linetable * +modify_xlc_linenos (struct linetable *lineTb) +{ + int jj; + for (jj = 0; jj < lineTb->nitems; jj++) + { + if (lineTb->item[jj].line == 0 && (lineTb->item[jj].pc + != lineTb->item[jj + 1].pc)) + lineTb->item[jj].line = lineTb->item[jj + 1].line; + } + return lineTb; +} + /* Global variable to pass the psymtab down to all the routines involved in psymtab to symtab processing. */ static struct partial_symtab *this_symtab_psymtab; @@ -698,10 +718,14 @@ lv = main_subfile.line_vector; + /* Add extra line entry in case of xlc compiled binaries. */ + + lineTb = modify_xlc_linenos (lv); + /* Line numbers are not necessarily ordered. xlc compilation will put static function to the end. */ - lineTb = arrange_linetable (lv); + lineTb = arrange_linetable (lineTb); if (lv == lineTb) { current_subfile->line_vector = (struct linetable *) @@ -730,10 +754,14 @@ lv = (inclTable[ii].subfile)->line_vector; + /* Add extra line entry in case of xlc compiled binaries */ + + lineTb = modify_xlc_linenos (lv); + /* Line numbers are not necessarily ordered. xlc compilation will put static function to the end. */ - lineTb = arrange_linetable (lv); + lineTb = arrange_linetable (lineTb); push_subfile (); ---