5 Jul 21:35
Re: GSoC ShlibMemLoad
From: Andreas Kupries <akupries@...>
Subject: Re: GSoC ShlibMemLoad
Newsgroups: gmane.comp.lang.tcl.core
Date: 2008-07-05 19:38:24 GMT
Subject: Re: GSoC ShlibMemLoad
Newsgroups: gmane.comp.lang.tcl.core
Date: 2008-07-05 19:38:24 GMT
> > While walking to the office I managed to come up with a number of additional
> > ideas ...
> >
> > printf is different from the other functions in two respects.
> >
> > It takes a variable number of arguments,
> > and it operates at a higher IO level than write and consorts.
> >
> > Both might be a possible source of the problem I guess.
> > Although I have no idea of how that could be.
> >
> > Things to consider:
> >
> > - Does using 'sprintf()' (+write) work ?
> > sprintf is also varargs, but doesn't do any I/O
> sprintf does not work
> >
> > - Does 'fprintf()' work ?
> > It is like printf, i.e. varargs and highlevel I/O
> > However it explicitly takes an output argument.
> > printf (...) is like fprintf (stdout, ...).
> fprintf does not work
> > - Does fflush() work?
> > Highlevel I/O, but no varargs. It is also outside
> > of the printf family of functions in general.
> fflush surprisingly works...
> Anyway, the problem is not in varargs, because I also tried with
> functions like putchar, puts, etc and they all does not work.
Hm ... All these functions have lots of state ...
Some leading questions ...
You are using 'printf' in rtld itself to print log/debug messages, and
it works there. What is the address of this 'printf' function ?
Is the address of the 'printf' function seen by the loaded
test-library the same ? (**)
If not, why?
Do you remember my comments about missing symbols ?
I.e.: The list of libraries we have in our rtld is the list of
memory-loaded libraries (ML/lib) and not of all libraries
(ALL/lib).
And a symbol not found in ML/lib has to be looked for in
ALL/lib too ?
What does that same distinction mean for 'load_needed_objects' ?
And (especially) a library like 'libc.so' which is loaded by the OS
and thus in ALL/lib?
(**) In (one of) the other test libraries you are using a for-loop and
write to print the pid. If you encapsulate that into a function
FOO to generally print unsigned numbers and then put FOO into the
libprintf code you can print any number you need, like function
addresses. Inside of rtld itself it is of course possible to use
the working printf to print its address.
--
--
So long,
Andreas Kupries <akupries@...>
<http://www.purl.org/NET/akupries/>
Developer @ <http://www.activestate.com/>
-------------------------------------------------------------------------------
-------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
RSS Feed