@@ -23,20 +23,21 @@ llvm::Expected<protocol::DataBreakpointInfoResponseBody>
2323DataBreakpointInfoRequestHandler::Run (
2424 const protocol::DataBreakpointInfoArguments &args) const {
2525 protocol::DataBreakpointInfoResponseBody response;
26- lldb::SBFrame frame = dap.GetLLDBFrame (args.frameId .value_or (0 ));
26+ lldb::SBFrame frame = dap.GetLLDBFrame (args.frameId .value_or (UINT64_MAX ));
2727 lldb::SBValue variable = dap.variables .FindVariable (
2828 args.variablesReference .value_or (0 ), args.name );
2929 std::string addr, size;
3030
31+ bool is_data_ok = true ;
3132 if (variable.IsValid ()) {
3233 lldb::addr_t load_addr = variable.GetLoadAddress ();
3334 size_t byte_size = variable.GetByteSize ();
3435 if (load_addr == LLDB_INVALID_ADDRESS) {
35- response. dataId = std:: nullopt ;
36+ is_data_ok = false ;
3637 response.description = " does not exist in memory, its location is " +
3738 std::string (variable.GetLocation ());
3839 } else if (byte_size == 0 ) {
39- response. dataId = std:: nullopt ;
40+ is_data_ok = false ;
4041 response.description = " variable size is 0" ;
4142 } else {
4243 addr = llvm::utohexstr (load_addr);
@@ -47,7 +48,7 @@ DataBreakpointInfoRequestHandler::Run(
4748 if (value.GetError ().Fail ()) {
4849 lldb::SBError error = value.GetError ();
4950 const char *error_cstr = error.GetCString ();
50- response. dataId = std:: nullopt ;
51+ is_data_ok = false ;
5152 response.description = error_cstr && error_cstr[0 ]
5253 ? std::string (error_cstr)
5354 : " evaluation failed" ;
@@ -64,23 +65,23 @@ DataBreakpointInfoRequestHandler::Run(
6465 // request if SBProcess::GetMemoryRegionInfo returns error.
6566 if (err.Success ()) {
6667 if (!(region.IsReadable () || region.IsWritable ())) {
67- response. dataId = std:: nullopt ;
68+ is_data_ok = false ;
6869 response.description = " memory region for address " + addr +
6970 " has no read or write permissions" ;
7071 }
7172 }
7273 } else {
73- response. dataId = std:: nullopt ;
74+ is_data_ok = false ;
7475 response.description =
7576 " unable to get byte size for expression: " + args.name ;
7677 }
7778 }
7879 } else {
79- response. dataId = std:: nullopt ;
80+ is_data_ok = false ;
8081 response.description = " variable not found: " + args.name ;
8182 }
8283
83- if (!response. dataId . has_value () ) {
84+ if (is_data_ok ) {
8485 response.dataId = addr + " /" + size;
8586 response.accessTypes = {protocol::eDataBreakpointAccessTypeRead,
8687 protocol::eDataBreakpointAccessTypeWrite,
0 commit comments