[Lldb-commits] [lldb] [llvm] [lldb-dap] Add support for data breakpoint. (PR #81541)
Greg Clayton via lldb-commits
lldb-commits at lists.llvm.org
Tue Feb 13 13:41:17 PST 2024
================
@@ -2697,58 +2737,41 @@ void request_dataBreakpointInfo(const llvm::json::Object &request) {
GetUnsigned(arguments, "variablesReference", 0);
llvm::StringRef name = GetString(arguments, "name");
lldb::SBFrame frame = g_dap.GetLLDBFrame(*arguments);
- bool is_duplicated_variable_name = name.contains(" @");
+ lldb::SBValue variable = FindVariable(variablesReference, name);
+ std::string addr, size;
- lldb::SBValue variable;
- if (lldb::SBValueList *top_scope = GetTopLevelScope(variablesReference)) {
- // variablesReference is one of our scopes, not an actual variable it is
- // asking for a variable in locals or globals or registers
- int64_t end_idx = top_scope->GetSize();
- // Searching backward so that we choose the variable in closest scope
- // among variables of the same name.
- for (int64_t i = end_idx - 1; i >= 0; --i) {
- lldb::SBValue curr_variable = top_scope->GetValueAtIndex(i);
- std::string variable_name = CreateUniqueVariableNameForDisplay(
- curr_variable, is_duplicated_variable_name);
- if (variable_name == name) {
- variable = curr_variable;
- break;
- }
- }
+ if (variable.IsValid()) {
+ addr = llvm::utohexstr(variable.GetLoadAddress());
+ size = llvm::utostr(variable.GetByteSize());
+ } else if (variablesReference == 0 && frame.IsValid()) {
+ // Name might be an expression. In this case we assume that name is composed
+ // of the number of bytes to watch and expression, separated by '@':
+ // "${size}@${expression}"
----------------
clayborg wrote:
Is this format VS Code supported, or just something we are making up?
https://github.com/llvm/llvm-project/pull/81541
More information about the lldb-commits
mailing list