[Lldb-commits] [lldb] Add register lookup as another fallback computation for address-expressions (PR #85492)

via lldb-commits lldb-commits at lists.llvm.org
Fri Mar 15 18:09:05 PDT 2024


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff 9405d5af65853ac548cce2656497195010db1d86 59320299f5aa3f9e03695e762c9fec237362c460 -- lldb/test/API/commands/target/modules/lookup/main.c lldb/source/Interpreter/OptionArgParser.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/lldb/source/Interpreter/OptionArgParser.cpp b/lldb/source/Interpreter/OptionArgParser.cpp
index dd914138fe..98e0971a8d 100644
--- a/lldb/source/Interpreter/OptionArgParser.cpp
+++ b/lldb/source/Interpreter/OptionArgParser.cpp
@@ -238,7 +238,8 @@ OptionArgParser::DoToAddress(const ExecutionContext *exe_ctx, llvm::StringRef s,
   // Some languages also don't have a natural representation for register
   // values (e.g. swift) so handle simple uses of them here as well.
   static RegularExpression g_symbol_plus_offset_regex(
-      "^(\\$[^ +-]+)|(([^ +-]+)([-\\+])[[:space:]]*(0x[0-9A-Fa-f]+|[0-9]+)[[:space:]]*)$");
+      "^(\\$[^ +-]+)|(([^ "
+      "+-]+)([-\\+])[[:space:]]*(0x[0-9A-Fa-f]+|[0-9]+)[[:space:]]*)$");
 
   llvm::SmallVector<llvm::StringRef, 4> matches;
   if (g_symbol_plus_offset_regex.Execute(sref, &matches)) {
@@ -259,7 +260,8 @@ OptionArgParser::DoToAddress(const ExecutionContext *exe_ctx, llvm::StringRef s,
       RegisterContextSP reg_ctx_sp = frame->GetRegisterContext();
       if (reg_ctx_sp) {
         llvm::StringRef base_name = name.substr(1);
-        const RegisterInfo *reg_info = reg_ctx_sp->GetRegisterInfoByName(base_name);
+        const RegisterInfo *reg_info =
+            reg_ctx_sp->GetRegisterInfoByName(base_name);
         if (reg_info) {
           RegisterValue reg_val;
           bool success = reg_ctx_sp->ReadRegister(reg_info, reg_val);
@@ -269,7 +271,7 @@ OptionArgParser::DoToAddress(const ExecutionContext *exe_ctx, llvm::StringRef s,
               register_value.reset();
           }
         }
-      } 
+      }
     }
     if (!str_offset.empty() && !str_offset.getAsInteger(0, offset)) {
       Status error;
@@ -283,7 +285,7 @@ OptionArgParser::DoToAddress(const ExecutionContext *exe_ctx, llvm::StringRef s,
         return addr - offset;
       }
     } else if (register_value)
-      // In the case of register values, someone might just want to get the 
+      // In the case of register values, someone might just want to get the
       // value in a language whose expression parser doesn't support registers.
       return register_value.value();
   }
diff --git a/lldb/test/API/commands/target/modules/lookup/main.c b/lldb/test/API/commands/target/modules/lookup/main.c
index afe962f309..f2be761a72 100644
--- a/lldb/test/API/commands/target/modules/lookup/main.c
+++ b/lldb/test/API/commands/target/modules/lookup/main.c
@@ -1,15 +1,11 @@
 #include <stdio.h>
 
-void
-doSomething()
-{
-  printf ("Set a breakpoint here.\n");
-  printf ("Need a bit more code.\n");
+void doSomething() {
+  printf("Set a breakpoint here.\n");
+  printf("Need a bit more code.\n");
 }
 
-int
-main()
-{
+int main() {
   doSomething();
   return 0;
 }

``````````

</details>


https://github.com/llvm/llvm-project/pull/85492


More information about the lldb-commits mailing list