Skip to content

Commit 57b3f92

Browse files
authored
Merge pull request #11132 from augusto2112/rebranch-cp-remote-addr
[stable/21.x] Cherry-pick remote address commits
2 parents c359d97 + bf89001 commit 57b3f92

File tree

12 files changed

+198
-141
lines changed

12 files changed

+198
-141
lines changed

lldb/include/lldb/Symbol/SymbolFile.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -387,6 +387,15 @@ class SymbolFile : public PluginInterface {
387387
/// for this module have been changed.
388388
virtual void SectionFileAddressesChanged() = 0;
389389

390+
/// Looks for the compile option specified by \p option, and sets \p value to
391+
/// it's value. For example, for a flag such as -foo=bar, looking up \p option
392+
/// "-foo" will set \p value to "bar". For a standalone flag such as -baz, \p
393+
/// value will be empty.
394+
///
395+
/// If \p cu is set, only that compile unit is searched. Otherwise, every
396+
/// compile unit is searched until the option is found or failure.
397+
///
398+
/// Returns true if the option is found.
390399
virtual bool GetCompileOption(const char *option, std::string &value,
391400
CompileUnit *cu = nullptr) {
392401
value.clear();

lldb/include/lldb/Target/Target.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1204,11 +1204,14 @@ class Target : public std::enable_shared_from_this<Target>,
12041204
// 2 - if there is a process, then read from memory
12051205
// 3 - if there is no process, then read from the file cache
12061206
//
1207+
// The optional did_read_live_memory parameter will be set true if live memory
1208+
// was read successfully.
1209+
//
12071210
// The method is virtual for mocking in the unit tests.
12081211
virtual size_t ReadMemory(const Address &addr, void *dst, size_t dst_len,
12091212
Status &error, bool force_live_memory = false,
1210-
lldb::addr_t *load_addr_ptr = nullptr);
1211-
1213+
lldb::addr_t *load_addr_ptr = nullptr,
1214+
bool *did_read_live_memory = nullptr);
12121215
size_t ReadCStringFromMemory(const Address &addr, std::string &out_str,
12131216
Status &error, bool force_live_memory = false);
12141217

lldb/source/Plugins/ExpressionParser/Swift/SwiftExpressionParser.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -358,12 +358,12 @@ class LLDBExprNameLookup : public LLDBNameLookup {
358358
swift::Identifier getPreferredPrivateDiscriminator() override {
359359
if (m_sc.comp_unit) {
360360
if (lldb_private::Module *module = m_sc.module_sp.get()) {
361-
if (lldb_private::SymbolFile *symbol_file =
362-
module->GetSymbolFile()) {
361+
if (lldb_private::SymbolFile *symbol_file = module->GetSymbolFile()) {
363362
std::string private_discriminator_string;
364363
if (symbol_file->GetCompileOption("-private-discriminator",
365-
private_discriminator_string,
366-
m_sc.comp_unit)) {
364+
private_discriminator_string,
365+
m_sc.comp_unit) &&
366+
!private_discriminator_string.empty()) {
367367
return m_source_file.getASTContext().getIdentifier(
368368
private_discriminator_string);
369369
}

0 commit comments

Comments
 (0)