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: [PUSHED] Fix go32-nat.c build fallout from to_detach constification.


> Date: Wed, 15 Jan 2014 16:36:44 +0000
> From: Pedro Alves <palves@redhat.com>
> CC: Eli Zaretskii <eliz@gnu.org>
> 
> I pushed the patch below, approved by Eli offlist.

Thanks.

> FYI, djgpp still doesn't build OOTB:
> 
>  ../../src/binutils/readelf.c: In function 'print_symbol':
>  ../../src/binutils/readelf.c:474:4: error: implicit declaration of function 'mbrtowc' [-Werror=implicit-function-declaration]

This is here:

  #ifdef HAVE_MBSTATE_T
	    /* Try to find out how many bytes made up the character that was
	       just printed.  Advance the symbol pointer past the bytes that
	       were displayed.  */
	    n = mbrtowc (& w, symbol - 1, MB_CUR_MAX, & state);  <<<<<<<<<
  #else
	    n = 1;
  #endif

The code (incorrectly) assumes that if the mbstate_t type is
supported, so is mbrtowc.  DJGPP has the former, but not the latter.
I guess the solution is either to modify the HAVE_MBSTATE_T test or
add a HAVE_MBRTOWC test.

>  cc1: all warnings being treated as errors
>  ...
>  ../../src/gdb/dwarf2read.c: In function 'open_and_init_dwp_file':
>  ../../src/gdb/dwarf2read.c:10550:7: error: format '%d' expects argument of type 'int', but argument 2 has type 'uint32_t' [-Werror=format]
>  ../../src/gdb/dwarf2read.c:10550:7: error: format '%d' expects argument of type 'int', but argument 3 has type 'uint32_t' [-Werror=format]

How does this compile on other platforms?  I see this in dwarf2read.c:

  struct dwp_hash_table
  {
    uint32_t version, nr_columns;
    [...]

  struct dwp_file
  {
    /* Name of the file.  */
    const char *name;
    [...]
    /* Table of CUs in the file.  */
    const struct dwp_hash_table *cus;

    /* Table of TUs in the file.  */
    const struct dwp_hash_table *tus;

And the line which is flagged by the compiler is this:

  /* The DWP file version is stored in the hash table.  Oh well.  */
  if (dwp_file->cus->version != dwp_file->tus->version)
    {
      /* Technically speaking, we should try to limp along, but this is
         pretty bizarre.  */
      error (_("Dwarf Error: DWP file CU version %d doesn't match" <<<<<<
               " TU version %d [in DWP file %s]"), <<<<<<<<<<<<<<<<<<<<<<
             dwp_file->cus->version, dwp_file->tus->version, dwp_name);

So it really tries to format uint32_t values with %d.


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