From: Jan Kratochvil <jan.kratochvil@redhat.com>
To: Sergio Durigan Junior <sergiodj@redhat.com>
Cc: gdb-patches@sourceware.org, Tom Tromey <tromey@redhat.com>
Subject: Re: [PATCH 2/6] Introduce `pre_expanded sals'
Date: Mon, 11 Apr 2011 21:08:00 -0000 [thread overview]
Message-ID: <20110411210758.GB28109@host1.jankratochvil.net> (raw)
In-Reply-To: <m3mxk6pvbs.fsf@redhat.com>
On Mon, 04 Apr 2011 05:08:23 +0200, Sergio Durigan Junior wrote:
> static struct symtabs_and_lines
> -addr_string_to_sals (struct breakpoint *b, char *addr_string, int *found)
> +addr_string_to_sals (struct breakpoint *b, char *addr_string, int *found,
> + int *pre_expanded)
> {
> char *s;
> int marker_spec, not_found;
> struct symtabs_and_lines sals = {0};
> struct gdb_exception e;
> + int my_pre_expanded = 0;
Such as proposal:
if (pre_expanded == NULL)
pre_expanded = &my_pre_expanded;
and use only `pre_expanded' in the code so that one does not forget to update
both. (+Probably some *pre_expanded preinitialization.)
[...]
> + my_pre_expanded = canonical.pre_expanded;
> + if (pre_expanded)
> + *pre_expanded = my_pre_expanded;
> + }
> }
> if (e.reason < 0)
> {
> @@ -11010,7 +11041,7 @@ addr_string_to_sals (struct breakpoint *b, char *addr_string, int *found)
>
> if (!not_found)
> {
> - gdb_assert (sals.nelts == 1);
> + gdb_assert (my_pre_expanded || sals.nelts == 1);
>
> resolve_sal_pc (&sals.sals[0]);
> if (b->condition_not_parsed && s && s[0])
> @@ -11049,22 +11080,27 @@ re_set_breakpoint (struct breakpoint *b)
> struct symtabs_and_lines expanded = {0};
> struct symtabs_and_lines expanded_end = {0};
> struct cleanup *cleanups = make_cleanup (null_cleanup, NULL);
> + int pre_expanded = 0;
>
> input_radix = b->input_radix;
> save_current_space_and_thread ();
> switch_to_program_space_and_thread (b->pspace);
> set_language (b->language);
>
> - sals = addr_string_to_sals (b, b->addr_string, &found);
> + sals = addr_string_to_sals (b, b->addr_string, &found, &pre_expanded);
> if (found)
> {
> make_cleanup (xfree, sals.sals);
> - expanded = expand_line_sal_maybe (sals.sals[0]);
> + if (pre_expanded)
> + expanded = sals;
> + else
> + expanded = expand_line_sal_maybe (sals.sals[0]);
> }
>
> if (b->addr_string_range_end)
> {
> - sals_end = addr_string_to_sals (b, b->addr_string_range_end, &found);
> + sals_end = addr_string_to_sals (b, b->addr_string_range_end, &found,
> + NULL);
> if (found)
> {
> make_cleanup (xfree, sals_end.sals);
> diff --git a/gdb/linespec.h b/gdb/linespec.h
> index d8d2ec9..458235c 100644
> --- a/gdb/linespec.h
> +++ b/gdb/linespec.h
> @@ -30,6 +30,10 @@ struct linespec_result
> display mechanism would do the wrong thing. */
> int special_display;
>
> + /* If non-zero, the linespec result should be considered to be a
> + "pre-expanded" multi-location linespec. */
> + int pre_expanded;
Here could be the comment by Tom from the follow-up mail as this comment does
not explain much.
> +
> /* If non-NULL, an array of canonical names for returned
> symtab_and_line objects. The array has as many elements as the
> `nelts' field in the symtabs_and_line returned by decode_line_1.
Thanks,
Jan
prev parent reply other threads:[~2011-04-11 21:08 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-04-04 3:08 Sergio Durigan Junior
2011-04-06 20:13 ` Tom Tromey
2011-04-12 11:18 ` Pedro Alves
2011-04-12 11:53 ` Jan Kratochvil
2011-04-12 13:30 ` Pedro Alves
2011-04-12 20:34 ` Tom Tromey
2011-04-12 22:22 ` Matt Rice
2011-04-13 9:53 ` Eli Zaretskii
2011-07-27 17:08 ` Tom Tromey
2011-07-29 20:36 ` Sergio Durigan Junior
2011-08-04 20:41 ` Tom Tromey
2011-08-05 3:41 ` Sergio Durigan Junior
2011-08-05 14:40 ` Tom Tromey
2011-08-05 18:06 ` Sergio Durigan Junior
2011-08-10 14:24 ` Tom Tromey
2011-05-03 16:09 ` Jerome Guitton
2011-05-03 18:17 ` Joel Brobecker
2011-04-12 20:26 ` Tom Tromey
2011-04-13 9:51 ` Eli Zaretskii
2011-04-13 19:20 ` Tom Tromey
2011-04-15 10:37 ` Eli Zaretskii
2011-04-18 18:37 ` Pedro Alves
2011-04-27 18:02 ` Jan Kratochvil
2011-04-29 20:42 ` Tom Tromey
2011-04-11 21:08 ` Jan Kratochvil [this message]
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=20110411210758.GB28109@host1.jankratochvil.net \
--to=jan.kratochvil@redhat.com \
--cc=gdb-patches@sourceware.org \
--cc=sergiodj@redhat.com \
--cc=tromey@redhat.com \
/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