Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions lldb/include/lldb/Symbol/SymbolFile.h
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,15 @@ class SymbolFile : public PluginInterface {
/// for this module have been changed.
virtual void SectionFileAddressesChanged() = 0;

/// Looks for the compile option specified by \p option, and sets \p value to
/// it's value. For example, for a flag such as -foo=bar, looking up \p option
/// "-foo" will set \p value to "bar". For a standalone flag such as -baz, \p
/// value will be empty.
///
/// If \p cu is set, only that compile unit is searched. Otherwise, every
/// compile unit is searched until the option is found or failure.
///
/// Returns true if the option is found.
virtual bool GetCompileOption(const char *option, std::string &value,
CompileUnit *cu = nullptr) {
value.clear();
Expand Down
7 changes: 5 additions & 2 deletions lldb/include/lldb/Target/Target.h
Original file line number Diff line number Diff line change
Expand Up @@ -1204,11 +1204,14 @@ class Target : public std::enable_shared_from_this<Target>,
// 2 - if there is a process, then read from memory
// 3 - if there is no process, then read from the file cache
//
// The optional did_read_live_memory parameter will be set true if live memory
// was read successfully.
//
// The method is virtual for mocking in the unit tests.
virtual size_t ReadMemory(const Address &addr, void *dst, size_t dst_len,
Status &error, bool force_live_memory = false,
lldb::addr_t *load_addr_ptr = nullptr);

lldb::addr_t *load_addr_ptr = nullptr,
bool *did_read_live_memory = nullptr);
size_t ReadCStringFromMemory(const Address &addr, std::string &out_str,
Status &error, bool force_live_memory = false);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -358,12 +358,12 @@ class LLDBExprNameLookup : public LLDBNameLookup {
swift::Identifier getPreferredPrivateDiscriminator() override {
if (m_sc.comp_unit) {
if (lldb_private::Module *module = m_sc.module_sp.get()) {
if (lldb_private::SymbolFile *symbol_file =
module->GetSymbolFile()) {
if (lldb_private::SymbolFile *symbol_file = module->GetSymbolFile()) {
std::string private_discriminator_string;
if (symbol_file->GetCompileOption("-private-discriminator",
private_discriminator_string,
m_sc.comp_unit)) {
private_discriminator_string,
m_sc.comp_unit) &&
!private_discriminator_string.empty()) {
return m_source_file.getASTContext().getIdentifier(
private_discriminator_string);
}
Expand Down
Loading