From: Joel Brobecker <brobecker@adacore.com>
To: gdb-patches@sourceware.org
Cc: Joel Brobecker <brobecker@adacore.com>
Subject: [RFA] unexpected multiple location for breakpoint
Date: Tue, 23 Nov 2010 01:10:00 -0000 [thread overview]
Message-ID: <1290474625-1582-1-git-send-email-brobecker@adacore.com> (raw)
This is a proposed fix for the issue presented at:
http://www.sourceware.org/ml/gdb/2010-11/msg00026.html.
It changes the multiple-location filtering mechanism to use (block)
contained_in rather than block equality to discard unwanted
breakpoint locations. For instance, if the user tries to break
on line "foo.adb:5" and the compiler generated 2 entries for that
line, the second being inside a lexical block nested inside the
lexical block associated to the first entry, then we should only
break on the first line entry.
gdb/ChangeLog:
* symtab.c (expand_line_sal): Use contained_in rather than
plain block equality to filter out duplicate sals.
Tested on x86_64-linux. No regression. OK to commit?
---
gdb/symtab.c | 22 +++++++++++++++++-----
1 files changed, 17 insertions(+), 5 deletions(-)
diff --git a/gdb/symtab.c b/gdb/symtab.c
index a6023b9..9eb3784 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -4633,7 +4633,8 @@ expand_line_sal (struct symtab_and_line sal)
in two PC ranges. In this case, we don't want to set breakpoint
on first PC of each range. To filter such cases, we use containing
blocks -- for each PC found above we see if there are other PCs
- that are in the same block. If yes, the other PCs are filtered out. */
+ that are in the same or contained block. If yes, the other PCs
+ are filtered out. */
old_chain = save_current_program_space ();
filter = alloca (ret.nelts * sizeof (int));
@@ -4648,12 +4649,23 @@ expand_line_sal (struct symtab_and_line sal)
}
do_cleanups (old_chain);
- for (i = 0; i < ret.nelts; ++i)
+ /* To do the filtering of extraneous PCs, we go over all entries
+ in our list of PCs and see if its associated block is contained by
+ the block of another entry. If it is, then eliminate that contained
+ block.
+
+ We start from last to first in our list of PCs, in order to take
+ care of the case where 2 entries are associated to the same block:
+ When we have one or more lines in the same block, we want to stop
+ at the first instruction of that line, hence we want to eliminate
+ the highest address. */
+
+ for (i = ret.nelts - 1; i >= 0; i--)
if (blocks[i] != NULL)
- for (j = i+1; j < ret.nelts; ++j)
- if (blocks[j] == blocks[i])
+ for (j = 0; j < ret.nelts; ++j)
+ if (j != i && filter[j] && contained_in (blocks[i], blocks[j]))
{
- filter[j] = 0;
+ filter[i] = 0;
++deleted;
break;
}
--
1.7.1
next reply other threads:[~2010-11-23 1:10 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-23 1:10 Joel Brobecker [this message]
2010-11-26 17:29 ` Joel Brobecker
2010-11-27 18:35 ` Daniel Jacobowitz
2010-12-10 12:23 ` Joel Brobecker
2010-12-28 11:50 ` Joel Brobecker
2010-12-28 20:15 ` Eli Zaretskii
2010-12-29 6:08 ` Joel Brobecker
2010-12-29 8:08 ` Joel Brobecker
2010-12-29 19:30 ` Eli Zaretskii
2010-12-30 20:40 ` Joel Brobecker
2010-12-30 21:03 ` Eli Zaretskii
2010-12-31 6:35 ` Michael Snyder
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1290474625-1582-1-git-send-email-brobecker@adacore.com \
--to=brobecker@adacore.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox