Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Andrew STUBBS <andrew.stubbs@st.com>
To: gdb-patches@sources.redhat.com
Subject: PATCH: Problem union comparision in TUI
Date: Mon, 17 Oct 2005 14:52:00 -0000	[thread overview]
Message-ID: <4353BA69.1030401@st.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 1168 bytes --]

Hi,

I have observed this problem in the sh-elf configuration of GDB. It is 
not visible in the i686-linux configuration because it uses the 
following union in a different way.

/* Structure describing source line or line address */
union tui_line_or_address
{
   int line_no;
   CORE_ADDR addr;
};


The problem is that the union is always compared using 'addr'. In the 
case where it was set using 'line_no', as it is in sh-elf, half the 
union contains garbage. This appears to be killing the comparison in 
tui_set_is_exec_point_at() in tui-winsource.c.

The result is that the current line is never highlighted as it should 
be. I assume the reason it works on i686-linux is that that host/target 
uses the addr field rather than the line_no field.

The attached patch provides one way to fix the problem. I could not 
think of any way to fix the comparison because there is no way I can see 
to know which mode it is using, so I have changed the type of line_no in 
the union to match the type of addr. This does not seem to be the Right 
Thing to do with a union (because it might as well be one variable), but 
I can't see any other down side.

Andrew Stubbs

[-- Attachment #2: tui-union-compare.patch --]
[-- Type: text/plain, Size: 429 bytes --]

Index: src/gdb/tui/tui-data.h
===================================================================
--- src.orig/gdb/tui/tui-data.h	2004-03-13 14:14:01.000000000 +0000
+++ src/gdb/tui/tui-data.h	2005-10-17 14:21:23.000000000 +0100
@@ -149,7 +149,7 @@ enum tui_register_display_type
 /* Structure describing source line or line address */
 union tui_line_or_address
 {
-  int line_no;
+  CORE_ADDR line_no;
   CORE_ADDR addr;
 };
 

             reply	other threads:[~2005-10-17 14:52 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-10-17 14:52 Andrew STUBBS [this message]
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
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=4353BA69.1030401@st.com \
    --to=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