This is the mail archive of the gdb-patches@sourceware.org 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]

Re: [RFA/windows] cast of address to DWORD warning (handle_unload_dll)


> >2009-11-14  Joel Brobecker  <brobecker@adacore.com>
> >
> >        * windows-nat.c (handle_unload_dll): Use host_address to string
> >        in order to print the base address of the DLL that was unloaded.
> >
> >This one is hard to test, because it's supposed to never happen.
> >So I tested it by, ahem, visual inspection (I learnt that expression
> >at my first job, where we were producing safety critical software).
> 
> I guess this is ok.  I just changed other similar occurrences to %p.
> Maybe all of those should also be changed for hobgoblinish consistency
> or this one should be %p too.

I don't mind changing the patch to using %p at all. The reason I avoided
%p is because I was still in this frame of mind that %p depends on
the implementation - to have consistent output, we have to be careful
to not use %p in the core code.  However, I just realized that it's not
necessarily a problem to do so in nat files.

I did double-check what %p does on Windows, though, and apparently it
does not output the leading 0x (but that's only a detail), but also it
prints the hexa digits in capital letters. This may be from not
being used to seeing addresses printed with capital letters, but
I find it harder to read. On the other hand, I have seen this style
being used in stack dumps printed by Windows, so this may be the
usual style on this OS.

For now, I think it's important to be consistent, so here is a new
patch that uses %p (no leading 0x).

2009-01-14  Joel Brobecker  <brobecker@adacore.com>

        * windows-nat.c (handle_unload_dll): Use %p to print the DLL
        base address instead of casting it to DWORD.

-- 
Joel

Attachment: handle_unload.diff
Description: Text document


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