remote XOpenDisplay in Solaris (SunOS 5.6)

David Korn dkorn@pixelpower.com
Wed Feb 28 02:12:00 GMT 2001


>-----Original Message-----
>From: Jerry Miller [ mailto:gmiller@cs.sunysb.edu ]
>Sent: 27 February 2001 18:43


>I thought I had a clever idea for detection corruption in the
>XOpenDisplay function.  I would simply cast the function
>address to a char * and dump the contents.
>
>Of course, I then remembered my own development of
>a linker for the 6809 many years ago.  I simply reserved
>space for a JMP statement to be resolved by the linker.

    Hi Jerry,

  I'm not quite sure what you're getting at here; are you worried that
the actual program code itself is being overwritten perhaps by a stray 
pointer?  That's always a possibility but I thought Solaris had an MMU
and would mark the text pages of your application as read-only, so if
that was going to happen you'd get a SEGV.  I could be wrong of course,
particularly if it's an early 68xxx series.

  Anyway your technique (assuming it's not superfluous because of write
protection on the code) is sound; linkers are generally just as happy to
resolve the address in the operand field of a load instruction as they
are to resolve the address in the operand field of a jump instruction,
so it should work fine. Indeed, I use the same technique myself.  You can
simplify it a bit; rather than dumping the entire contents of the 
function to see what changes, just keep a checksum of the region in a 
static variable somewhere and see if it changes; then you'll have a lot
less debugging output to plough through visually.  If that technique
shows that the checksum does indeed change, that's the time to start
dumping the function out; and even then it might not be a terribly 
useful exercise.  Although it is conceivable that you might see a word
has been changed to a bit pattern that you can recognize as a specific
piece of data from some identifiable part of the program, it's more likely
to just be zeros or junk.  But at least it would tell you what's going
on.

>So it turns out that what I really need is a load map.
>I've been through the man pages for ld, but the only
>reference that looks relevant (but isn't) is -M.  Any
>suggestions?

  *Why* isn't the -M or -Map option relevant?  And from this and your
other mail on the subject, I'm starting to wonder: is your gcc set up
to use the GNU linker or the Solaris one?  Check the output from your
build when you add the -v flag to the gcc command line.

     DaveK
-- 
 All your base are belong to us!


**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.

www.mimesweeper.com
**********************************************************************



More information about the Gcc-help mailing list