This is the mail archive of the mailing list for the GDB project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[win32] wrong solib from/to addresses


We are working on porting our product to Vista, and we have noticed
an issue that this version of the MS OS makes more apparent: The from/to
addresses printed in the "info shared" listing are correct only when
the DLL was loaded at the prefered load address (which is in the
ImageBase field of the COFF/PE header).

I collegue of mine told me that, for security reasons, system DLLs
on Vista are now always rebased, and thus, the information printed
by info based is off by a certain offset.

The core of the attached patch is to implement the target_so_ops
method relocate_section_addresses. For that, I needed to compute
the offset between the load address and the image_base, and store
it for later use (during the call of our routine above). There
were two challenges:

  1. Compute this image base. Rather than dig into the COFF/PE
     data, I took a simpler route that I think has already been
     taken: Use the start address of the .text section. I think
     this is already used to do the symbol relocation.

  2. Make that information available: I found that the lm_info
     field was not allocated, so I had to add its initialization.

With all these changes, the address are correct again.

2007-06-12  Joel Brobecker  <>

        * win32-nat.c (struct lm_info): Add new field image_base.
        (solib_symbols_add): Compute the prefered load address
        and save it in the lm_info.
        (register_loaded_dll): Initialize new field image_base.
        (win32_relocate_section_addresses): Implement this routine.
        (win32_current_sos): Allocate and set lm_info data.

Tested on x86-windows, no regression. Dejagnu on Vista is not working
at all for me, so I ran the testsuite on XP instead.

OK to apply?


Attachment: win32-solib-fsf.diff
Description: Text document

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]