From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20895 invoked by alias); 24 Jul 2013 12:37:48 -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 20886 invoked by uid 89); 24 Jul 2013 12:37:47 -0000 X-Spam-SWARE-Status: No, score=-3.9 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_MED,RCVD_IN_HOSTKARMA_W,RDNS_NONE,SPF_PASS,TW_XL autolearn=ham version=3.3.1 Received: from Unknown (HELO e28smtp04.in.ibm.com) (122.248.162.4) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Wed, 24 Jul 2013 12:37:46 +0000 Received: from /spool/local by e28smtp04.in.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 24 Jul 2013 18:00:25 +0530 Received: from d28dlp02.in.ibm.com (9.184.220.127) by e28smtp04.in.ibm.com (192.168.1.134) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Wed, 24 Jul 2013 18:00:23 +0530 Received: from d28relay01.in.ibm.com (d28relay01.in.ibm.com [9.184.220.58]) by d28dlp02.in.ibm.com (Postfix) with ESMTP id 50CDF3940057 for ; Wed, 24 Jul 2013 18:07:25 +0530 (IST) Received: from d28av02.in.ibm.com (d28av02.in.ibm.com [9.184.220.64]) by d28relay01.in.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id r6OCcNhG38207704 for ; Wed, 24 Jul 2013 18:08:23 +0530 Received: from d28av02.in.ibm.com (loopback [127.0.0.1]) by d28av02.in.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id r6OCbToj022561 for ; Wed, 24 Jul 2013 22:37:30 +1000 Received: from d23ml188.in.ibm.com (d23ml188.in.ibm.com [9.182.8.144]) by d28av02.in.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id r6OCbT9t022505; Wed, 24 Jul 2013 22:37:29 +1000 Subject: [PATCH 2/5] powerpc64-aix processing xlC generated line table X-KeepSent: C26EC5A9:CE7B0C7B-65257BB2:00453335; type=4; name=$KeepSent To: gdb-patches@sourceware.org Cc: tromey@redhat.com Message-ID: From: Raunaq 12 Date: Wed, 24 Jul 2013 12: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: 13072412-5564-0000-0000-000008F0EBAF X-SW-Source: 2013-07/txt/msg00563.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 (); ---