From: Eli Zaretskii <eliz@gnu.org>
To: Andrew STUBBS <andrew.stubbs@st.com>
Cc: gdb-patches@sources.redhat.com
Subject: Re: PATCH: Problem union comparision in TUI
Date: Fri, 21 Oct 2005 22:13:00 -0000 [thread overview]
Message-ID: <u7jc6plgn.fsf@gnu.org> (raw)
In-Reply-To: <435900C7.2010706@st.com> (message from Andrew STUBBS on Fri, 21 Oct 2005 15:52:55 +0100)
> Date: Fri, 21 Oct 2005 15:52:55 +0100
> From: Andrew STUBBS <andrew.stubbs@st.com>
> Cc: gdb-patches@sources.redhat.com
>
> I have attached a patch implementing this. I have also attached a
> slightly improved version of the one I posted before.
Thanks.
> I am not entirely happy with the tagged union approach. There are a
> number of places where it just assumes that the union must be doing the
> right thing here. The only other possibility would be to assert. It
> does, however, solve the problem at hand.
I think we should gdb_assert usage of the right union member.
> Does either of these grab your fancy?
The second one (but see the comments below).
> @@ -347,7 +349,12 @@ tui_set_is_exec_point_at (union tui_line
> {
> int new_state;
>
> - if (content[i]->which_element.source.line_or_addr.addr == l.addr)
> + if (content[i]->which_element.source.line_or_addr.loa == l.loa
> + && ((l.loa == LOA_LINE
> + && content[i]->which_element.source.line_or_addr.u.line_no
> + == l.u.line_no)
> + || (content[i]->which_element.source.line_or_addr.u.addr
> + == l.u.addr)))
> new_state = TRUE;
> else
Why didn't you test l.loa to be LOA_ADDRESS before comparing the
addresses?
> @@ -417,9 +424,9 @@ tui_update_breakpoint_info (struct tui_w
> if ((win == TUI_SRC_WIN
> && bp->source_file
> && (strcmp (src->filename, bp->source_file) == 0)
> - && bp->line_number == line->line_or_addr.line_no)
> + && bp->line_number == line->line_or_addr.u.line_no)
> || (win == TUI_DISASM_WIN
> - && bp->loc->address == line->line_or_addr.addr))
> + && bp->loc->address == line->line_or_addr.u.addr))
Similarly here: I think the tag should be tested before you treat the
value as a lineno or an address.
> @@ -614,7 +621,7 @@ tui_line_is_displayed (int line, struct
> while (i < win_info->generic.content_size - threshold && !is_displayed)
> {
> is_displayed = (((struct tui_win_element *)
> - win_info->generic.content[i])->which_element.source.line_or_addr.line_no
> + win_info->generic.content[i])->which_element.source.line_or_addr.u.line_no
> == (int) line);
> i++;
> }
> @@ -640,7 +647,7 @@ tui_addr_is_displayed (CORE_ADDR addr, s
> while (i < win_info->generic.content_size - threshold && !is_displayed)
> {
> is_displayed = (((struct tui_win_element *)
> - win_info->generic.content[i])->which_element.source.line_or_addr.addr
> + win_info->generic.content[i])->which_element.source.line_or_addr.u.addr
> == addr);
> i++;
> }
And here.
next prev parent reply other threads:[~2005-10-21 22:13 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-10-17 14:52 Andrew STUBBS
2005-10-17 15:02 ` Andrew STUBBS
2005-10-19 9:15 ` Eli Zaretskii
2005-10-19 9:51 ` Andrew STUBBS
2005-10-19 12:28 ` Daniel Jacobowitz
2005-10-19 16:22 ` Andrew STUBBS
2005-10-19 20:03 ` Eli Zaretskii
2005-10-19 20:08 ` Daniel Jacobowitz
2005-10-19 20:22 ` Mark Kettenis
2005-10-20 8:43 ` Eli Zaretskii
2005-10-20 10:18 ` Andrew STUBBS
2005-10-20 16:20 ` Andrew STUBBS
2005-10-20 17:56 ` Daniel Jacobowitz
2005-10-20 19:41 ` Eli Zaretskii
2005-10-21 14:55 ` Andrew STUBBS
2005-10-21 16:39 ` Daniel Jacobowitz
2005-10-21 22:03 ` Eli Zaretskii
2005-10-21 22:13 ` Eli Zaretskii [this message]
2005-10-24 10:28 ` Andrew STUBBS
2005-10-24 11:06 ` Eli Zaretskii
2005-10-24 12:56 ` Andrew STUBBS
2005-10-25 10:45 ` Eli Zaretskii
2005-11-01 16:24 ` Andrew STUBBS
2005-11-01 16:28 ` Daniel Jacobowitz
2005-11-01 17:43 ` Andrew STUBBS
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=u7jc6plgn.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=andrew.stubbs@st.com \
--cc=gdb-patches@sources.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