Fix assertion failure in linux-thread-db
[deliverable/binutils-gdb.git] / gdb / minidebug.c
index 385566aeca1678f279f4ef736fa2351e8d612588..17c12f9210a0e0ca57328066bbef715523d76507 100644 (file)
@@ -1,6 +1,6 @@
 /* Read MiniDebugInfo data from an objfile.
 
-   Copyright (C) 2012-2013 Free Software Foundation, Inc.
+   Copyright (C) 2012-2015 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -19,7 +19,6 @@
 
 #include "defs.h"
 #include "gdb_bfd.h"
-#include "gdb_string.h"
 #include "symfile.h"
 #include "objfiles.h"
 #include "gdbcore.h"
@@ -53,7 +52,7 @@ static lzma_allocator gdb_lzma_allocator = { alloc_lzma, free_lzma, NULL };
    a section.  This keeps only the last decompressed block in memory
    to allow larger data without using to much memory.  */
 
-struct lzma_stream
+struct gdb_lzma_stream
 {
   /* Section of input BFD from which we are decoding data.  */
   asection *section;
@@ -71,8 +70,8 @@ struct lzma_stream
    find_separate_debug_file_in_section.  OPEN_CLOSURE is 'asection *'
    of the section to decompress.
 
-   Return 'struct lzma_stream *' must be freed by caller by xfree, together
-   with its INDEX lzma data.  */
+   Return 'struct gdb_lzma_stream *' must be freed by caller by xfree,
+   together with its INDEX lzma data.  */
 
 static void *
 lzma_open (struct bfd *nbfd, void *open_closure)
@@ -85,7 +84,7 @@ lzma_open (struct bfd *nbfd, void *open_closure)
   lzma_index *index;
   int ret;
   uint64_t memlimit = UINT64_MAX;
-  struct lzma_stream *lstream;
+  struct gdb_lzma_stream *lstream;
   size_t pos;
 
   size = bfd_get_section_size (section);
@@ -119,7 +118,7 @@ lzma_open (struct bfd *nbfd, void *open_closure)
     }
   xfree (indexdata);
 
-  lstream = xzalloc (sizeof (struct lzma_stream));
+  lstream = XCNEW (struct gdb_lzma_stream);
   lstream->section = section;
   lstream->index = index;
 
@@ -128,13 +127,13 @@ lzma_open (struct bfd *nbfd, void *open_closure)
 
 /* bfd_openr_iovec PREAD_P implementation for
    find_separate_debug_file_in_section.  Passed STREAM
-   is 'struct lzma_stream *'.  */
+   is 'struct gdb_lzma_stream *'.  */
 
 static file_ptr
 lzma_pread (struct bfd *nbfd, void *stream, void *buf, file_ptr nbytes,
            file_ptr offset)
 {
-  struct lzma_stream *lstream = stream;
+  struct gdb_lzma_stream *lstream = stream;
   bfd_size_type chunk_size;
   lzma_index_iter iter;
   gdb_byte *compressed, *uncompressed;
@@ -215,13 +214,13 @@ lzma_pread (struct bfd *nbfd, void *stream, void *buf, file_ptr nbytes,
 
 /* bfd_openr_iovec CLOSE_P implementation for
    find_separate_debug_file_in_section.  Passed STREAM
-   is 'struct lzma_stream *'.  */
+   is 'struct gdb_lzma_stream *'.  */
 
 static int
 lzma_close (struct bfd *nbfd,
            void *stream)
 {
-  struct lzma_stream *lstream = stream;
+  struct gdb_lzma_stream *lstream = stream;
 
   lzma_index_end (lstream->index, &gdb_lzma_allocator);
   xfree (lstream->data);
@@ -233,15 +232,16 @@ lzma_close (struct bfd *nbfd,
 
 /* bfd_openr_iovec STAT_P implementation for
    find_separate_debug_file_in_section.  Passed STREAM
-   is 'struct lzma_stream *'.  */
+   is 'struct gdb_lzma_stream *'.  */
 
 static int
 lzma_stat (struct bfd *abfd,
           void *stream,
           struct stat *sb)
 {
-  struct lzma_stream *lstream = stream;
+  struct gdb_lzma_stream *lstream = stream;
 
+  memset (sb, 0, sizeof (struct stat));
   sb->st_size = lzma_index_uncompressed_size (lstream->index);
   return 0;
 }
This page took 0.026725 seconds and 4 git commands to generate.