This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: PATCH: Problem union comparision in TUI
- From: Daniel Jacobowitz <drow at false dot org>
- To: Andrew STUBBS <andrew dot stubbs at st dot com>
- Cc: Eli Zaretskii <eliz at gnu dot org>, gdb-patches at sources dot redhat dot com
- Date: Wed, 19 Oct 2005 08:28:17 -0400
- Subject: Re: PATCH: Problem union comparision in TUI
- References: <4353BA69.1030401@st.com> <u1x2hc1gh.fsf@gnu.org> <43561685.3010300@st.com>
On Wed, Oct 19, 2005 at 10:48:53AM +0100, Andrew STUBBS wrote:
> Is there any reason for using a union here? It's not like one value is
> float and the other int - both are ints and the fact that you can't tell
> which you are using shows nobody actually uses the distinction (unless I
> have missed something). The union doesn't save any space, nor does it
> make the code any more efficient.
>
> We could just use:
>
> CORE_ADDR line_or_address;
>
> and leave it at that.
I'd rather that.
It seems possible to figure out which one it's using - always file line
numbers for source displays and addresses for assembly displays.
if ((win == TUI_SRC_WIN
&& bp->source_file
&& (strcmp (src->filename, bp->source_file) == 0)
&& bp->line_number == line->line_or_addr.line_no)
|| (win == TUI_DISASM_WIN
&& bp->loc->address == line->line_or_addr.addr))
But why bother...
--
Daniel Jacobowitz
CodeSourcery, LLC