From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8437 invoked by alias); 6 Aug 2004 21:10:45 -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 8419 invoked from network); 6 Aug 2004 21:10:44 -0000 Received: from unknown (HELO d9000.firstnet.net.uk) (212.103.224.244) by sourceware.org with SMTP; 6 Aug 2004 21:10:44 -0000 Received: (qmail 11605 invoked by uid 105); 6 Aug 2004 21:10:29 -0000 Received: from unknown (HELO localhost.localdomain) (212.103.239.121) by d9000.first with SMTP; 6 Aug 2004 21:10:29 -0000 Received: from localhost (castle.priv.wark.uk.streamline-computing.com [192.168.1.249]) by localhost.localdomain (8.12.8/8.12.8) with ESMTP id i76LARXY013956 for ; Fri, 6 Aug 2004 22:10:28 +0100 Subject: [PATCH/RFA] buildsym.c: extend parent block bounds if child block exceed limit From: David Lecomber To: patches Content-Type: multipart/mixed; boundary="=-gEI60pkqZ/YpAsaIxn07" Message-Id: <1091826690.3932.33.camel@localhost> Mime-Version: 1.0 Date: Fri, 06 Aug 2004 21:10:00 -0000 X-SW-Source: 2004-08/txt/msg00183.txt.bz2 --=-gEI60pkqZ/YpAsaIxn07 Content-Type: text/plain Content-Transfer-Encoding: 7bit Content-length: 1512 All, f90 compiled with nested subroutines using Intel's compiler is handled badly by GDB. Line numbers are not found by backtrace. Although GDB is capable of reading out all the dwarf2 line information inside this routine correctly, it can't look up an address to get a line number when inside a block. The cause is that the containing function's block does not contain the contained function's address. > (gdb) b nest.f90:14 > Breakpoint 1 at 0x8049e04: file nest.f90, line 14. > (gdb) r > Starting program: /home/david/a.out > [Thread debugging using libthread_db enabled] > [New Thread 1024 (LWP 27093)] > [Switching to Thread 1024 (LWP 27093)] > > Breakpoint 1, 0x08049e04 in nest_.second_ () > (gdb) bt > #0 0x08049e04 in nest_.second_ () > #1 0x08049dee in nest () at nest.f90:9 > #2 0x08049da8 in main () where nest.f90 is attached and line 14 is in the middle of nested function second. With the attached patch applied the result is: > (gdb) bt > #0 second () at nest.f90:14 > #1 0x08049dee in nest () at nest.f90:9 > #2 0x08049da8 in main () I'd like to propose the attached patch. Presently if a child block extends beyond the parent, the child is shrunk to the parent's bounds. This reverses that. I wouldn't like to guess the possible consequences of this change... 2004-08-06 David Lecomber * buildsym.c (finish_block): Extend parent block bounds when child block exceeds current known bounds. Can someone check this and approve/reject? d. --=-gEI60pkqZ/YpAsaIxn07 Content-Disposition: attachment; filename=nest.f90 Content-Type: text/plain; name=nest.f90; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-length: 219 PROGRAM Nest INTEGER j INTEGER i DO i=1, 100 j = i END DO time = Second() CONTAINS REAL FUNCTION Second() Second = REAL(10) END FUNCTION Second END PROGRAM Nest --=-gEI60pkqZ/YpAsaIxn07 Content-Disposition: attachment; filename=block.patch Content-Type: text/x-patch; name=block.patch; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-length: 1056 Index: gdb/buildsym.c =================================================================== RCS file: /cvs/src/src/gdb/buildsym.c,v retrieving revision 1.39 diff -c -p -r1.39 buildsym.c *** gdb/buildsym.c 7 Feb 2004 23:13:46 -0000 1.39 --- gdb/buildsym.c 28 Jul 2004 13:02:52 -0000 *************** finish_block (struct symbol *symbol, str *** 421,429 **** paddr_nz (BLOCK_END (block))); } if (BLOCK_START (pblock->block) < BLOCK_START (block)) ! BLOCK_START (pblock->block) = BLOCK_START (block); if (BLOCK_END (pblock->block) > BLOCK_END (block)) ! BLOCK_END (pblock->block) = BLOCK_END (block); } #endif BLOCK_SUPERBLOCK (pblock->block) = block; --- 421,429 ---- paddr_nz (BLOCK_END (block))); } if (BLOCK_START (pblock->block) < BLOCK_START (block)) ! BLOCK_START (block) = BLOCK_START (pblock->block); if (BLOCK_END (pblock->block) > BLOCK_END (block)) ! BLOCK_END (block) = BLOCK_END (pblock->block); } #endif BLOCK_SUPERBLOCK (pblock->block) = block; --=-gEI60pkqZ/YpAsaIxn07--