This simplifies the code a bit.
gdb/ChangeLog:
* psymtab.c (partial_symtab::partial_symtab): Change
last_objfile_name to be an std::string.
* symfile.c (allocate_symtab): Likewise.
Change-Id: I3dfe217233ed9346c2abc04a9b1be0df69a90af8
+2021-04-02 Simon Marchi <simon.marchi@polymtl.ca>
+
+ * psymtab.c (partial_symtab::partial_symtab): Change
+ last_objfile_name to be an std::string.
+ * symfile.c (allocate_symtab): Likewise.
+
2021-04-02 Simon Marchi <simon.marchi@polymtl.ca>
* objfiles.h (struct objfile_per_bfd_storage) <intern>: New
{
/* Be a bit clever with debugging messages, and don't print objfile
every time, only when it changes. */
- static char *last_objfile_name = NULL;
+ static std::string last_objfile_name;
+ const char *this_objfile_name = objfile_name (objfile);
- if (last_objfile_name == NULL
- || strcmp (last_objfile_name, objfile_name (objfile)) != 0)
+ if (last_objfile_name.empty () || last_objfile_name != this_objfile_name)
{
- xfree (last_objfile_name);
- last_objfile_name = xstrdup (objfile_name (objfile));
+ last_objfile_name = this_objfile_name;
fprintf_filtered (gdb_stdlog,
"Creating one or more psymtabs for objfile %s ...\n",
- last_objfile_name);
+ this_objfile_name);
}
fprintf_filtered (gdb_stdlog,
"Created psymtab %s for module %s.\n",
{
/* Be a bit clever with debugging messages, and don't print objfile
every time, only when it changes. */
- static char *last_objfile_name = NULL;
+ static std::string last_objfile_name;
+ const char *this_objfile_name = objfile_name (objfile);
- if (last_objfile_name == NULL
- || strcmp (last_objfile_name, objfile_name (objfile)) != 0)
+ if (last_objfile_name.empty () || last_objfile_name != this_objfile_name)
{
- xfree (last_objfile_name);
- last_objfile_name = xstrdup (objfile_name (objfile));
+ last_objfile_name = this_objfile_name;
fprintf_filtered (gdb_stdlog,
"Creating one or more symtabs for objfile %s ...\n",
- last_objfile_name);
+ this_objfile_name);
}
fprintf_filtered (gdb_stdlog,
"Created symtab %s for module %s.\n",