aboutsummaryrefslogtreecommitdiff
path: root/gdb/psymtab.c
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@polymtl.ca>2021-04-02 11:39:55 -0400
committerSimon Marchi <simon.marchi@polymtl.ca>2021-04-02 11:39:55 -0400
commit9984dd9994c3d71fd28f41c50cdece48d6be13a6 (patch)
treec1558384491c1187e4e664f061cdeb0f89517891 /gdb/psymtab.c
parent4a4f97c129b26445ff14d0e5323feeb80610a539 (diff)
downloadgdb-9984dd9994c3d71fd28f41c50cdece48d6be13a6.zip
gdb-9984dd9994c3d71fd28f41c50cdece48d6be13a6.tar.gz
gdb-9984dd9994c3d71fd28f41c50cdece48d6be13a6.tar.bz2
gdb: use std::string in partial_symtab::partial_symtab / allocate_symtab
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
Diffstat (limited to 'gdb/psymtab.c')
-rw-r--r--gdb/psymtab.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/gdb/psymtab.c b/gdb/psymtab.c
index b51881d..26ea35e 100644
--- a/gdb/psymtab.c
+++ b/gdb/psymtab.c
@@ -1574,16 +1574,15 @@ partial_symtab::partial_symtab (const char *filename_,
{
/* 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",