From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12920 invoked by alias); 24 Jan 2013 14:28:03 -0000 Received: (qmail 12894 invoked by uid 22791); 24 Jan 2013 14:28:00 -0000 X-SWARE-Spam-Status: No, hits=-7.9 required=5.0 tests=BAYES_00,KHOP_RCVD_UNTRUST,KHOP_THREADED,RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from e24smtp04.br.ibm.com (HELO e24smtp04.br.ibm.com) (32.104.18.25) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 24 Jan 2013 14:27:49 +0000 Received: from /spool/local by e24smtp04.br.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 24 Jan 2013 12:27:47 -0200 Received: from d24dlp01.br.ibm.com (9.18.248.204) by e24smtp04.br.ibm.com (10.172.0.140) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 24 Jan 2013 12:27:44 -0200 Received: from d24relay03.br.ibm.com (d24relay03.br.ibm.com [9.13.184.25]) by d24dlp01.br.ibm.com (Postfix) with ESMTP id A0A203520055 for ; Thu, 24 Jan 2013 09:27:43 -0500 (EST) Received: from d24av04.br.ibm.com (d24av04.br.ibm.com [9.8.31.97]) by d24relay03.br.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id r0OERE4A23527500 for ; Thu, 24 Jan 2013 12:27:14 -0200 Received: from d24av04.br.ibm.com (loopback [127.0.0.1]) by d24av04.br.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id r0OCRUuW020045 for ; Thu, 24 Jan 2013 10:27:31 -0200 Received: from [9.8.12.62] ([9.8.12.62]) by d24av04.br.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id r0OCRUIr020029 for ; Thu, 24 Jan 2013 10:27:30 -0200 Message-ID: <1359037662.28026.70.camel@localhost.localdomain> Subject: Re: [PATCH] Fix handling of #include files during prologue skipping From: Tiago =?ISO-8859-1?Q?St=FCrmer?= Daitx To: gdb-patches@sourceware.org Date: Thu, 24 Jan 2013 14:28:00 -0000 In-Reply-To: <1359033075.28026.68.camel@localhost.localdomain> References: <201301241256.r0OCueFI023763@d06av02.portsmouth.uk.ibm.com> <1359033075.28026.68.camel@localhost.localdomain> Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 Content-Transfer-Encoding: 8bit X-Content-Scanned: Fidelis XPS MAILER x-cbid: 13012414-8936-0000-0000-000009272675 X-IsSubscribed: yes 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 X-SW-Source: 2013-01/txt/msg00591.txt.bz2 Just noticed that I forgot to hit sent earlier on. I added the copyright header to prologue-include.h and updated the testcase to reflect the line number change. I also took the time to get the license date right on the 3 prologue-include.* files: it was 2012-2013 where is should read 2013 only. Let me know if this is acceptable. Without patch: $ gdb prologue-include (gdb) break main Breakpoint 1 at 0x10000594: file prologue-include.h, line 19. With patch applied: $ gdb prologue-include (gdb) break main Breakpoint 1 at 0x1000058c: file prologue-include.h, line 18. Thanks for all your help. -tiago --- gdb/ChangeLog 2013-01-24 Ulrich Weigand * symtab.c (skip_prologue_using_sal): Consider a file change the same as an increased line number gdb/testsuite/ChangeLog 2013-01-24 Tiago Stürmer Daitx * gdb.base/prologue-include.c: New file. * gdb.base/prologue-include.exp: New file. * gdb.base/prologue-include.h: New file. diff --git a/gdb/symtab.c b/gdb/symtab.c index d40436a..b200b36 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -4905,6 +4905,10 @@ skip_prologue_using_sal (struct gdbarch *gdbarch, CORE_ADDR func_addr) line mark the prologue -> body transition. */ if (sal.line >= prologue_sal.line) break; + /* Likewise if we are in a different symtab altogether + (e.g. within a file included via #include). */ + if (sal.symtab != prologue_sal.symtab) + break; /* The line number is smaller. Check that it's from the same function, not something inlined. If it's inlined, diff --git a/gdb/testsuite/gdb.base/prologue-include.c b/gdb/testsuite/gdb.base/prologue-include.c new file mode 100644 index 0000000..c393e75 --- /dev/null +++ b/gdb/testsuite/gdb.base/prologue-include.c @@ -0,0 +1,25 @@ +/* This testcase is part of GDB, the GNU debugger. + + Copyright 2013 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +int +main (void) +{ + int i, j; +#include "prologue-include.h" + return 0; +} + diff --git a/gdb/testsuite/gdb.base/prologue-include.exp b/gdb/testsuite/gdb.base/prologue-include.exp new file mode 100644 index 0000000..f18d55a --- /dev/null +++ b/gdb/testsuite/gdb.base/prologue-include.exp @@ -0,0 +1,24 @@ +# Copyright (C) 2013 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +standard_testfile + +if { [prepare_for_testing ${testfile}.exp ${testfile}] } { + return -1 +} + +gdb_test "break main" \ + "Breakpoint.*at.* file .*$testfile.h, line 18\\." \ + "breakpoint main" diff --git a/gdb/testsuite/gdb.base/prologue-include.h b/gdb/testsuite/gdb.base/prologue-include.h new file mode 100644 index 0000000..7da7d4a --- /dev/null +++ b/gdb/testsuite/gdb.base/prologue-include.h @@ -0,0 +1,19 @@ +/* This testcase is part of GDB, the GNU debugger. + + Copyright 2013 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + + i = 2; + j = 2; -- Tiago Stürmer Daitx tdaitx@linux.vnet.ibm.com IBM - Linux Technology Center On Thu, 2013-01-24 at 11:11 -0200, Tiago Stürmer Daitx wrote: > Yes, it still shows up. Sorry, should have added this information > before. > > Without patch: > $ gdb prologue-include > (gdb) break main > Breakpoint 1 at 0x10000594: file prologue-include.h, line 19. > > With patch applied: > $ gdb prologue-include > (gdb) break main > Breakpoint 1 at 0x1000058c: file prologue-include.h, line 18. > > >