[PATCH RFC] solib-svr4 cleanups

Andrew Cagney ac131313@cygnus.com
Mon Mar 5 08:11:00 GMT 2001

> Here's how it'll work.  In your (already multiarched) -tdep.c file,
> you'll include solib-svr4.h.  You'll also define a function which'll
> fill in and return a pointer to a link_map_offsets struct.  (See
> sh_link_svr4_fetch_link_map_offsets in sh-tdep.c for an example. 

Just a heads up here for people other then Kevin :-)

I think the ..._offsets() mechanism is pretty generic.  I'm sure there
are other parts of GDB that, at present, drag in native header files to
obtain descriptions of target data structures.  If someone indicates a
desire to fix one of these other parts then generalizing svr4's ofset
mechanism would most likely be a part of that.

(footnote: target is the system being debugged; native is the host as a
target; host is the system that GDB is running on; build is the system
that gdb was built on)  

> Anyway...  I'm not very good at choosing names for new files, so I
> thought I'd let folks comment on my filename choice before committing
> it.  If you have objections to the name that I've chosen (that 8.3
> problem comes to mind), please suggest a meaningful alternative.

Moving it to a separate file is definitly a good move.  As for a name,
what about a more general tbd-*.c (to be deleted)?  There are other
files with the same problem and I'm sure the maintainers would pounce on
the oportunity to boot their legacy code into another file :-)

Anyway, a slightly more tangental thought. You might consider massaging
some of that code into an internal consistency check.  For select native
configs, it would verify the value of the link map supplied by the
target.  I say select because it wouldn't work on a native GDB capable
of debugging more than one executable (eg SPARC 32 and 64).



Suggest writing

+  if (legacy_svr4_fetch_link_map_offsets_hook)
+    return legacy_svr4_fetch_link_map_offsets_hook ();
+  else

as just

	if (....)
	   return ...


that way, when the legacy code gets deleted the file doesn't need to be
re-indented :-)

More information about the Gdb-patches mailing list