This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
RE: [RFC patch]: Adjust the use of 'long' type in dwarf2.h header
- From: "Pierre Muller" <pierre dot muller at ics-cnrs dot unistra dot fr>
- To: "'Kai Tietz'" <ktietz70 at googlemail dot com>, "'GCC Patches'" <gcc-patches at gcc dot gnu dot org>, "'Binutils'" <binutils at sourceware dot org>, "'gdb'" <gdb at sourceware dot org>
- Cc: "'Jakub Jelinek'" <jakub at redhat dot com>, "'Joel Brobecker'" <brobecker at adacore dot com>
- Date: Mon, 21 Feb 2011 14:09:24 +0100
- Subject: RE: [RFC patch]: Adjust the use of 'long' type in dwarf2.h header
- References: <AANLkTimPMPKd=Hfz-1e_aSw_iQsdm2SMK5hwR0sd+tga@mail.gmail.com>
I was just wondering about all those
_("Text with some 0x" BFD_VMA_FMT "x\n"), adr);
constructs:
If we do the translations on a 64-bit unix machine
we will have translations for
"Text with some 0xllx\n"
but a mingw 64-bit executable will look for
"Text with some 0xI64x\n"
while a 32-bit system will look for
"Text with some 0xlx\n"
and in both cases, no translation will be found.
Wouldn't it be better to use something similar
to paddress in src/gdb/utils.c
let's call it dwarf_vma function,
so that we have:
_("Text with some 0x%s\n"), dwarf_vma (adr));
with a unique "Text with some 0x%s\n"
string that gets internationalized correctly?
Pierre Muller
GDB pascal language maintainer
> -----Message d'origine-----
> De?: gdb-owner@sourceware.org [mailto:gdb-owner@sourceware.org] De la
> part de Kai Tietz
> Envoyé?: jeudi 17 février 2011 15:22
> À?: GCC Patches; Binutils; gdb
> Cc?: Jakub Jelinek; Joel Brobecker
> Objet?: [RFC patch]: Adjust the use of 'long' type in dwarf2.h header
>
> Hello,
>
> This patch addresses issues I've seen in binutils about
> cross-compilers and dwarf2 display via objdump -W on hosts, which have
> sizeof (long) < target's sizeof(void *). Additionally same issue of
> course can be seen on LLP64 targets, too.
> Those issues are caused by the fact that the dwarf2.h header in
> include/ is using unconditionally the type 'unsigned long' for
> vma-scalars.
>
> This patch address additionally the binutils' dwarf.(c|h) files and
> make them host bitness independent for gcc base toolchains supporting
> the 'long long' type.
>
> I've tested the attached patches for gdb, binutils, and gcc on
> i686-w64-mingw32, and x86_64-w64-mingw32 cross-toolchains hosted on
> cygwin. And I didn't found until now regressions. Later this day I
> want to do a regression test for linux64, too.
>
>
> binutils, gdb, gcc
>
> ChangeLog include/
>
> 2011-02-17 Kai Tietz
>
> * dwarf2.h (dw2_vma_t): New type.
> (dw2_svma_t): New type.
> (DW2_VMA_FMT): New macro specifying
> to be used width-sepecifier for printing
> new types.
>
>
> ChangeLog binutils/
>
> 2011-02-17 Kai Tietz
>
> * dwarf.c (read_leb128): Use dw2_vma_t instead of
> long type.
> (process_extended_line_op): Use for adr new type
> and print dw2 values via DW2_VMA_FMT.
> (fetch_indirect_string): Adjust offset's type.
> (decode_location_expression): Adjust argument types
> and uvalue type.
> (read_and_display_attr_value): Likewise.
> (read_and_display_attr): Likewise.
> (decode_location_expression): Adjust printf format.
> (process_debug_info): Likewise.
> (display_debug_lines_raw): Likewise.
> (display_debug_lines_decoded): Likewise.
> (display_debug_pubnames): Likewise.
> (display_debug_loc): Likewise.
> (display_debug_aranges): Likewise.
> * dwarf.h: Add include of dwarf2.h header and
> use of dw2_vma_t instead of long types.
> (read_leb128): Adjust return type.
>
>
> Regards,
> Kai
>
>
> PS: On gdb there is at the moment in gdb/common part the include-path
> to intl for libintl.h missing