[Lldb-commits] [PATCH] D103588: [trace] Create a top-level instruction class

Greg Clayton via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Mon Jun 7 14:56:05 PDT 2021


clayborg requested changes to this revision.
clayborg added a comment.
This revision now requires changes to proceed.

So it would be nice to try and not encode errors into the TraceInstruction class and deal with any errors at decode time.



================
Comment at: lldb/include/lldb/Target/Trace.h:31-32
+///
+/// This class assumes that errors will be extremely rare compared to the number
+/// of correct instructions and storing them as \a ConstString should be fine.
+class TraceInstruction {
----------------
Can't we just avoid including any errors in this TraceInstruction class? And have the function that generates these return a:

```
llvm::Expected<TraceInstruction>
```
?


================
Comment at: lldb/include/lldb/Target/Trace.h:75
+    lldb::addr_t m_load_address;
+    const char *m_error;
+  } m_data;
----------------
It would be nice to avoid trying to encode errors into this class.


================
Comment at: lldb/include/lldb/lldb-enumerations.h:786
+/// analysis on traces.
+enum TraceInstructionType : unsigned char {
+  /// The instruction is not recognized by LLDB
----------------



Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D103588/new/

https://reviews.llvm.org/D103588



More information about the lldb-commits mailing list