public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
* found gdbarch solib issue
@ 2003-06-16 20:42 Kris Warkentin
  2003-06-16 21:57 ` Daniel Jacobowitz
  0 siblings, 1 reply; 3+ messages in thread
From: Kris Warkentin @ 2003-06-16 20:42 UTC (permalink / raw)
  To: Gdb@Sources.Redhat.Com; +Cc: Mark Kettenis

So I was tracing around trying to figure out why my
sysv_fetch_link_map_offsets function was getting lost when architectures
were changing.  I noticed that <arch>_init_abi was being called which then
calls my <arch>nto_init_abi through gdbarch_init_osabi().

Problem was, at some point we're changing arches for some reason, whether
setting it from a file or whatever, and the generic init_abi is called
again.  This time, however, my handler for nto_init_abi isn't called.

The change that makes this problem go away is below but I'm not entirely
confident that it's the right thing to do.  If you look at the 'compatible'
function, ie. mips_compatible, all it's doing is comparing arches.  The
original test below is comparing pointers which I think might not be right.
Either way, if I do this change, all my worries fly away.

Any reason anyone can think of why this might be bad?

cheers,

Kris

RCS file: /cvs/src/src/gdb/osabi.c,v
retrieving revision 1.15
diff -u -5 -r1.15 osabi.c
--- osabi.c 8 Jun 2003 18:27:14 -0000 1.15
+++ osabi.c 16 Jun 2003 20:33:38 -0000
@@ -309,12 +309,11 @@

   NOTE: kettenis/20021027: There may be more than one machine
   type that is compatible with the desired machine type.  Right
   now we simply return the first match, which is fine for now.
   However, we might want to do something smarter in the future.  */
-      compatible = arch_info->compatible (arch_info, handler->arch_info);
-      if (compatible == handler->arch_info)
+      if(arch_info->compatible (arch_info, handler->arch_info))
  {
    (*handler->init_osabi) (info, gdbarch);
    return;
  }


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

* Re: found gdbarch solib issue
  2003-06-16 20:42 found gdbarch solib issue Kris Warkentin
@ 2003-06-16 21:57 ` Daniel Jacobowitz
  2003-06-17  0:40   ` Kris Warkentin
  0 siblings, 1 reply; 3+ messages in thread
From: Daniel Jacobowitz @ 2003-06-16 21:57 UTC (permalink / raw)
  To: Kris Warkentin; +Cc: Gdb@Sources.Redhat.Com, Mark Kettenis

On Mon, Jun 16, 2003 at 04:42:39PM -0400, Kris Warkentin wrote:
> So I was tracing around trying to figure out why my
> sysv_fetch_link_map_offsets function was getting lost when architectures
> were changing.  I noticed that <arch>_init_abi was being called which then
> calls my <arch>nto_init_abi through gdbarch_init_osabi().
> 
> Problem was, at some point we're changing arches for some reason, whether
> setting it from a file or whatever, and the generic init_abi is called
> again.  This time, however, my handler for nto_init_abi isn't called.
> 
> The change that makes this problem go away is below but I'm not entirely
> confident that it's the right thing to do.  If you look at the 'compatible'
> function, ie. mips_compatible, all it's doing is comparing arches.  The
> original test below is comparing pointers which I think might not be right.
> Either way, if I do this change, all my worries fly away.
> 
> Any reason anyone can think of why this might be bad?

Shouldn't it be returning arch_info anyway?  Why isn't it?  Is it
returning handler->arch_info?

> -      compatible = arch_info->compatible (arch_info, handler->arch_info);
> -      if (compatible == handler->arch_info)
> +      if(arch_info->compatible (arch_info, handler->arch_info))

-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer

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

* Re: found gdbarch solib issue
  2003-06-16 21:57 ` Daniel Jacobowitz
@ 2003-06-17  0:40   ` Kris Warkentin
  0 siblings, 0 replies; 3+ messages in thread
From: Kris Warkentin @ 2003-06-17  0:40 UTC (permalink / raw)
  To: Daniel Jacobowitz; +Cc: Gdb@Sources.Redhat.Com, Mark Kettenis

> Shouldn't it be returning arch_info anyway?  Why isn't it?  Is it
> returning handler->arch_info?

That's what was puzzling me.  I was looking through the linked list of 10
million mips arches and thinking what the odds were of compatible ever
equalling the handler arch_info.  Seems to me that the return value might be
useful in some circumstances but in this case it should be a boolean, "am I
compatible or not?"

> > -      compatible = arch_info->compatible (arch_info,
handler->arch_info);
> > -      if (compatible == handler->arch_info)
> > +      if(arch_info->compatible (arch_info, handler->arch_info))

cheers,

Kris

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

end of thread, other threads:[~2003-06-17  0:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-06-16 20:42 found gdbarch solib issue Kris Warkentin
2003-06-16 21:57 ` Daniel Jacobowitz
2003-06-17  0:40   ` Kris Warkentin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).