[Lldb-commits] [PATCH] D139066: [lldb] Make sure the value of `eSymbolContextVariable` is not conflicting with `RESOLVED_FRAME_CODE_ADDR`

Jason Molenda via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Mon Dec 5 11:00:21 PST 2022


jasonmolenda added a comment.

In D139066#3971564 <https://reviews.llvm.org/D139066#3971564>, @akyrtzi wrote:

> In D139066#3964435 <https://reviews.llvm.org/D139066#3964435>, @akyrtzi wrote:
>
>> In D139066#3964353 <https://reviews.llvm.org/D139066#3964353>, @jasonmolenda wrote:
>>
>>> FWIW I think the only change needed to the original patch is to keep using `#define RESOLVED_FRAME_CODE_ADDR (uint32_t(eSymbolContextEverything + 1))` but switch to the new eSymbolContextLastItem that is defined.  Possibly the comment about what this code is doing could be made a little clearer, because it is definitely not. :)
>>
>> Thank you for the feedback, but it's unclear to me what you mean, are you saying leave the `#define RESOLVED_FRAME_CODE_ADDR` line unmodified? If yes, what does "switch to the new eSymbolContextLastItem" mean?
>
> @jasonmolenda 🙏?

Ah sorry for not replying Argyrios, just to be explicit I was thinking something like

  diff --git a/lldb/include/lldb/lldb-enumerations.h b/lldb/include/lldb/lldb-enumerations.h
  index c46ef4bf361..9020c0f4d9f 100644
  --- a/lldb/include/lldb/lldb-enumerations.h
  +++ b/lldb/include/lldb/lldb-enumerations.h
  @@ -377,2 +377,5 @@ FLAGS_ENUM(SymbolContextItem){
       eSymbolContextVariable = (1u << 7),
  +
  +    // Keep this last and up-to-date for what the last enum value is.
  +    eSymbolContextLastItem = ((eSymbolContextVariable << 1) - 1u),
   };
  diff --git a/lldb/source/Target/StackFrame.cpp b/lldb/source/Target/StackFrame.cpp
  index b600ffe9520..a7f87dbb1c5 100644
  --- a/lldb/source/Target/StackFrame.cpp
  +++ b/lldb/source/Target/StackFrame.cpp
  @@ -46,3 +46,7 @@ using namespace lldb_private;
   // context (m_sc) already.
  -#define RESOLVED_FRAME_CODE_ADDR (uint32_t(eSymbolContextEverything + 1))
  +// RESOLVED_FRAME_CODE_ADDR adds 1 to the value of eSymbolContextLastItem,
  +// assuming this is an all-ones value indicating the positions used by
  +// eSymbolContext entries.  We want to define some flags outside that range of
  +// bits for our use.
  +#define RESOLVED_FRAME_CODE_ADDR (uint32_t(eSymbolContextLastItem + 1))
   #define RESOLVED_FRAME_ID_SYMBOL_SCOPE (RESOLVED_FRAME_CODE_ADDR << 1)

(I haven't tested this or anything) what do you think.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D139066



More information about the lldb-commits mailing list