From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13595 invoked by alias); 29 Jul 2013 06:15:55 -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 13544 invoked by uid 89); 29 Jul 2013 06:15:54 -0000 X-Spam-SWARE-Status: No, score=-3.6 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_MED,RDNS_NONE,SPF_PASS autolearn=ham version=3.3.1 Received: from Unknown (HELO e28smtp06.in.ibm.com) (122.248.162.6) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Mon, 29 Jul 2013 06:15:53 +0000 Received: from /spool/local by e28smtp06.in.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 29 Jul 2013 11:36:59 +0530 Received: from d28dlp01.in.ibm.com (9.184.220.126) by e28smtp06.in.ibm.com (192.168.1.136) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Mon, 29 Jul 2013 11:36:57 +0530 Received: from d28relay03.in.ibm.com (d28relay03.in.ibm.com [9.184.220.60]) by d28dlp01.in.ibm.com (Postfix) with ESMTP id CD016E004F for ; Mon, 29 Jul 2013 11:45:44 +0530 (IST) Received: from d28av03.in.ibm.com (d28av03.in.ibm.com [9.184.220.65]) by d28relay03.in.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id r6T6GagU45154524 for ; Mon, 29 Jul 2013 11:46:37 +0530 Received: from d28av03.in.ibm.com (loopback [127.0.0.1]) by d28av03.in.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id r6T6FbZf011332 for ; Mon, 29 Jul 2013 16:15:37 +1000 Received: from d23ml188.in.ibm.com (d23ml188.in.ibm.com [9.182.8.144]) by d28av03.in.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id r6T6Fa3H011199; Mon, 29 Jul 2013 16:15:37 +1000 Subject: [PATCH 2/5] powerpc64-aix processing xlC generated line table X-KeepSent: 2681EF63:7B9300E1-65257BB7:002254BD; type=4; name=$KeepSent To: gdb-patches@sourceware.org Cc: tromey@redhat.com, Mark Kettenis Message-ID: From: Raunaq 12 Date: Mon, 29 Jul 2013 06:15: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: 13072906-9574-0000-0000-000008ECC8F2 X-SW-Source: 2013-07/txt/msg00675.txt.bz2 powerpc-ibm-aix: Fix line number handling for xlc compiled binaries. xlc compiled binaries have a line table which is different from gcc compiled ones. It does not contain 1 extra entry which indicates the function start PC. Because of this, listing functions, eg: 'list main' or breaking at functions, eg: 'break function1' give wrong line numbers. To fix this, we check if the function entry point has an entry in the line table (in case of gcc, it does). If it does not have this entry, then we retain the function entry lines marked as line number equal to 0 and assign the line number equal to the succeeding line table entry. --- ChangeLog :- * xcoffread.c (process_linenos): Add fix to correctly process linenos in case of xlc compiled binaries. --- Index: ./gdb/xcoffread.c =================================================================== --- ./gdb.orig/xcoffread.c +++ ./gdb/xcoffread.c @@ -602,7 +602,7 @@ static void process_linenos (CORE_ADDR start, CORE_ADDR end) { - int offset, ii; + int offset, ii, jj; file_ptr max_offset = XCOFF_DATA (this_symtab_objfile)->max_lineno_offset; @@ -698,10 +698,24 @@ lv = main_subfile.line_vector; + /* 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. */ + + lineTb = lv; + + 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; + } + /* 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 +744,24 @@ lv = (inclTable[ii].subfile)->line_vector; + /* 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. */ + + lineTb = lv; + + 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; + } + /* 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 (); ---