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
6 changes: 4 additions & 2 deletions lldb/include/lldb/Target/Target.h
Original file line number Diff line number Diff line change
Expand Up @@ -244,8 +244,6 @@ class TargetProperties : public Properties {

bool GetInjectLocalVariables(ExecutionContext *exe_ctx) const;

void SetInjectLocalVariables(ExecutionContext *exe_ctx, bool b);

void SetRequireHardwareBreakpoints(bool b);

bool GetRequireHardwareBreakpoints() const;
Expand All @@ -259,6 +257,10 @@ class TargetProperties : public Properties {
bool GetDebugUtilityExpression() const;

private:
std::optional<bool>
GetExperimentalPropertyValue(size_t prop_idx,
ExecutionContext *exe_ctx = nullptr) const;

// Callbacks for m_launch_info.
void Arg0ValueChangedCallback();
void RunArgsValueChangedCallback();
Expand Down
24 changes: 9 additions & 15 deletions lldb/source/Target/Target.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
#include "lldb/Symbol/ObjectFile.h"
#include "lldb/Symbol/Symbol.h"
#include "lldb/Target/ABI.h"
#include "lldb/Target/ExecutionContext.h"
#include "lldb/Target/Language.h"
#include "lldb/Target/LanguageRuntime.h"
#include "lldb/Target/Process.h"
Expand Down Expand Up @@ -4227,28 +4228,21 @@ void TargetProperties::UpdateLaunchInfoFromProperties() {
DisableSTDIOValueChangedCallback();
}

bool TargetProperties::GetInjectLocalVariables(
ExecutionContext *exe_ctx) const {
std::optional<bool> TargetProperties::GetExperimentalPropertyValue(
size_t prop_idx, ExecutionContext *exe_ctx) const {
const Property *exp_property =
m_collection_sp->GetPropertyAtIndex(ePropertyExperimental, exe_ctx);
OptionValueProperties *exp_values =
exp_property->GetValue()->GetAsProperties();
if (exp_values)
return exp_values
->GetPropertyAtIndexAs<bool>(ePropertyInjectLocalVars, exe_ctx)
.value_or(true);
else
return true;
return exp_values->GetPropertyAtIndexAs<bool>(prop_idx, exe_ctx);
return std::nullopt;
}

void TargetProperties::SetInjectLocalVariables(ExecutionContext *exe_ctx,
bool b) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

huh, b wasn't even being used.

const Property *exp_property =
m_collection_sp->GetPropertyAtIndex(ePropertyExperimental, exe_ctx);
OptionValueProperties *exp_values =
exp_property->GetValue()->GetAsProperties();
if (exp_values)
exp_values->SetPropertyAtIndex(ePropertyInjectLocalVars, true, exe_ctx);
bool TargetProperties::GetInjectLocalVariables(
ExecutionContext *exe_ctx) const {
return GetExperimentalPropertyValue(ePropertyInjectLocalVars, exe_ctx)
.value_or(true);
}

ArchSpec TargetProperties::GetDefaultArchitecture() const {
Expand Down