Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* PATCH: Problem union comparision in TUI
@ 2005-10-17 14:52 Andrew STUBBS
  2005-10-17 15:02 ` Andrew STUBBS
  2005-10-19  9:15 ` Eli Zaretskii
  0 siblings, 2 replies; 25+ messages in thread
From: Andrew STUBBS @ 2005-10-17 14:52 UTC (permalink / raw)
  To: gdb-patches

[-- 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;
 };
 

^ permalink raw reply	[flat|nested] 25+ messages in thread

end of thread, other threads:[~2005-11-01 17:43 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-10-17 14:52 PATCH: Problem union comparision in TUI 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
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox