[Lldb-commits] [lldb] r331480 - Revert "DWARFExpression: Convert file addresses to load addresses early on."
Greg Clayton via lldb-commits
lldb-commits at lists.llvm.org
Thu May 3 13:28:13 PDT 2018
One issue after looking closer at the code is you didn't specify you wanted the target filled in when calling:
auto sc = frame->GetSymbolContext(eSymbolContextFunction);
It should be:
auto sc = frame->GetSymbolContext(eSymbolContextTarget | eSymbolContextModule | eSymbolContextCompUnit | eSymbolContextFunction);
I also doubt that "variable->CalculateSymbolContext(&var_sc);" fills in the target correctly. You can manually fill the target and module in if needed.
> On May 3, 2018, at 1:19 PM, Adrian Prantl via lldb-commits <lldb-commits at lists.llvm.org> wrote:
>
> Author: adrian
> Date: Thu May 3 13:19:39 2018
> New Revision: 331480
>
> URL: http://llvm.org/viewvc/llvm-project?rev=331480&view=rev
> Log:
> Revert "DWARFExpression: Convert file addresses to load addresses early on."
>
> This reverts commit 331462 while investigating bot breakage.
>
> Modified:
> lldb/trunk/include/lldb/Core/Value.h
> lldb/trunk/source/Core/Value.cpp
> lldb/trunk/source/Core/ValueObjectVariable.cpp
> lldb/trunk/source/Expression/DWARFExpression.cpp
>
> Modified: lldb/trunk/include/lldb/Core/Value.h
> URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Value.h?rev=331480&r1=331479&r2=331480&view=diff
> ==============================================================================
> --- lldb/trunk/include/lldb/Core/Value.h (original)
> +++ lldb/trunk/include/lldb/Core/Value.h Thu May 3 13:19:39 2018
> @@ -228,9 +228,6 @@ public:
>
> static const char *GetContextTypeAsCString(ContextType context_type);
>
> - /// Convert this value's file address to a load address, if possible.
> - void ConvertToLoadAddress(SymbolContext sc);
> -
> bool GetData(DataExtractor &data);
>
> void Clear();
>
> Modified: lldb/trunk/source/Core/Value.cpp
> URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Value.cpp?rev=331480&r1=331479&r2=331480&view=diff
> ==============================================================================
> --- lldb/trunk/source/Core/Value.cpp (original)
> +++ lldb/trunk/source/Core/Value.cpp Thu May 3 13:19:39 2018
> @@ -669,28 +669,6 @@ const char *Value::GetContextTypeAsCStri
> return "???";
> }
>
> -void Value::ConvertToLoadAddress(SymbolContext sc) {
> - if (GetValueType() != eValueTypeFileAddress)
> - return;
> -
> - if (!sc.module_sp)
> - return;
> -
> - lldb::addr_t file_addr = GetScalar().ULongLong(LLDB_INVALID_ADDRESS);
> - if (file_addr == LLDB_INVALID_ADDRESS)
> - return;
> -
> - Address so_addr;
> - if (!sc.module_sp->ResolveFileAddress(file_addr, so_addr))
> - return;
> - lldb::addr_t load_addr = so_addr.GetLoadAddress(sc.target_sp.get());
> - if (load_addr == LLDB_INVALID_ADDRESS)
> - return;
> -
> - SetValueType(Value::eValueTypeLoadAddress);
> - GetScalar() = load_addr;
> -}
> -
> ValueList::ValueList(const ValueList &rhs) { m_values = rhs.m_values; }
>
> const ValueList &ValueList::operator=(const ValueList &rhs) {
>
> Modified: lldb/trunk/source/Core/ValueObjectVariable.cpp
> URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ValueObjectVariable.cpp?rev=331480&r1=331479&r2=331480&view=diff
> ==============================================================================
> --- lldb/trunk/source/Core/ValueObjectVariable.cpp (original)
> +++ lldb/trunk/source/Core/ValueObjectVariable.cpp Thu May 3 13:19:39 2018
> @@ -236,9 +236,23 @@ bool ValueObjectVariable::UpdateValue()
>
> // If we have a file address, convert it to a load address if we can.
> if (value_type == Value::eValueTypeFileAddress && process_is_alive) {
> - SymbolContext var_sc;
> - variable->CalculateSymbolContext(&var_sc);
> - m_value.ConvertToLoadAddress(var_sc);
> + lldb::addr_t file_addr =
> + m_value.GetScalar().ULongLong(LLDB_INVALID_ADDRESS);
> + if (file_addr != LLDB_INVALID_ADDRESS) {
> + SymbolContext var_sc;
> + variable->CalculateSymbolContext(&var_sc);
> + if (var_sc.module_sp) {
> + ObjectFile *objfile = var_sc.module_sp->GetObjectFile();
> + if (objfile) {
> + Address so_addr(file_addr, objfile->GetSectionList());
> + lldb::addr_t load_addr = so_addr.GetLoadAddress(target);
> + if (load_addr != LLDB_INVALID_ADDRESS) {
> + m_value.SetValueType(Value::eValueTypeLoadAddress);
> + m_value.GetScalar() = load_addr;
> + }
> + }
> + }
> + }
> }
>
> if (!CanProvideValue()) {
>
> Modified: lldb/trunk/source/Expression/DWARFExpression.cpp
> URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/DWARFExpression.cpp?rev=331480&r1=331479&r2=331480&view=diff
> ==============================================================================
> --- lldb/trunk/source/Expression/DWARFExpression.cpp (original)
> +++ lldb/trunk/source/Expression/DWARFExpression.cpp Thu May 3 13:19:39 2018
> @@ -1379,13 +1379,10 @@ bool DWARFExpression::Evaluate(
> // The DW_OP_addr operation has a single operand that encodes a machine
> // address and whose size is the size of an address on the target machine.
> //----------------------------------------------------------------------
> - case DW_OP_addr: {
> + case DW_OP_addr:
> stack.push_back(Scalar(opcodes.GetAddress(&offset)));
> stack.back().SetValueType(Value::eValueTypeFileAddress);
> - auto sc = frame->GetSymbolContext(eSymbolContextFunction);
> - stack.back().ConvertToLoadAddress(sc);
> break;
> - }
>
> //----------------------------------------------------------------------
> // The DW_OP_addr_sect_offset4 is used for any location expressions in
>
>
> _______________________________________________
> lldb-commits mailing list
> lldb-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20180503/373f883b/attachment-0001.html>
More information about the lldb-commits
mailing list