X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=gdb%2Fobjfiles.h;fp=gdb%2Fobjfiles.h;h=a568fa4bcdac82cdaf7415755b7ecbca6a3bcbf1;hb=be1e3d3eab0af2a140463757a1ba3977167551af;hp=b71a8a9edb8e199ec4492a790b49165bf99b0383;hpb=4e7625fde223fd0c98f09f41fe924e7317a82e1a;p=deliverable%2Fbinutils-gdb.git diff --git a/gdb/objfiles.h b/gdb/objfiles.h index b71a8a9edb..a568fa4bcd 100644 --- a/gdb/objfiles.h +++ b/gdb/objfiles.h @@ -275,13 +275,9 @@ struct objfile_per_bfd_storage auto_obstack storage_obstack; - /* Byte cache for file names. */ + /* String cache. */ - gdb::bcache filename_cache; - - /* Byte cache for macros. */ - - gdb::bcache macro_cache; + gdb::bcache string_cache; /* The gdbarch associated with the BFD. Note that this gdbarch is determined solely from BFD information, without looking at target @@ -533,6 +529,22 @@ public: return section_offsets[SECT_OFF_DATA (this)]; } + /* Intern STRING and return the unique copy. The copy has the same + lifetime as the per-BFD object. */ + const char *intern (const char *str) + { + return (const char *) per_bfd->string_cache.insert (str, strlen (str) + 1); + } + + /* Intern STRING and return the unique copy. The copy has the same + lifetime as the per-BFD object. */ + const char *intern (const std::string &str) + { + return (const char *) per_bfd->string_cache.insert (str.c_str (), + str.size () + 1); + } + + /* The object file's original name as specified by the user, made absolute, and tilde-expanded. However, it is not canonicalized (i.e., it has not been passed through gdb_realpath).