Use malloc/free in the dbgapi callbacks
[deliverable/binutils-gdb.git] / gdb / buildsym.h
index 2f46deba7790ced0ab7c07c51782434a83be5e89..1e57fe471120a57ed10657a4d0c93ddc2f460a49 100644 (file)
@@ -1,5 +1,6 @@
 /* Build symbol tables in GDB's internal format.
-   Copyright (C) 1986-2018 Free Software Foundation, Inc.
+   Copyright (C) 1986-2020 Free Software Foundation, Inc.
+   Copyright (C) 2019-2020 Advanced Micro Devices, Inc. All rights reserved.
 
    This file is part of GDB.
 
@@ -19,6 +20,8 @@
 #if !defined (BUILDSYM_H)
 #define BUILDSYM_H 1
 
+#include "gdb_obstack.h"
+
 struct objfile;
 struct symbol;
 struct addrmap;
@@ -256,7 +259,7 @@ struct buildsym_compunit
 
   void record_debugformat (const char *format)
   {
-    m_debugformat = format;
+    m_debugformat = make_unique_xstrdup (format);
   }
 
   void record_producer (const char *producer)
@@ -323,9 +326,8 @@ private:
      the same lifetime as objfile.  */
   const char *m_producer = nullptr;
 
-  /* Space for this is not malloc'd, and is assumed to have at least
-     the same lifetime as objfile.  */
-  const char *m_debugformat = nullptr;
+  /* Space for this is malloc'd.  */
+  gdb::unique_xmalloc_ptr<char> m_debugformat;
 
   /* The compunit we are building.  */
   struct compunit_symtab *m_compunit_symtab = nullptr;
This page took 0.025974 seconds and 4 git commands to generate.