diff options
Diffstat (limited to 'lldb/source/Expression')
-rw-r--r-- | lldb/source/Expression/DWARFExpression.cpp | 292 | ||||
-rw-r--r-- | lldb/source/Expression/DiagnosticManager.cpp | 5 | ||||
-rw-r--r-- | lldb/source/Expression/ExpressionSourceCode.cpp | 8 | ||||
-rw-r--r-- | lldb/source/Expression/ExpressionVariable.cpp | 4 | ||||
-rw-r--r-- | lldb/source/Expression/FunctionCaller.cpp | 11 | ||||
-rw-r--r-- | lldb/source/Expression/IRExecutionUnit.cpp | 19 | ||||
-rw-r--r-- | lldb/source/Expression/IRInterpreter.cpp | 4 | ||||
-rw-r--r-- | lldb/source/Expression/IRMemoryMap.cpp | 31 | ||||
-rw-r--r-- | lldb/source/Expression/LLVMUserExpression.cpp | 5 | ||||
-rw-r--r-- | lldb/source/Expression/Materializer.cpp | 13 | ||||
-rw-r--r-- | lldb/source/Expression/REPL.cpp | 22 | ||||
-rw-r--r-- | lldb/source/Expression/UserExpression.cpp | 11 |
12 files changed, 195 insertions, 230 deletions
diff --git a/lldb/source/Expression/DWARFExpression.cpp b/lldb/source/Expression/DWARFExpression.cpp index 6c43fe5aa30..71495715e75 100644 --- a/lldb/source/Expression/DWARFExpression.cpp +++ b/lldb/source/Expression/DWARFExpression.cpp @@ -679,8 +679,8 @@ static bool ReadRegisterValueAsScalar(RegisterContext *reg_ctx, error_ptr->Clear(); return true; } else { - // If we get this error, then we need to implement a value - // buffer in the dwarf expression evaluation function... + // If we get this error, then we need to implement a value buffer in + // the dwarf expression evaluation function... if (error_ptr) error_ptr->SetErrorStringWithFormat( "register %s can't be converted to a scalar value", @@ -991,17 +991,17 @@ bool DWARFExpression::Update_DW_OP_addr(lldb::addr_t file_addr) { if (op == DW_OP_addr) { const uint32_t addr_byte_size = m_data.GetAddressByteSize(); - // We have to make a copy of the data as we don't know if this - // data is from a read only memory mapped buffer, so we duplicate - // all of the data first, then modify it, and if all goes well, - // we then replace the data for this expression + // We have to make a copy of the data as we don't know if this data is + // from a read only memory mapped buffer, so we duplicate all of the data + // first, then modify it, and if all goes well, we then replace the data + // for this expression // So first we copy the data into a heap buffer std::unique_ptr<DataBufferHeap> head_data_ap( new DataBufferHeap(m_data.GetDataStart(), m_data.GetByteSize())); - // Make en encoder so we can write the address into the buffer using - // the correct byte order (endianness) + // Make en encoder so we can write the address into the buffer using the + // correct byte order (endianness) DataEncoder encoder(head_data_ap->GetBytes(), head_data_ap->GetByteSize(), m_data.GetByteOrder(), addr_byte_size); @@ -1009,9 +1009,8 @@ bool DWARFExpression::Update_DW_OP_addr(lldb::addr_t file_addr) { if (encoder.PutMaxU64(offset, addr_byte_size, file_addr) == UINT32_MAX) return false; - // All went well, so now we can reset the data using a shared - // pointer to the heap data so "m_data" will now correctly - // manage the heap data. + // All went well, so now we can reset the data using a shared pointer to + // the heap data so "m_data" will now correctly manage the heap data. m_data.SetData(DataBufferSP(head_data_ap.release())); return true; } else { @@ -1025,9 +1024,9 @@ bool DWARFExpression::Update_DW_OP_addr(lldb::addr_t file_addr) { } bool DWARFExpression::ContainsThreadLocalStorage() const { - // We are assuming for now that any thread local variable will not - // have a location list. This has been true for all thread local - // variables we have seen so far produced by any compiler. + // We are assuming for now that any thread local variable will not have a + // location list. This has been true for all thread local variables we have + // seen so far produced by any compiler. if (IsLocationList()) return false; lldb::offset_t offset = 0; @@ -1048,24 +1047,24 @@ bool DWARFExpression::LinkThreadLocalStorage( lldb::ModuleSP new_module_sp, std::function<lldb::addr_t(lldb::addr_t file_addr)> const &link_address_callback) { - // We are assuming for now that any thread local variable will not - // have a location list. This has been true for all thread local - // variables we have seen so far produced by any compiler. + // We are assuming for now that any thread local variable will not have a + // location list. This has been true for all thread local variables we have + // seen so far produced by any compiler. if (IsLocationList()) return false; const uint32_t addr_byte_size = m_data.GetAddressByteSize(); - // We have to make a copy of the data as we don't know if this - // data is from a read only memory mapped buffer, so we duplicate - // all of the data first, then modify it, and if all goes well, - // we then replace the data for this expression + // We have to make a copy of the data as we don't know if this data is from a + // read only memory mapped buffer, so we duplicate all of the data first, + // then modify it, and if all goes well, we then replace the data for this + // expression // So first we copy the data into a heap buffer std::shared_ptr<DataBufferHeap> heap_data_sp( new DataBufferHeap(m_data.GetDataStart(), m_data.GetByteSize())); - // Make en encoder so we can write the address into the buffer using - // the correct byte order (endianness) + // Make en encoder so we can write the address into the buffer using the + // correct byte order (endianness) DataEncoder encoder(heap_data_sp->GetBytes(), heap_data_sp->GetByteSize(), m_data.GetByteOrder(), addr_byte_size); @@ -1080,8 +1079,7 @@ bool DWARFExpression::LinkThreadLocalStorage( switch (op) { case DW_OP_const4u: // Remember the const offset in case we later have a - // DW_OP_form_tls_address - // or DW_OP_GNU_push_tls_address + // DW_OP_form_tls_address or DW_OP_GNU_push_tls_address const_offset = offset; const_value = m_data.GetU32(&offset); decoded_data = true; @@ -1090,8 +1088,7 @@ bool DWARFExpression::LinkThreadLocalStorage( case DW_OP_const8u: // Remember the const offset in case we later have a - // DW_OP_form_tls_address - // or DW_OP_GNU_push_tls_address + // DW_OP_form_tls_address or DW_OP_GNU_push_tls_address const_offset = offset; const_value = m_data.GetU64(&offset); decoded_data = true; @@ -1101,21 +1098,15 @@ bool DWARFExpression::LinkThreadLocalStorage( case DW_OP_form_tls_address: case DW_OP_GNU_push_tls_address: // DW_OP_form_tls_address and DW_OP_GNU_push_tls_address must be preceded - // by - // a file address on the stack. We assume that DW_OP_const4u or - // DW_OP_const8u - // is used for these values, and we check that the last opcode we got - // before - // either of these was DW_OP_const4u or DW_OP_const8u. If so, then we can - // link - // the value accodingly. For Darwin, the value in the DW_OP_const4u or - // DW_OP_const8u is the file address of a structure that contains a - // function - // pointer, the pthread key and the offset into the data pointed to by the - // pthread key. So we must link this address and also set the module of - // this - // expression to the new_module_sp so we can resolve the file address - // correctly + // by a file address on the stack. We assume that DW_OP_const4u or + // DW_OP_const8u is used for these values, and we check that the last + // opcode we got before either of these was DW_OP_const4u or + // DW_OP_const8u. If so, then we can link the value accodingly. For + // Darwin, the value in the DW_OP_const4u or DW_OP_const8u is the file + // address of a structure that contains a function pointer, the pthread + // key and the offset into the data pointed to by the pthread key. So we + // must link this address and also set the module of this expression to + // the new_module_sp so we can resolve the file address correctly if (const_byte_size > 0) { lldb::addr_t linked_file_addr = link_address_callback(const_value); if (linked_file_addr == LLDB_INVALID_ADDRESS) @@ -1144,8 +1135,8 @@ bool DWARFExpression::LinkThreadLocalStorage( } // If we linked the TLS address correctly, update the module so that when the - // expression - // is evaluated it can resolve the file address to a load address and read the + // expression is evaluated it can resolve the file address to a load address + // and read the // TLS data m_module_wp = new_module_sp; m_data.SetData(heap_data_sp); @@ -1397,11 +1388,11 @@ bool DWARFExpression::Evaluate( // The DW_OP_addr_sect_offset4 is used for any location expressions in // shared libraries that have a location like: // DW_OP_addr(0x1000) - // If this address resides in a shared library, then this virtual - // address won't make sense when it is evaluated in the context of a - // running process where shared libraries have been slid. To account for - // this, this new address type where we can store the section pointer - // and a 4 byte offset. + // If this address resides in a shared library, then this virtual address + // won't make sense when it is evaluated in the context of a running + // process where shared libraries have been slid. To account for this, this + // new address type where we can store the section pointer and a 4 byte + // offset. //---------------------------------------------------------------------- // case DW_OP_addr_sect_offset4: // { @@ -1436,9 +1427,9 @@ bool DWARFExpression::Evaluate( // OPCODE: DW_OP_deref // OPERANDS: none // DESCRIPTION: Pops the top stack entry and treats it as an address. - // The value retrieved from that address is pushed. The size of the - // data retrieved from the dereferenced address is the size of an - // address on the target machine. + // The value retrieved from that address is pushed. The size of the data + // retrieved from the dereferenced address is the size of an address on the + // target machine. //---------------------------------------------------------------------- case DW_OP_deref: { if (stack.empty()) { @@ -1500,13 +1491,13 @@ bool DWARFExpression::Evaluate( // 1 - uint8_t that specifies the size of the data to dereference. // DESCRIPTION: Behaves like the DW_OP_deref operation: it pops the top // stack entry and treats it as an address. The value retrieved from that - // address is pushed. In the DW_OP_deref_size operation, however, the - // size in bytes of the data retrieved from the dereferenced address is + // address is pushed. In the DW_OP_deref_size operation, however, the size + // in bytes of the data retrieved from the dereferenced address is // specified by the single operand. This operand is a 1-byte unsigned // integral constant whose value may not be larger than the size of an - // address on the target machine. The data retrieved is zero extended - // to the size of an address on the target machine before being pushed - // on the expression stack. + // address on the target machine. The data retrieved is zero extended to + // the size of an address on the target machine before being pushed on the + // expression stack. //---------------------------------------------------------------------- case DW_OP_deref_size: { if (stack.empty()) { @@ -1525,8 +1516,7 @@ bool DWARFExpression::Evaluate( // I can't decide whether the size operand should apply to the bytes in // their // lldb-host endianness or the target endianness.. I doubt this'll ever - // come up - // but I'll opt for assuming big endian regardless. + // come up but I'll opt for assuming big endian regardless. switch (size) { case 1: ptr = ptr & 0xff; @@ -1622,18 +1612,17 @@ bool DWARFExpression::Evaluate( // OPERANDS: 1 // 1 - uint8_t that specifies the size of the data to dereference. // DESCRIPTION: Behaves like the DW_OP_xderef operation: the entry at - // the top of the stack is treated as an address. The second stack - // entry is treated as an "address space identifier" for those - // architectures that support multiple address spaces. The top two - // stack elements are popped, a data item is retrieved through an - // implementation-defined address calculation and pushed as the new - // stack top. In the DW_OP_xderef_size operation, however, the size in - // bytes of the data retrieved from the dereferenced address is - // specified by the single operand. This operand is a 1-byte unsigned - // integral constant whose value may not be larger than the size of an - // address on the target machine. The data retrieved is zero extended - // to the size of an address on the target machine before being pushed - // on the expression stack. + // the top of the stack is treated as an address. The second stack entry is + // treated as an "address space identifier" for those architectures that + // support multiple address spaces. The top two stack elements are popped, + // a data item is retrieved through an implementation-defined address + // calculation and pushed as the new stack top. In the DW_OP_xderef_size + // operation, however, the size in bytes of the data retrieved from the + // dereferenced address is specified by the single operand. This operand is + // a 1-byte unsigned integral constant whose value may not be larger than + // the size of an address on the target machine. The data retrieved is zero + // extended to the size of an address on the target machine before being + // pushed on the expression stack. //---------------------------------------------------------------------- case DW_OP_xderef_size: if (error_ptr) @@ -1643,13 +1632,13 @@ bool DWARFExpression::Evaluate( // OPCODE: DW_OP_xderef // OPERANDS: none // DESCRIPTION: Provides an extended dereference mechanism. The entry at - // the top of the stack is treated as an address. The second stack entry - // is treated as an "address space identifier" for those architectures - // that support multiple address spaces. The top two stack elements are - // popped, a data item is retrieved through an implementation-defined - // address calculation and pushed as the new stack top. The size of the - // data retrieved from the dereferenced address is the size of an address - // on the target machine. + // the top of the stack is treated as an address. The second stack entry is + // treated as an "address space identifier" for those architectures that + // support multiple address spaces. The top two stack elements are popped, + // a data item is retrieved through an implementation-defined address + // calculation and pushed as the new stack top. The size of the data + // retrieved from the dereferenced address is the size of an address on the + // target machine. //---------------------------------------------------------------------- case DW_OP_xderef: if (error_ptr) @@ -1661,16 +1650,13 @@ bool DWARFExpression::Evaluate( // // Opcode Operand 1 // --------------- ---------------------------------------------------- - // DW_OP_const1u 1-byte unsigned integer constant - // DW_OP_const1s 1-byte signed integer constant - // DW_OP_const2u 2-byte unsigned integer constant - // DW_OP_const2s 2-byte signed integer constant - // DW_OP_const4u 4-byte unsigned integer constant - // DW_OP_const4s 4-byte signed integer constant - // DW_OP_const8u 8-byte unsigned integer constant - // DW_OP_const8s 8-byte signed integer constant - // DW_OP_constu unsigned LEB128 integer constant - // DW_OP_consts signed LEB128 integer constant + // DW_OP_const1u 1-byte unsigned integer constant DW_OP_const1s + // 1-byte signed integer constant DW_OP_const2u 2-byte unsigned integer + // constant DW_OP_const2s 2-byte signed integer constant DW_OP_const4u + // 4-byte unsigned integer constant DW_OP_const4s 4-byte signed integer + // constant DW_OP_const8u 8-byte unsigned integer constant DW_OP_const8s + // 8-byte signed integer constant DW_OP_constu unsigned LEB128 integer + // constant DW_OP_consts signed LEB128 integer constant //---------------------------------------------------------------------- case DW_OP_const1u: stack.push_back(Scalar((uint8_t)opcodes.GetU8(&offset))); @@ -1789,9 +1775,9 @@ bool DWARFExpression::Evaluate( // OPCODE: DW_OP_rot // OPERANDS: none // DESCRIPTION: Rotates the first three stack entries. The entry at - // the top of the stack becomes the third stack entry, the second - // entry becomes the top of the stack, and the third entry becomes - // the second entry. + // the top of the stack becomes the third stack entry, the second entry + // becomes the top of the stack, and the third entry becomes the second + // entry. //---------------------------------------------------------------------- case DW_OP_rot: if (stack.size() < 3) { @@ -1853,8 +1839,8 @@ bool DWARFExpression::Evaluate( // OPCODE: DW_OP_div // OPERANDS: none // DESCRIPTION: pops the top two stack values, divides the former second - // entry by the former top of the stack using signed division, and - // pushes the result. + // entry by the former top of the stack using signed division, and pushes + // the result. //---------------------------------------------------------------------- case DW_OP_div: if (stack.size() < 2) { @@ -1905,8 +1891,8 @@ bool DWARFExpression::Evaluate( // OPCODE: DW_OP_mod // OPERANDS: none // DESCRIPTION: pops the top two stack values and pushes the result of - // the calculation: former second stack entry modulo the former top of - // the stack. + // the calculation: former second stack entry modulo the former top of the + // stack. //---------------------------------------------------------------------- case DW_OP_mod: if (stack.size() < 2) { @@ -2050,8 +2036,8 @@ bool DWARFExpression::Evaluate( // OPCODE: DW_OP_shl // OPERANDS: none // DESCRIPTION: pops the top two stack entries, shifts the former - // second entry left by the number of bits specified by the former top - // of the stack, and pushes the result. + // second entry left by the number of bits specified by the former top of + // the stack, and pushes the result. //---------------------------------------------------------------------- case DW_OP_shl: if (stack.size() < 2) { @@ -2096,8 +2082,8 @@ bool DWARFExpression::Evaluate( // OPERANDS: none // DESCRIPTION: pops the top two stack entries, shifts the former second // entry right arithmetically (divide the magnitude by 2, keep the same - // sign for the result) by the number of bits specified by the former - // top of the stack, and pushes the result. + // sign for the result) by the number of bits specified by the former top + // of the stack, and pushes the result. //---------------------------------------------------------------------- case DW_OP_shra: if (stack.size() < 2) { @@ -2136,8 +2122,8 @@ bool DWARFExpression::Evaluate( // OPCODE: DW_OP_skip // OPERANDS: int16_t // DESCRIPTION: An unconditional branch. Its single operand is a 2-byte - // signed integer constant. The 2-byte constant is the number of bytes - // of the DWARF expression to skip forward or backward from the current + // signed integer constant. The 2-byte constant is the number of bytes of + // the DWARF expression to skip forward or backward from the current // operation, beginning after the 2-byte constant. //---------------------------------------------------------------------- case DW_OP_skip: { @@ -2156,11 +2142,10 @@ bool DWARFExpression::Evaluate( // OPCODE: DW_OP_bra // OPERANDS: int16_t // DESCRIPTION: A conditional branch. Its single operand is a 2-byte - // signed integer constant. This operation pops the top of stack. If - // the value popped is not the constant 0, the 2-byte constant operand - // is the number of bytes of the DWARF expression to skip forward or - // backward from the current operation, beginning after the 2-byte - // constant. + // signed integer constant. This operation pops the top of stack. If the + // value popped is not the constant 0, the 2-byte constant operand is the + // number of bytes of the DWARF expression to skip forward or backward from + // the current operation, beginning after the 2-byte constant. //---------------------------------------------------------------------- case DW_OP_bra: if (stack.empty()) { @@ -2537,15 +2522,15 @@ bool DWARFExpression::Evaluate( // OPERANDS: 1 // ULEB128: byte size of the piece // DESCRIPTION: The operand describes the size in bytes of the piece of - // the object referenced by the DWARF expression whose result is at the - // top of the stack. If the piece is located in a register, but does not - // occupy the entire register, the placement of the piece within that - // register is defined by the ABI. + // the object referenced by the DWARF expression whose result is at the top + // of the stack. If the piece is located in a register, but does not occupy + // the entire register, the placement of the piece within that register is + // defined by the ABI. // - // Many compilers store a single variable in sets of registers, or store - // a variable partially in memory and partially in registers. - // DW_OP_piece provides a way of describing how large a part of a - // variable a particular DWARF expression refers to. + // Many compilers store a single variable in sets of registers, or store a + // variable partially in memory and partially in registers. DW_OP_piece + // provides a way of describing how large a part of a variable a particular + // DWARF expression refers to. //---------------------------------------------------------------------- case DW_OP_piece: { const uint64_t piece_byte_size = opcodes.GetULEB128(&offset); @@ -2555,8 +2540,8 @@ bool DWARFExpression::Evaluate( if (stack.empty()) { // In a multi-piece expression, this means that the current piece is - // not available. - // Fill with zeros for now by resizing the data and appending it + // not available. Fill with zeros for now by resizing the data and + // appending it curr_piece.ResizeData(piece_byte_size); ::memset(curr_piece.GetBuffer().GetBytes(), 0, piece_byte_size); pieces.AppendDataToHostBuffer(curr_piece); @@ -2646,9 +2631,9 @@ bool DWARFExpression::Evaluate( // Check if this is the first piece? if (op_piece_offset == 0) { - // This is the first piece, we should push it back onto the stack so - // subsequent - // pieces will be able to access this piece and add to it + // This is the first piece, we should push it back onto the stack + // so subsequent pieces will be able to access this piece and add + // to it if (pieces.AppendDataToHostBuffer(curr_piece) == 0) { if (error_ptr) error_ptr->SetErrorString("failed to append piece data"); @@ -2727,11 +2712,11 @@ bool DWARFExpression::Evaluate( // OPCODE: DW_OP_push_object_address // OPERANDS: none // DESCRIPTION: Pushes the address of the object currently being - // evaluated as part of evaluation of a user presented expression. - // This object may correspond to an independent variable described by - // its own DIE or it may be a component of an array, structure, or class - // whose address has been dynamically determined by an earlier step - // during user expression evaluation. + // evaluated as part of evaluation of a user presented expression. This + // object may correspond to an independent variable described by its own + // DIE or it may be a component of an array, structure, or class whose + // address has been dynamically determined by an earlier step during user + // expression evaluation. //---------------------------------------------------------------------- case DW_OP_push_object_address: if (object_address_ptr) @@ -2749,21 +2734,20 @@ bool DWARFExpression::Evaluate( // OPERANDS: // uint16_t compile unit relative offset of a DIE // DESCRIPTION: Performs subroutine calls during evaluation - // of a DWARF expression. The operand is the 2-byte unsigned offset - // of a debugging information entry in the current compilation unit. + // of a DWARF expression. The operand is the 2-byte unsigned offset of a + // debugging information entry in the current compilation unit. // // Operand interpretation is exactly like that for DW_FORM_ref2. // - // This operation transfers control of DWARF expression evaluation - // to the DW_AT_location attribute of the referenced DIE. If there is - // no such attribute, then there is no effect. Execution of the DWARF - // expression of a DW_AT_location attribute may add to and/or remove from - // values on the stack. Execution returns to the point following the call - // when the end of the attribute is reached. Values on the stack at the - // time of the call may be used as parameters by the called expression - // and values left on the stack by the called expression may be used as - // return values by prior agreement between the calling and called - // expressions. + // This operation transfers control of DWARF expression evaluation to the + // DW_AT_location attribute of the referenced DIE. If there is no such + // attribute, then there is no effect. Execution of the DWARF expression of + // a DW_AT_location attribute may add to and/or remove from values on the + // stack. Execution returns to the point following the call when the end of + // the attribute is reached. Values on the stack at the time of the call + // may be used as parameters by the called expression and values left on + // the stack by the called expression may be used as return values by prior + // agreement between the calling and called expressions. //---------------------------------------------------------------------- case DW_OP_call2: if (error_ptr) @@ -2774,22 +2758,21 @@ bool DWARFExpression::Evaluate( // OPERANDS: 1 // uint32_t compile unit relative offset of a DIE // DESCRIPTION: Performs a subroutine call during evaluation of a DWARF - // expression. For DW_OP_call4, the operand is a 4-byte unsigned offset - // of a debugging information entry in the current compilation unit. + // expression. For DW_OP_call4, the operand is a 4-byte unsigned offset of + // a debugging information entry in the current compilation unit. // // Operand interpretation DW_OP_call4 is exactly like that for // DW_FORM_ref4. // - // This operation transfers control of DWARF expression evaluation - // to the DW_AT_location attribute of the referenced DIE. If there is - // no such attribute, then there is no effect. Execution of the DWARF - // expression of a DW_AT_location attribute may add to and/or remove from - // values on the stack. Execution returns to the point following the call - // when the end of the attribute is reached. Values on the stack at the - // time of the call may be used as parameters by the called expression - // and values left on the stack by the called expression may be used as - // return values by prior agreement between the calling and called - // expressions. + // This operation transfers control of DWARF expression evaluation to the + // DW_AT_location attribute of the referenced DIE. If there is no such + // attribute, then there is no effect. Execution of the DWARF expression of + // a DW_AT_location attribute may add to and/or remove from values on the + // stack. Execution returns to the point following the call when the end of + // the attribute is reached. Values on the stack at the time of the call + // may be used as parameters by the called expression and values left on + // the stack by the called expression may be used as return values by prior + // agreement between the calling and called expressions. //---------------------------------------------------------------------- case DW_OP_call4: if (error_ptr) @@ -2800,9 +2783,8 @@ bool DWARFExpression::Evaluate( // OPCODE: DW_OP_stack_value // OPERANDS: None // DESCRIPTION: Specifies that the object does not exist in memory but - // rather is a constant value. The value from the top of the stack is - // the value to be used. This is the actual object value and not the - // location. + // rather is a constant value. The value from the top of the stack is the + // value to be used. This is the actual object value and not the location. //---------------------------------------------------------------------- case DW_OP_stack_value: stack.back().SetValueType(Value::eValueTypeScalar); @@ -2841,8 +2823,8 @@ bool DWARFExpression::Evaluate( // opcode, DW_OP_GNU_push_tls_address) // OPERANDS: none // DESCRIPTION: Pops a TLS offset from the stack, converts it to - // an address in the current thread's thread-local storage block, - // and pushes it on the stack. + // an address in the current thread's thread-local storage block, and + // pushes it on the stack. //---------------------------------------------------------------------- case DW_OP_form_tls_address: case DW_OP_GNU_push_tls_address: { @@ -2893,8 +2875,8 @@ bool DWARFExpression::Evaluate( // OPERANDS: 1 // ULEB128: index to the .debug_addr section // DESCRIPTION: Pushes an address to the stack from the .debug_addr - // section with the base address specified by the DW_AT_addr_base - // attribute and the 0 based index is the ULEB128 encoded index. + // section with the base address specified by the DW_AT_addr_base attribute + // and the 0 based index is the ULEB128 encoded index. //---------------------------------------------------------------------- case DW_OP_GNU_addr_index: { if (!dwarf_cu) { diff --git a/lldb/source/Expression/DiagnosticManager.cpp b/lldb/source/Expression/DiagnosticManager.cpp index ae20feb910d..a98d30339b4 100644 --- a/lldb/source/Expression/DiagnosticManager.cpp +++ b/lldb/source/Expression/DiagnosticManager.cpp @@ -22,9 +22,8 @@ void DiagnosticManager::Dump(Log *log) { std::string str = GetString(); - // GetString() puts a separator after each diagnostic. - // We want to remove the last '\n' because log->PutCString will add one for - // us. + // GetString() puts a separator after each diagnostic. We want to remove the + // last '\n' because log->PutCString will add one for us. if (str.size() && str.back() == '\n') { str.pop_back(); diff --git a/lldb/source/Expression/ExpressionSourceCode.cpp b/lldb/source/Expression/ExpressionSourceCode.cpp index d60a1288806..abbb332fac4 100644 --- a/lldb/source/Expression/ExpressionSourceCode.cpp +++ b/lldb/source/Expression/ExpressionSourceCode.cpp @@ -93,15 +93,15 @@ public: m_state = CURRENT_FILE_POPPED; } - // An entry is valid if it occurs before the current line in - // the current file. + // An entry is valid if it occurs before the current line in the current + // file. bool IsValidEntry(uint32_t line) { switch (m_state) { case CURRENT_FILE_NOT_YET_PUSHED: return true; case CURRENT_FILE_PUSHED: - // If we are in file included in the current file, - // the entry should be added. + // If we are in file included in the current file, the entry should be + // added. if (m_file_stack.back() != m_current_file) return true; diff --git a/lldb/source/Expression/ExpressionVariable.cpp b/lldb/source/Expression/ExpressionVariable.cpp index a97180029a8..13a42f1addc 100644 --- a/lldb/source/Expression/ExpressionVariable.cpp +++ b/lldb/source/Expression/ExpressionVariable.cpp @@ -69,8 +69,8 @@ void PersistentExpressionState::RegisterExecutionUnit( execution_unit_sp->GetJittedGlobalVariables()) { if (global_var.m_remote_addr != LLDB_INVALID_ADDRESS) { // Demangle the name before inserting it, so that lookups by the ConstStr - // of the demangled name - // will find the mangled one (needed for looking up metadata pointers.) + // of the demangled name will find the mangled one (needed for looking up + // metadata pointers.) Mangled mangler(global_var.m_name); mangler.GetDemangledName(lldb::eLanguageTypeUnknown); m_symbol_map[global_var.m_name.GetCString()] = global_var.m_remote_addr; diff --git a/lldb/source/Expression/FunctionCaller.cpp b/lldb/source/Expression/FunctionCaller.cpp index 6f60f8bf9c1..08dbb712c3a 100644 --- a/lldb/source/Expression/FunctionCaller.cpp +++ b/lldb/source/Expression/FunctionCaller.cpp @@ -318,9 +318,9 @@ lldb::ExpressionResults FunctionCaller::ExecuteFunction( DiagnosticManager &diagnostic_manager, Value &results) { lldb::ExpressionResults return_value = lldb::eExpressionSetupError; - // FunctionCaller::ExecuteFunction execution is always just to get the result. - // Do make sure we ignore - // breakpoints, unwind on error, and don't try to debug it. + // FunctionCaller::ExecuteFunction execution is always just to get the + // result. Do make sure we ignore breakpoints, unwind on error, and don't try + // to debug it. EvaluateExpressionOptions real_options = options; real_options.SetDebug(false); real_options.SetUnwindOnError(true); @@ -355,9 +355,8 @@ lldb::ExpressionResults FunctionCaller::ExecuteFunction( return lldb::eExpressionSetupError; // We need to make sure we record the fact that we are running an expression - // here - // otherwise this fact will fail to be recorded when fetching an Objective-C - // object description + // here otherwise this fact will fail to be recorded when fetching an + // Objective-C object description if (exe_ctx.GetProcessPtr()) exe_ctx.GetProcessPtr()->SetRunningUserExpression(true); diff --git a/lldb/source/Expression/IRExecutionUnit.cpp b/lldb/source/Expression/IRExecutionUnit.cpp index d5e5bf86a4c..298ad10e9dd 100644 --- a/lldb/source/Expression/IRExecutionUnit.cpp +++ b/lldb/source/Expression/IRExecutionUnit.cpp @@ -362,13 +362,10 @@ void IRExecutionUnit::GetRunnableInfo(Status &error, lldb::addr_t &func_addr, ReportAllocations(*m_execution_engine_ap); // We have to do this after calling ReportAllocations because for the MCJIT, - // getGlobalValueAddress - // will cause the JIT to perform all relocations. That can only be done once, - // and has to happen - // after we do the remapping from local -> remote. - // That means we don't know the local address of the Variables, but we don't - // need that for anything, - // so that's okay. + // getGlobalValueAddress will cause the JIT to perform all relocations. That + // can only be done once, and has to happen after we do the remapping from + // local -> remote. That means we don't know the local address of the + // Variables, but we don't need that for anything, so that's okay. std::function<void(llvm::GlobalValue &)> RegisterOneValue = [this]( llvm::GlobalValue &val) { @@ -379,8 +376,8 @@ void IRExecutionUnit::GetRunnableInfo(Status &error, lldb::addr_t &func_addr, lldb::addr_t remote_addr = GetRemoteAddressForLocal(var_ptr_addr); // This is a really unfortunae API that sometimes returns local addresses - // and sometimes returns remote addresses, based on whether - // the variable was relocated during ReportAllocations or not. + // and sometimes returns remote addresses, based on whether the variable + // was relocated during ReportAllocations or not. if (remote_addr == LLDB_INVALID_ADDRESS) { remote_addr = var_ptr_addr; @@ -882,8 +879,8 @@ lldb::addr_t IRExecutionUnit::FindInSymbols( if (get_external_load_address(load_address, sc_list, sc)) { return load_address; } - // if there are any searches we try after this, add an sc_list.Clear() in an - // "else" clause here + // if there are any searches we try after this, add an sc_list.Clear() in + // an "else" clause here if (best_internal_load_address != LLDB_INVALID_ADDRESS) { return best_internal_load_address; diff --git a/lldb/source/Expression/IRInterpreter.cpp b/lldb/source/Expression/IRInterpreter.cpp index a809bff2003..9a31db75da2 100644 --- a/lldb/source/Expression/IRInterpreter.cpp +++ b/lldb/source/Expression/IRInterpreter.cpp @@ -1567,8 +1567,8 @@ bool IRInterpreter::Interpret(llvm::Module &module, llvm::Function &function, return false; } - // Push all function arguments to the argument list that will - // be passed to the call function thread plan + // Push all function arguments to the argument list that will be passed + // to the call function thread plan for (int i = 0; i < numArgs; i++) { // Get details of this argument llvm::Value *arg_op = call_inst->getArgOperand(i); diff --git a/lldb/source/Expression/IRMemoryMap.cpp b/lldb/source/Expression/IRMemoryMap.cpp index 817c75e66a3..8fc2b4a4520 100644 --- a/lldb/source/Expression/IRMemoryMap.cpp +++ b/lldb/source/Expression/IRMemoryMap.cpp @@ -49,8 +49,8 @@ lldb::addr_t IRMemoryMap::FindSpace(size_t size) { // // The memory returned by this function will never be written to. The only // point is that it should not shadow process memory if possible, so that - // expressions processing real values from the process do not use the - // wrong data. + // expressions processing real values from the process do not use the wrong + // data. // // If the process can in fact allocate memory (CanJIT() lets us know this) // then this can be accomplished just be allocating memory in the inferior. @@ -93,8 +93,8 @@ lldb::addr_t IRMemoryMap::FindSpace(size_t size) { } // Now, if it's possible to use the GetMemoryRegionInfo API to detect mapped - // regions, walk forward through memory until a region is found that - // has adequate space for our allocation. + // regions, walk forward through memory until a region is found that has + // adequate space for our allocation. if (process_is_alive) { const uint64_t end_of_memory = process_sp->GetAddressByteSize() == 8 ? 0xffffffffffffffffull @@ -188,16 +188,12 @@ bool IRMemoryMap::IntersectsAllocation(lldb::addr_t addr, size_t size) const { AllocationMap::const_iterator iter = m_allocations.lower_bound(addr); // Since we only know that the returned interval begins at a location greater - // than or - // equal to where the given interval begins, it's possible that the given - // interval - // intersects either the returned interval or the previous interval. Thus, we - // need to - // check both. Note that we only need to check these two intervals. Since all - // intervals - // are disjoint it is not possible that an adjacent interval does not - // intersect, but a - // non-adjacent interval does intersect. + // than or equal to where the given interval begins, it's possible that the + // given interval intersects either the returned interval or the previous + // interval. Thus, we need to check both. Note that we only need to check + // these two intervals. Since all intervals are disjoint it is not possible + // that an adjacent interval does not intersect, but a non-adjacent interval + // does intersect. if (iter != m_allocations.end()) { if (AllocationsIntersect(addr, size, iter->second.m_process_start, iter->second.m_size)) @@ -217,16 +213,15 @@ bool IRMemoryMap::IntersectsAllocation(lldb::addr_t addr, size_t size) const { bool IRMemoryMap::AllocationsIntersect(lldb::addr_t addr1, size_t size1, lldb::addr_t addr2, size_t size2) { // Given two half open intervals [A, B) and [X, Y), the only 6 permutations - // that satisfy - // A<B and X<Y are the following: + // that satisfy A<B and X<Y are the following: // A B X Y // A X B Y (intersects) // A X Y B (intersects) // X A B Y (intersects) // X A Y B (intersects) // X Y A B - // The first is B <= X, and the last is Y <= A. - // So the condition is !(B <= X || Y <= A)), or (X < B && A < Y) + // The first is B <= X, and the last is Y <= A. So the condition is !(B <= X + // || Y <= A)), or (X < B && A < Y) return (addr2 < (addr1 + size1)) && (addr1 < (addr2 + size2)); } diff --git a/lldb/source/Expression/LLVMUserExpression.cpp b/lldb/source/Expression/LLVMUserExpression.cpp index 83acb8249ba..fc32bfbd37a 100644 --- a/lldb/source/Expression/LLVMUserExpression.cpp +++ b/lldb/source/Expression/LLVMUserExpression.cpp @@ -74,9 +74,8 @@ LLVMUserExpression::DoExecute(DiagnosticManager &diagnostic_manager, lldb::UserExpressionSP &shared_ptr_to_me, lldb::ExpressionVariableSP &result) { // The expression log is quite verbose, and if you're just tracking the - // execution of the - // expression, it's quite convenient to have these logs come out with the STEP - // log as well. + // execution of the expression, it's quite convenient to have these logs come + // out with the STEP log as well. Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_EXPRESSIONS | LIBLLDB_LOG_STEP)); diff --git a/lldb/source/Expression/Materializer.cpp b/lldb/source/Expression/Materializer.cpp index 39fc5c8c253..5b18bd516b2 100644 --- a/lldb/source/Expression/Materializer.cpp +++ b/lldb/source/Expression/Materializer.cpp @@ -77,7 +77,8 @@ public: void MakeAllocation(IRMemoryMap &map, Status &err) { Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); - // Allocate a spare memory area to store the persistent variable's contents. + // Allocate a spare memory area to store the persistent variable's + // contents. Status allocate_error; const bool zero_memory = false; @@ -230,8 +231,8 @@ public: ExpressionVariable::EVIsProgramReference && !m_persistent_variable_sp->m_live_sp) { // If the reference comes from the program, then the - // ClangExpressionVariable's - // live variable data hasn't been set up yet. Do this now. + // ClangExpressionVariable's live variable data hasn't been set up yet. + // Do this now. lldb::addr_t location; Status read_error; @@ -256,10 +257,8 @@ public: frame_bottom != LLDB_INVALID_ADDRESS && location >= frame_bottom && location <= frame_top) { // If the variable is resident in the stack frame created by the - // expression, - // then it cannot be relied upon to stay around. We treat it as - // needing - // reallocation. + // expression, then it cannot be relied upon to stay around. We + // treat it as needing reallocation. m_persistent_variable_sp->m_flags |= ExpressionVariable::EVIsLLDBAllocated; m_persistent_variable_sp->m_flags |= diff --git a/lldb/source/Expression/REPL.cpp b/lldb/source/Expression/REPL.cpp index 84a6405f326..da9dc08bee9 100644 --- a/lldb/source/Expression/REPL.cpp +++ b/lldb/source/Expression/REPL.cpp @@ -243,10 +243,8 @@ void REPL::IOHandlerInputComplete(IOHandler &io_handler, std::string &code) { IOHandler::Type::REPL, IOHandler::Type::CommandInterpreter)) { // We typed "quit" or an alias to quit so we need to check if the // command interpreter is above us and tell it that it is done as - // well - // so we don't drop back into the command interpreter if we have - // already - // quit + // well so we don't drop back into the command interpreter if we + // have already quit lldb::IOHandlerSP io_handler_sp(ci.GetIOHandler()); if (io_handler_sp) io_handler_sp->SetIsDone(true); @@ -444,8 +442,8 @@ void REPL::IOHandlerInputComplete(IOHandler &io_handler, std::string &code) { } } - // Don't complain about the REPL process going away if we are in the process - // of quitting. + // Don't complain about the REPL process going away if we are in the + // process of quitting. if (!did_quit && (!process_sp || !process_sp->IsAlive())) { error_sp->Printf( "error: REPL process is no longer alive, exiting REPL\n"); @@ -542,11 +540,9 @@ Status REPL::RunLoop() { debugger.PushIOHandler(io_handler_sp); - // Check if we are in dedicated REPL mode where LLDB was start with the - // "--repl" option - // from the command line. Currently we know this by checking if the debugger - // already - // has a IOHandler thread. + // Check if we are in dedicated REPL mode where LLDB was start with the "-- + // repl" option from the command line. Currently we know this by checking if + // the debugger already has a IOHandler thread. if (!debugger.HasIOHandlerThread()) { // The debugger doesn't have an existing IOHandler thread, so this must be // dedicated REPL mode... @@ -566,8 +562,8 @@ Status REPL::RunLoop() { io_handler_sp->WaitForPop(); if (m_dedicated_repl_mode) { - // If we were in dedicated REPL mode we would have started the - // IOHandler thread, and we should kill our process + // If we were in dedicated REPL mode we would have started the IOHandler + // thread, and we should kill our process lldb::ProcessSP process_sp = m_target.GetProcessSP(); if (process_sp && process_sp->IsAlive()) process_sp->Destroy(false); diff --git a/lldb/source/Expression/UserExpression.cpp b/lldb/source/Expression/UserExpression.cpp index 3386bc4577a..34945fdcbfa 100644 --- a/lldb/source/Expression/UserExpression.cpp +++ b/lldb/source/Expression/UserExpression.cpp @@ -179,9 +179,8 @@ lldb::ExpressionResults UserExpression::Evaluate( execution_policy = eExecutionPolicyNever; // We need to set the expression execution thread here, turns out parse can - // call functions in the process of - // looking up symbols, which will escape the context set by exe_ctx passed to - // Execute. + // call functions in the process of looking up symbols, which will escape the + // context set by exe_ctx passed to Execute. lldb::ThreadSP thread_sp = exe_ctx.GetThreadSP(); ThreadList::ExpressionExecutionThreadPusher execution_thread_pusher( thread_sp); @@ -198,9 +197,9 @@ lldb::ExpressionResults UserExpression::Evaluate( else full_prefix = option_prefix; - // If the language was not specified in the expression command, - // set it to the language in the target's properties if - // specified, else default to the langage for the frame. + // If the language was not specified in the expression command, set it to the + // language in the target's properties if specified, else default to the + // langage for the frame. if (language == lldb::eLanguageTypeUnknown) { if (target->GetLanguage() != lldb::eLanguageTypeUnknown) language = target->GetLanguage(); |