[lldb][NFC] Fix all formatting errors in .cpp file headers
Summary:
A *.cpp file header in LLDB (and in LLDB) should like this:
```
//===-- TestUtilities.cpp -------------------------------------------------===//
```
However in LLDB most of our source files have arbitrary changes to this format and
these changes are spreading through LLDB as folks usually just use the existing
source files as templates for their new files (most notably the unnecessary
editor language indicator `-*- C++ -*-` is spreading and in every review
someone is pointing out that this is wrong, resulting in people pointing out that this
is done in the same way in other files).
This patch removes most of these inconsistencies including the editor language indicators,
all the different missing/additional '-' characters, files that center the file name, missing
trailing `===//` (mostly caused by clang-format breaking the line).
Reviewers: aprantl, espindola, jfb, shafik, JDevlieghere
Reviewed By: JDevlieghere
Subscribers: dexonsmith, wuzish, emaste, sdardis, nemanjai, kbarton, MaskRay, atanasyan, arphaman, jfb, abidh, jsji, JDevlieghere, usaxena95, lldb-commits
Tags: #lldb
Differential Revision: https://reviews.llvm.org/D73258
2020-01-24 08:23:27 +01:00
|
|
|
//===-- SymbolContext.cpp -------------------------------------------------===//
|
2010-06-08 16:52:24 +00:00
|
|
|
//
|
2019-01-19 08:50:56 +00:00
|
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
|
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
|
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
2010-06-08 16:52:24 +00:00
|
|
|
//
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
|
|
#include "lldb/Symbol/SymbolContext.h"
|
2010-06-28 21:30:43 +00:00
|
|
|
|
2010-06-08 16:52:24 +00:00
|
|
|
#include "lldb/Core/Module.h"
|
<rdar://problem/11757916>
Make breakpoint setting by file and line much more efficient by only looking for inlined breakpoint locations if we are setting a breakpoint in anything but a source implementation file. Implementing this complex for a many reasons. Turns out that parsing compile units lazily had some issues with respect to how we need to do things with DWARF in .o files. So the fixes in the checkin for this makes these changes:
- Add a new setting called "target.inline-breakpoint-strategy" which can be set to "never", "always", or "headers". "never" will never try and set any inlined breakpoints (fastest). "always" always looks for inlined breakpoint locations (slowest, but most accurate). "headers", which is the default setting, will only look for inlined breakpoint locations if the breakpoint is set in what are consudered to be header files, which is realy defined as "not in an implementation source file".
- modify the breakpoint setting by file and line to check the current "target.inline-breakpoint-strategy" setting and act accordingly
- Modify compile units to be able to get their language and other info lazily. This allows us to create compile units from the debug map and not have to fill all of the details in, and then lazily discover this information as we go on debuggging. This is needed to avoid parsing all .o files when setting breakpoints in implementation only files (no inlines). Otherwise we would need to parse the .o file, the object file (mach-o in our case) and the symbol file (DWARF in the object file) just to see what the compile unit was.
- modify the "SymbolFileDWARFDebugMap" to subclass lldb_private::Module so that the virtual "GetObjectFile()" and "GetSymbolVendor()" functions can be intercepted when the .o file contenst are later lazilly needed. Prior to this fix, when we first instantiated the "SymbolFileDWARFDebugMap" class, we would also make modules, object files and symbol files for every .o file in the debug map because we needed to fix up the sections in the .o files with information that is in the executable debug map. Now we lazily do this in the DebugMapModule::GetObjectFile()
Cleaned up header includes a bit as well.
llvm-svn: 162860
2012-08-29 21:13:06 +00:00
|
|
|
#include "lldb/Core/ModuleSpec.h"
|
2012-01-05 03:57:59 +00:00
|
|
|
#include "lldb/Host/Host.h"
|
2015-01-15 20:08:35 +00:00
|
|
|
#include "lldb/Host/StringConvert.h"
|
2012-07-14 00:53:55 +00:00
|
|
|
#include "lldb/Symbol/Block.h"
|
2010-06-28 21:30:43 +00:00
|
|
|
#include "lldb/Symbol/CompileUnit.h"
|
2010-06-08 16:52:24 +00:00
|
|
|
#include "lldb/Symbol/ObjectFile.h"
|
|
|
|
|
#include "lldb/Symbol/Symbol.h"
|
2011-10-07 01:49:45 +00:00
|
|
|
#include "lldb/Symbol/SymbolFile.h"
|
2010-06-08 16:52:24 +00:00
|
|
|
#include "lldb/Symbol/SymbolVendor.h"
|
2015-01-15 02:59:20 +00:00
|
|
|
#include "lldb/Symbol/Variable.h"
|
2010-06-28 21:30:43 +00:00
|
|
|
#include "lldb/Target/Target.h"
|
2017-03-03 20:56:28 +00:00
|
|
|
#include "lldb/Utility/Log.h"
|
2019-07-19 00:39:51 +00:00
|
|
|
#include "lldb/Utility/StreamString.h"
|
2010-06-08 16:52:24 +00:00
|
|
|
|
|
|
|
|
using namespace lldb;
|
|
|
|
|
using namespace lldb_private;
|
|
|
|
|
|
|
|
|
|
SymbolContext::SymbolContext()
|
2014-04-20 13:17:36 +00:00
|
|
|
: target_sp(), module_sp(), comp_unit(nullptr), function(nullptr),
|
|
|
|
|
block(nullptr), line_entry(), symbol(nullptr), variable(nullptr) {}
|
2016-09-06 20:57:50 +00:00
|
|
|
|
2014-04-20 13:17:36 +00:00
|
|
|
SymbolContext::SymbolContext(const ModuleSP &m, CompileUnit *cu, Function *f,
|
|
|
|
|
Block *b, LineEntry *le, Symbol *s)
|
2010-06-08 16:52:24 +00:00
|
|
|
: target_sp(), module_sp(m), comp_unit(cu), function(f), block(b),
|
2014-04-20 13:17:36 +00:00
|
|
|
line_entry(), symbol(s), variable(nullptr) {
|
2010-06-08 16:52:24 +00:00
|
|
|
if (le)
|
|
|
|
|
line_entry = *le;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
SymbolContext::SymbolContext(const TargetSP &t, const ModuleSP &m,
|
|
|
|
|
CompileUnit *cu, Function *f, Block *b,
|
|
|
|
|
LineEntry *le, Symbol *s)
|
|
|
|
|
: target_sp(t), module_sp(m), comp_unit(cu), function(f), block(b),
|
2015-01-15 02:59:20 +00:00
|
|
|
line_entry(), symbol(s), variable(nullptr) {
|
2010-06-08 16:52:24 +00:00
|
|
|
if (le)
|
|
|
|
|
line_entry = *le;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
SymbolContext::SymbolContext(SymbolContextScope *sc_scope)
|
|
|
|
|
: target_sp(), module_sp(), comp_unit(nullptr), function(nullptr),
|
|
|
|
|
block(nullptr), line_entry(), symbol(nullptr), variable(nullptr) {
|
2015-01-15 02:59:20 +00:00
|
|
|
sc_scope->CalculateSymbolContext(this);
|
2010-06-08 16:52:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
SymbolContext::~SymbolContext() {}
|
2016-09-06 20:57:50 +00:00
|
|
|
|
2011-09-17 06:21:20 +00:00
|
|
|
void SymbolContext::Clear(bool clear_target) {
|
|
|
|
|
if (clear_target)
|
|
|
|
|
target_sp.reset();
|
2010-06-08 16:52:24 +00:00
|
|
|
module_sp.reset();
|
2011-09-17 06:21:20 +00:00
|
|
|
comp_unit = nullptr;
|
|
|
|
|
function = nullptr;
|
2014-04-20 13:17:36 +00:00
|
|
|
block = nullptr;
|
2011-09-17 06:21:20 +00:00
|
|
|
line_entry.Clear();
|
|
|
|
|
symbol = nullptr;
|
2015-01-15 02:59:20 +00:00
|
|
|
variable = nullptr;
|
2011-09-17 06:21:20 +00:00
|
|
|
}
|
|
|
|
|
|
2010-06-08 16:52:24 +00:00
|
|
|
bool SymbolContext::DumpStopContext(Stream *s, ExecutionContextScope *exe_scope,
|
|
|
|
|
const Address &addr, bool show_fullpaths,
|
|
|
|
|
bool show_module, bool show_inlined_frames,
|
|
|
|
|
bool show_function_arguments,
|
[trace][intel-pt] Implement the basic decoding functionality
Depends on D89408.
This diff finally implements trace decoding!
The current interface is
$ trace load /path/to/trace/session/file.json
$ thread trace dump instructions
thread #1: tid = 3842849, total instructions = 22
[ 0] 0x40052d
[ 1] 0x40052d
...
[19] 0x400521
$ # simply enter, which is a repeat command
[20] 0x40052d
[21] 0x400529
...
This doesn't do any disassembly, which will be done in the next diff.
Changes:
- Added an IntelPTDecoder class, that is a wrapper for libipt, which is the actual library that performs the decoding.
- Added TraceThreadDecoder class that decodes traces and memoizes the result to avoid repeating the decoding step.
- Added a DecodedThread class, which represents the output from decoding and that for the time being only stores the list of reconstructed instructions. Later it'll contain the function call hierarchy, which will enable reconstructing backtraces.
- Added basic APIs for accessing the trace in Trace.h:
- GetInstructionCount, which counts the number of instructions traced for a given thread
- IsTraceFailed, which returns an Error if decoding a thread failed
- ForEachInstruction, which iterates on the instructions traced for a given thread, concealing the internal storage of threads, as plug-ins can decide to generate the instructions on the fly or to store them all in a vector, like I do.
- DumpTraceInstructions was updated to print the instructions or show an error message if decoding was impossible.
- Tests included
Differential Revision: https://reviews.llvm.org/D89283
2020-10-14 10:26:10 -07:00
|
|
|
bool show_function_name,
|
|
|
|
|
bool show_inline_callsite_line_info) const {
|
2010-06-08 16:52:24 +00:00
|
|
|
bool dumped_something = false;
|
|
|
|
|
if (show_module && module_sp) {
|
2013-02-23 04:12:47 +00:00
|
|
|
if (show_fullpaths)
|
|
|
|
|
*s << module_sp->GetFileSpec();
|
|
|
|
|
else
|
2010-06-08 16:52:24 +00:00
|
|
|
*s << module_sp->GetFileSpec().GetFilename();
|
2010-09-02 21:44:10 +00:00
|
|
|
s->PutChar('`');
|
2014-04-20 13:17:36 +00:00
|
|
|
dumped_something = true;
|
2016-09-06 20:57:50 +00:00
|
|
|
}
|
|
|
|
|
|
2014-04-20 13:17:36 +00:00
|
|
|
if (function != nullptr) {
|
2015-02-13 23:24:21 +00:00
|
|
|
SymbolContext inline_parent_sc;
|
2010-06-08 16:52:24 +00:00
|
|
|
Address inline_parent_addr;
|
2018-12-15 00:15:33 +00:00
|
|
|
if (!show_function_name) {
|
2015-02-13 23:24:21 +00:00
|
|
|
s->Printf("<");
|
2010-06-08 16:52:24 +00:00
|
|
|
dumped_something = true;
|
|
|
|
|
} else {
|
|
|
|
|
ConstString name;
|
2018-12-15 00:15:33 +00:00
|
|
|
if (!show_function_arguments)
|
2015-07-08 22:32:23 +00:00
|
|
|
name = function->GetNameNoArguments();
|
|
|
|
|
if (!name)
|
|
|
|
|
name = function->GetName();
|
|
|
|
|
if (name)
|
|
|
|
|
name.Dump(s);
|
2016-09-06 20:57:50 +00:00
|
|
|
}
|
|
|
|
|
|
2010-09-10 22:05:05 +00:00
|
|
|
if (addr.IsValid()) {
|
|
|
|
|
const addr_t function_offset =
|
|
|
|
|
addr.GetOffset() -
|
|
|
|
|
function->GetAddressRange().GetBaseAddress().GetOffset();
|
2018-12-15 00:15:33 +00:00
|
|
|
if (!show_function_name) {
|
2010-09-02 21:44:10 +00:00
|
|
|
// Print +offset even if offset is 0
|
2011-07-10 19:21:23 +00:00
|
|
|
dumped_something = true;
|
2014-04-20 13:17:36 +00:00
|
|
|
s->Printf("+%" PRIu64 ">", function_offset);
|
2015-02-13 23:24:21 +00:00
|
|
|
} else if (function_offset) {
|
|
|
|
|
dumped_something = true;
|
2010-09-10 22:05:05 +00:00
|
|
|
s->Printf(" + %" PRIu64, function_offset);
|
2015-02-13 23:24:21 +00:00
|
|
|
}
|
2011-07-10 19:21:23 +00:00
|
|
|
}
|
2016-09-06 20:57:50 +00:00
|
|
|
|
2011-10-01 00:45:15 +00:00
|
|
|
if (GetParentOfInlinedScope(addr, inline_parent_sc, inline_parent_addr)) {
|
2011-07-10 19:21:23 +00:00
|
|
|
dumped_something = true;
|
2011-10-01 00:45:15 +00:00
|
|
|
Block *inlined_block = block->GetContainingInlinedBlock();
|
|
|
|
|
const InlineFunctionInfo *inlined_block_info =
|
|
|
|
|
inlined_block->GetInlinedFunctionInfo();
|
2020-01-30 21:55:18 -08:00
|
|
|
s->Printf(" [inlined] %s", inlined_block_info->GetName().GetCString());
|
2016-09-06 20:57:50 +00:00
|
|
|
|
2010-06-08 16:52:24 +00:00
|
|
|
lldb_private::AddressRange block_range;
|
2012-03-07 21:03:09 +00:00
|
|
|
if (inlined_block->GetRangeContainingAddress(addr, block_range)) {
|
2015-06-25 21:46:34 +00:00
|
|
|
const addr_t inlined_function_offset =
|
|
|
|
|
addr.GetOffset() - block_range.GetBaseAddress().GetOffset();
|
2015-02-13 23:24:21 +00:00
|
|
|
if (inlined_function_offset) {
|
2012-11-29 21:49:15 +00:00
|
|
|
s->Printf(" + %" PRIu64, inlined_function_offset);
|
2010-06-08 16:52:24 +00:00
|
|
|
}
|
|
|
|
|
}
|
[trace][intel-pt] Implement the basic decoding functionality
Depends on D89408.
This diff finally implements trace decoding!
The current interface is
$ trace load /path/to/trace/session/file.json
$ thread trace dump instructions
thread #1: tid = 3842849, total instructions = 22
[ 0] 0x40052d
[ 1] 0x40052d
...
[19] 0x400521
$ # simply enter, which is a repeat command
[20] 0x40052d
[21] 0x400529
...
This doesn't do any disassembly, which will be done in the next diff.
Changes:
- Added an IntelPTDecoder class, that is a wrapper for libipt, which is the actual library that performs the decoding.
- Added TraceThreadDecoder class that decodes traces and memoizes the result to avoid repeating the decoding step.
- Added a DecodedThread class, which represents the output from decoding and that for the time being only stores the list of reconstructed instructions. Later it'll contain the function call hierarchy, which will enable reconstructing backtraces.
- Added basic APIs for accessing the trace in Trace.h:
- GetInstructionCount, which counts the number of instructions traced for a given thread
- IsTraceFailed, which returns an Error if decoding a thread failed
- ForEachInstruction, which iterates on the instructions traced for a given thread, concealing the internal storage of threads, as plug-ins can decide to generate the instructions on the fly or to store them all in a vector, like I do.
- DumpTraceInstructions was updated to print the instructions or show an error message if decoding was impossible.
- Tests included
Differential Revision: https://reviews.llvm.org/D89283
2020-10-14 10:26:10 -07:00
|
|
|
if (show_inline_callsite_line_info) {
|
|
|
|
|
const Declaration &call_site = inlined_block_info->GetCallSite();
|
|
|
|
|
if (call_site.IsValid()) {
|
|
|
|
|
s->PutCString(" at ");
|
|
|
|
|
call_site.DumpStopContext(s, show_fullpaths);
|
|
|
|
|
}
|
|
|
|
|
} else if (line_entry.IsValid()) {
|
2010-06-08 16:52:24 +00:00
|
|
|
s->PutCString(" at ");
|
[trace][intel-pt] Implement the basic decoding functionality
Depends on D89408.
This diff finally implements trace decoding!
The current interface is
$ trace load /path/to/trace/session/file.json
$ thread trace dump instructions
thread #1: tid = 3842849, total instructions = 22
[ 0] 0x40052d
[ 1] 0x40052d
...
[19] 0x400521
$ # simply enter, which is a repeat command
[20] 0x40052d
[21] 0x400529
...
This doesn't do any disassembly, which will be done in the next diff.
Changes:
- Added an IntelPTDecoder class, that is a wrapper for libipt, which is the actual library that performs the decoding.
- Added TraceThreadDecoder class that decodes traces and memoizes the result to avoid repeating the decoding step.
- Added a DecodedThread class, which represents the output from decoding and that for the time being only stores the list of reconstructed instructions. Later it'll contain the function call hierarchy, which will enable reconstructing backtraces.
- Added basic APIs for accessing the trace in Trace.h:
- GetInstructionCount, which counts the number of instructions traced for a given thread
- IsTraceFailed, which returns an Error if decoding a thread failed
- ForEachInstruction, which iterates on the instructions traced for a given thread, concealing the internal storage of threads, as plug-ins can decide to generate the instructions on the fly or to store them all in a vector, like I do.
- DumpTraceInstructions was updated to print the instructions or show an error message if decoding was impossible.
- Tests included
Differential Revision: https://reviews.llvm.org/D89283
2020-10-14 10:26:10 -07:00
|
|
|
line_entry.DumpStopContext(s, show_fullpaths);
|
2016-09-06 20:57:50 +00:00
|
|
|
}
|
[trace][intel-pt] Implement the basic decoding functionality
Depends on D89408.
This diff finally implements trace decoding!
The current interface is
$ trace load /path/to/trace/session/file.json
$ thread trace dump instructions
thread #1: tid = 3842849, total instructions = 22
[ 0] 0x40052d
[ 1] 0x40052d
...
[19] 0x400521
$ # simply enter, which is a repeat command
[20] 0x40052d
[21] 0x400529
...
This doesn't do any disassembly, which will be done in the next diff.
Changes:
- Added an IntelPTDecoder class, that is a wrapper for libipt, which is the actual library that performs the decoding.
- Added TraceThreadDecoder class that decodes traces and memoizes the result to avoid repeating the decoding step.
- Added a DecodedThread class, which represents the output from decoding and that for the time being only stores the list of reconstructed instructions. Later it'll contain the function call hierarchy, which will enable reconstructing backtraces.
- Added basic APIs for accessing the trace in Trace.h:
- GetInstructionCount, which counts the number of instructions traced for a given thread
- IsTraceFailed, which returns an Error if decoding a thread failed
- ForEachInstruction, which iterates on the instructions traced for a given thread, concealing the internal storage of threads, as plug-ins can decide to generate the instructions on the fly or to store them all in a vector, like I do.
- DumpTraceInstructions was updated to print the instructions or show an error message if decoding was impossible.
- Tests included
Differential Revision: https://reviews.llvm.org/D89283
2020-10-14 10:26:10 -07:00
|
|
|
|
2010-06-08 16:52:24 +00:00
|
|
|
if (show_inlined_frames) {
|
2011-10-01 00:45:15 +00:00
|
|
|
s->EOL();
|
|
|
|
|
s->Indent();
|
2015-02-13 23:24:21 +00:00
|
|
|
const bool show_function_name = true;
|
2010-06-08 16:52:24 +00:00
|
|
|
return inline_parent_sc.DumpStopContext(
|
|
|
|
|
s, exe_scope, inline_parent_addr, show_fullpaths, show_module,
|
|
|
|
|
show_inlined_frames, show_function_arguments, show_function_name);
|
2016-09-06 20:57:50 +00:00
|
|
|
}
|
|
|
|
|
} else {
|
2010-06-08 16:52:24 +00:00
|
|
|
if (line_entry.IsValid()) {
|
2011-07-10 19:21:23 +00:00
|
|
|
dumped_something = true;
|
2015-01-15 02:59:20 +00:00
|
|
|
s->PutCString(" at ");
|
2010-09-02 21:44:10 +00:00
|
|
|
if (line_entry.DumpStopContext(s, show_fullpaths))
|
2015-02-13 23:24:21 +00:00
|
|
|
dumped_something = true;
|
2010-06-08 16:52:24 +00:00
|
|
|
}
|
2016-09-06 20:57:50 +00:00
|
|
|
}
|
2014-04-20 13:17:36 +00:00
|
|
|
} else if (symbol != nullptr) {
|
2018-12-15 00:15:33 +00:00
|
|
|
if (!show_function_name) {
|
2015-02-13 23:24:21 +00:00
|
|
|
s->Printf("<");
|
|
|
|
|
dumped_something = true;
|
2015-07-08 22:32:23 +00:00
|
|
|
} else if (symbol->GetName()) {
|
2015-02-13 23:24:21 +00:00
|
|
|
dumped_something = true;
|
2012-05-10 02:52:23 +00:00
|
|
|
if (symbol->GetType() == eSymbolTypeTrampoline)
|
|
|
|
|
s->PutCString("symbol stub for: ");
|
2015-07-08 22:32:23 +00:00
|
|
|
symbol->GetName().Dump(s);
|
2016-09-06 20:57:50 +00:00
|
|
|
}
|
|
|
|
|
|
2012-03-07 21:03:09 +00:00
|
|
|
if (addr.IsValid() && symbol->ValueIsAddress()) {
|
2011-10-01 00:45:15 +00:00
|
|
|
const addr_t symbol_offset =
|
2010-09-10 22:05:05 +00:00
|
|
|
addr.GetOffset() - symbol->GetAddressRef().GetOffset();
|
2018-12-15 00:15:33 +00:00
|
|
|
if (!show_function_name) {
|
2015-02-13 23:24:21 +00:00
|
|
|
// Print +offset even if offset is 0
|
2011-07-10 19:21:23 +00:00
|
|
|
dumped_something = true;
|
2015-02-13 23:24:21 +00:00
|
|
|
s->Printf("+%" PRIu64 ">", symbol_offset);
|
|
|
|
|
} else if (symbol_offset) {
|
2011-07-10 19:21:23 +00:00
|
|
|
dumped_something = true;
|
2015-02-13 23:24:21 +00:00
|
|
|
s->Printf(" + %" PRIu64, symbol_offset);
|
2016-09-06 20:57:50 +00:00
|
|
|
}
|
|
|
|
|
}
|
2010-09-10 22:05:05 +00:00
|
|
|
} else if (addr.IsValid()) {
|
2010-09-14 23:36:40 +00:00
|
|
|
addr.Dump(s, exe_scope, Address::DumpStyleModuleWithFileAddress);
|
2011-07-10 19:21:23 +00:00
|
|
|
dumped_something = true;
|
2016-09-06 20:57:50 +00:00
|
|
|
}
|
2011-07-10 19:21:23 +00:00
|
|
|
return dumped_something;
|
2010-06-08 16:52:24 +00:00
|
|
|
}
|
|
|
|
|
|
2010-09-14 23:36:40 +00:00
|
|
|
void SymbolContext::GetDescription(Stream *s, lldb::DescriptionLevel level,
|
|
|
|
|
Target *target) const {
|
2010-06-28 21:30:43 +00:00
|
|
|
if (module_sp) {
|
2010-09-10 01:30:46 +00:00
|
|
|
s->Indent(" Module: file = \"");
|
2019-12-06 08:38:23 +01:00
|
|
|
module_sp->GetFileSpec().Dump(s->AsRawOstream());
|
2010-09-10 01:30:46 +00:00
|
|
|
*s << '"';
|
2014-04-20 13:17:36 +00:00
|
|
|
if (module_sp->GetArchitecture().IsValid())
|
2010-06-28 21:30:43 +00:00
|
|
|
s->Printf(", arch = \"%s\"",
|
2010-09-14 23:36:40 +00:00
|
|
|
module_sp->GetArchitecture().GetArchitectureName());
|
2010-06-28 21:30:43 +00:00
|
|
|
s->EOL();
|
|
|
|
|
}
|
|
|
|
|
|
2014-04-20 13:17:36 +00:00
|
|
|
if (comp_unit != nullptr) {
|
2010-06-28 21:30:43 +00:00
|
|
|
s->Indent("CompileUnit: ");
|
2010-09-14 23:36:40 +00:00
|
|
|
comp_unit->GetDescription(s, level);
|
2010-06-28 21:30:43 +00:00
|
|
|
s->EOL();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (function != nullptr) {
|
|
|
|
|
s->Indent(" Function: ");
|
2010-09-14 23:36:40 +00:00
|
|
|
function->GetDescription(s, level, target);
|
2010-06-28 21:30:43 +00:00
|
|
|
s->EOL();
|
|
|
|
|
|
|
|
|
|
Type *func_type = function->GetType();
|
|
|
|
|
if (func_type) {
|
|
|
|
|
s->Indent(" FuncType: ");
|
2020-07-21 13:53:43 -07:00
|
|
|
func_type->GetDescription(s, level, false, target);
|
2014-04-20 13:17:36 +00:00
|
|
|
s->EOL();
|
2016-09-06 20:57:50 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2014-04-20 13:17:36 +00:00
|
|
|
if (block != nullptr) {
|
2010-06-28 21:30:43 +00:00
|
|
|
std::vector<Block *> blocks;
|
|
|
|
|
blocks.push_back(block);
|
|
|
|
|
Block *parent_block = block->GetParent();
|
2016-09-06 20:57:50 +00:00
|
|
|
|
2010-06-28 21:30:43 +00:00
|
|
|
while (parent_block) {
|
|
|
|
|
blocks.push_back(parent_block);
|
|
|
|
|
parent_block = parent_block->GetParent();
|
2016-09-06 20:57:50 +00:00
|
|
|
}
|
2010-06-28 21:30:43 +00:00
|
|
|
std::vector<Block *>::reverse_iterator pos;
|
|
|
|
|
std::vector<Block *>::reverse_iterator begin = blocks.rbegin();
|
|
|
|
|
std::vector<Block *>::reverse_iterator end = blocks.rend();
|
|
|
|
|
for (pos = begin; pos != end; ++pos) {
|
|
|
|
|
if (pos == begin)
|
|
|
|
|
s->Indent(" Blocks: ");
|
2016-09-06 20:57:50 +00:00
|
|
|
else
|
2010-09-14 23:36:40 +00:00
|
|
|
s->Indent(" ");
|
|
|
|
|
(*pos)->GetDescription(s, function, level, target);
|
2010-06-28 21:30:43 +00:00
|
|
|
s->EOL();
|
2016-09-06 20:57:50 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2010-06-08 16:52:24 +00:00
|
|
|
if (line_entry.IsValid()) {
|
2010-06-28 21:30:43 +00:00
|
|
|
s->Indent(" LineEntry: ");
|
2016-02-13 00:31:47 +00:00
|
|
|
line_entry.GetDescription(s, level, comp_unit, target, false);
|
2010-06-28 21:30:43 +00:00
|
|
|
s->EOL();
|
|
|
|
|
}
|
2015-01-15 02:59:20 +00:00
|
|
|
|
|
|
|
|
if (symbol != nullptr) {
|
|
|
|
|
s->Indent(" Symbol: ");
|
|
|
|
|
symbol->GetDescription(s, level, target);
|
2010-06-28 21:30:43 +00:00
|
|
|
s->EOL();
|
2016-09-06 20:57:50 +00:00
|
|
|
}
|
2015-01-15 02:59:20 +00:00
|
|
|
|
|
|
|
|
if (variable != nullptr) {
|
|
|
|
|
s->Indent(" Variable: ");
|
|
|
|
|
|
|
|
|
|
s->Printf("id = {0x%8.8" PRIx64 "}, ", variable->GetID());
|
|
|
|
|
|
|
|
|
|
switch (variable->GetScope()) {
|
|
|
|
|
case eValueTypeVariableGlobal:
|
|
|
|
|
s->PutCString("kind = global, ");
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case eValueTypeVariableStatic:
|
|
|
|
|
s->PutCString("kind = static, ");
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case eValueTypeVariableArgument:
|
|
|
|
|
s->PutCString("kind = argument, ");
|
|
|
|
|
break;
|
|
|
|
|
|
2016-07-01 17:17:23 +00:00
|
|
|
case eValueTypeVariableLocal:
|
|
|
|
|
s->PutCString("kind = local, ");
|
|
|
|
|
break;
|
|
|
|
|
|
2015-01-15 02:59:20 +00:00
|
|
|
case eValueTypeVariableThreadLocal:
|
|
|
|
|
s->PutCString("kind = thread local, ");
|
|
|
|
|
break;
|
|
|
|
|
|
2016-09-06 20:57:50 +00:00
|
|
|
default:
|
2015-01-15 02:59:20 +00:00
|
|
|
break;
|
|
|
|
|
}
|
2016-09-06 20:57:50 +00:00
|
|
|
|
2015-01-15 02:59:20 +00:00
|
|
|
s->Printf("name = \"%s\"\n", variable->GetName().GetCString());
|
2016-09-06 20:57:50 +00:00
|
|
|
}
|
2010-06-28 21:30:43 +00:00
|
|
|
}
|
|
|
|
|
|
Added support for inlined stack frames being represented as real stack frames
which is now on by default. Frames are gotten from the unwinder as concrete
frames, then if inline frames are to be shown, extra information to track
and reconstruct these frames is cached with each Thread and exanded as needed.
I added an inline height as part of the lldb_private::StackID class, the class
that helps us uniquely identify stack frames. This allows for two frames to
shared the same call frame address, yet differ only in inline height.
Fixed setting breakpoint by address to not require addresses to resolve.
A quick example:
% cat main.cpp
% ./build/Debug/lldb test/stl/a.out
Current executable set to 'test/stl/a.out' (x86_64).
(lldb) breakpoint set --address 0x0000000100000d31
Breakpoint created: 1: address = 0x0000000100000d31, locations = 1
(lldb) r
Launching 'a.out' (x86_64)
(lldb) Process 38031 Stopped
* thread #1: tid = 0x2e03, pc = 0x0000000100000d31, where = a.out`main [inlined] std::string::_M_data() const at /usr/include/c++/4.2.1/bits/basic_string.h:280, stop reason = breakpoint 1.1, queue = com.apple.main-thread
277
278 _CharT*
279 _M_data() const
280 -> { return _M_dataplus._M_p; }
281
282 _CharT*
283 _M_data(_CharT* __p)
(lldb) bt
thread #1: tid = 0x2e03, stop reason = breakpoint 1.1, queue = com.apple.main-thread
frame #0: pc = 0x0000000100000d31, where = a.out`main [inlined] std::string::_M_data() const at /usr/include/c++/4.2.1/bits/basic_string.h:280
frame #1: pc = 0x0000000100000d31, where = a.out`main [inlined] std::string::_M_rep() const at /usr/include/c++/4.2.1/bits/basic_string.h:288
frame #2: pc = 0x0000000100000d31, where = a.out`main [inlined] std::string::size() const at /usr/include/c++/4.2.1/bits/basic_string.h:606
frame #3: pc = 0x0000000100000d31, where = a.out`main [inlined] operator<< <char, std::char_traits<char>, std::allocator<char> > at /usr/include/c++/4.2.1/bits/basic_string.h:2414
frame #4: pc = 0x0000000100000d31, where = a.out`main + 33 at /Volumes/work/gclayton/Documents/src/lldb/test/stl/main.cpp:14
frame #5: pc = 0x0000000100000d08, where = a.out`start + 52
Each inline frame contains only the variables that they contain and each inlined
stack frame is treated as a single entity.
llvm-svn: 111877
2010-08-24 00:45:41 +00:00
|
|
|
uint32_t SymbolContext::GetResolvedMask() const {
|
|
|
|
|
uint32_t resolved_mask = 0;
|
|
|
|
|
if (target_sp)
|
|
|
|
|
resolved_mask |= eSymbolContextTarget;
|
|
|
|
|
if (module_sp)
|
|
|
|
|
resolved_mask |= eSymbolContextModule;
|
|
|
|
|
if (comp_unit)
|
|
|
|
|
resolved_mask |= eSymbolContextCompUnit;
|
|
|
|
|
if (function)
|
|
|
|
|
resolved_mask |= eSymbolContextFunction;
|
|
|
|
|
if (block)
|
|
|
|
|
resolved_mask |= eSymbolContextBlock;
|
|
|
|
|
if (line_entry.IsValid())
|
|
|
|
|
resolved_mask |= eSymbolContextLineEntry;
|
|
|
|
|
if (symbol)
|
|
|
|
|
resolved_mask |= eSymbolContextSymbol;
|
2015-01-15 02:59:20 +00:00
|
|
|
if (variable)
|
|
|
|
|
resolved_mask |= eSymbolContextVariable;
|
Added support for inlined stack frames being represented as real stack frames
which is now on by default. Frames are gotten from the unwinder as concrete
frames, then if inline frames are to be shown, extra information to track
and reconstruct these frames is cached with each Thread and exanded as needed.
I added an inline height as part of the lldb_private::StackID class, the class
that helps us uniquely identify stack frames. This allows for two frames to
shared the same call frame address, yet differ only in inline height.
Fixed setting breakpoint by address to not require addresses to resolve.
A quick example:
% cat main.cpp
% ./build/Debug/lldb test/stl/a.out
Current executable set to 'test/stl/a.out' (x86_64).
(lldb) breakpoint set --address 0x0000000100000d31
Breakpoint created: 1: address = 0x0000000100000d31, locations = 1
(lldb) r
Launching 'a.out' (x86_64)
(lldb) Process 38031 Stopped
* thread #1: tid = 0x2e03, pc = 0x0000000100000d31, where = a.out`main [inlined] std::string::_M_data() const at /usr/include/c++/4.2.1/bits/basic_string.h:280, stop reason = breakpoint 1.1, queue = com.apple.main-thread
277
278 _CharT*
279 _M_data() const
280 -> { return _M_dataplus._M_p; }
281
282 _CharT*
283 _M_data(_CharT* __p)
(lldb) bt
thread #1: tid = 0x2e03, stop reason = breakpoint 1.1, queue = com.apple.main-thread
frame #0: pc = 0x0000000100000d31, where = a.out`main [inlined] std::string::_M_data() const at /usr/include/c++/4.2.1/bits/basic_string.h:280
frame #1: pc = 0x0000000100000d31, where = a.out`main [inlined] std::string::_M_rep() const at /usr/include/c++/4.2.1/bits/basic_string.h:288
frame #2: pc = 0x0000000100000d31, where = a.out`main [inlined] std::string::size() const at /usr/include/c++/4.2.1/bits/basic_string.h:606
frame #3: pc = 0x0000000100000d31, where = a.out`main [inlined] operator<< <char, std::char_traits<char>, std::allocator<char> > at /usr/include/c++/4.2.1/bits/basic_string.h:2414
frame #4: pc = 0x0000000100000d31, where = a.out`main + 33 at /Volumes/work/gclayton/Documents/src/lldb/test/stl/main.cpp:14
frame #5: pc = 0x0000000100000d08, where = a.out`start + 52
Each inline frame contains only the variables that they contain and each inlined
stack frame is treated as a single entity.
llvm-svn: 111877
2010-08-24 00:45:41 +00:00
|
|
|
return resolved_mask;
|
|
|
|
|
}
|
2010-06-28 21:30:43 +00:00
|
|
|
|
2010-09-14 23:36:40 +00:00
|
|
|
void SymbolContext::Dump(Stream *s, Target *target) const {
|
2015-07-22 07:58:17 +00:00
|
|
|
*s << this << ": ";
|
2010-06-08 16:52:24 +00:00
|
|
|
s->Indent();
|
|
|
|
|
s->PutCString("SymbolContext");
|
|
|
|
|
s->IndentMore();
|
2010-06-28 21:30:43 +00:00
|
|
|
s->EOL();
|
2010-06-08 16:52:24 +00:00
|
|
|
s->IndentMore();
|
|
|
|
|
s->Indent();
|
2015-07-22 07:58:17 +00:00
|
|
|
*s << "Module = " << module_sp.get() << ' ';
|
2010-06-08 16:52:24 +00:00
|
|
|
if (module_sp)
|
2019-12-06 08:38:23 +01:00
|
|
|
module_sp->GetFileSpec().Dump(s->AsRawOstream());
|
2010-06-28 21:30:43 +00:00
|
|
|
s->EOL();
|
2010-06-08 16:52:24 +00:00
|
|
|
s->Indent();
|
2015-07-22 07:58:17 +00:00
|
|
|
*s << "CompileUnit = " << comp_unit;
|
2014-04-20 13:17:36 +00:00
|
|
|
if (comp_unit != nullptr)
|
2019-11-14 15:31:26 +01:00
|
|
|
s->Format(" {{{0:x-16}} {1}", comp_unit->GetID(),
|
2019-11-28 16:22:44 +01:00
|
|
|
comp_unit->GetPrimaryFile());
|
2010-06-28 21:30:43 +00:00
|
|
|
s->EOL();
|
2010-06-08 16:52:24 +00:00
|
|
|
s->Indent();
|
2015-07-22 07:58:17 +00:00
|
|
|
*s << "Function = " << function;
|
2014-04-20 13:17:36 +00:00
|
|
|
if (function != nullptr) {
|
2019-11-14 15:31:26 +01:00
|
|
|
s->Format(" {{{0:x-16}} {1}, address-range = ", function->GetID(),
|
|
|
|
|
function->GetType()->GetName());
|
2010-09-14 23:36:40 +00:00
|
|
|
function->GetAddressRange().Dump(s, target, Address::DumpStyleLoadAddress,
|
|
|
|
|
Address::DumpStyleModuleWithFileAddress);
|
2010-06-08 16:52:24 +00:00
|
|
|
s->EOL();
|
|
|
|
|
s->Indent();
|
2010-06-28 21:30:43 +00:00
|
|
|
Type *func_type = function->GetType();
|
|
|
|
|
if (func_type) {
|
2015-07-22 07:58:17 +00:00
|
|
|
*s << " Type = ";
|
|
|
|
|
func_type->Dump(s, false);
|
2016-09-06 20:57:50 +00:00
|
|
|
}
|
|
|
|
|
}
|
2010-06-08 16:52:24 +00:00
|
|
|
s->EOL();
|
2015-07-22 07:58:17 +00:00
|
|
|
s->Indent();
|
|
|
|
|
*s << "Block = " << block;
|
|
|
|
|
if (block != nullptr)
|
2019-11-14 15:31:26 +01:00
|
|
|
s->Format(" {{{0:x-16}}", block->GetID());
|
2010-06-08 16:52:24 +00:00
|
|
|
s->EOL();
|
|
|
|
|
s->Indent();
|
2010-06-28 21:30:43 +00:00
|
|
|
*s << "LineEntry = ";
|
2010-06-08 16:52:24 +00:00
|
|
|
line_entry.Dump(s, target, true, Address::DumpStyleLoadAddress,
|
|
|
|
|
Address::DumpStyleModuleWithFileAddress, true);
|
|
|
|
|
s->EOL();
|
|
|
|
|
s->Indent();
|
2015-07-22 07:58:17 +00:00
|
|
|
*s << "Symbol = " << symbol;
|
2014-04-20 13:17:36 +00:00
|
|
|
if (symbol != nullptr && symbol->GetMangled())
|
2010-06-08 16:52:24 +00:00
|
|
|
*s << ' ' << symbol->GetName().AsCString();
|
|
|
|
|
s->EOL();
|
2015-07-22 07:58:17 +00:00
|
|
|
*s << "Variable = " << variable;
|
2015-01-15 02:59:20 +00:00
|
|
|
if (variable != nullptr) {
|
2019-11-14 15:31:26 +01:00
|
|
|
s->Format(" {{{0:x-16}} {1}", variable->GetID(),
|
|
|
|
|
variable->GetType()->GetName());
|
2010-06-08 16:52:24 +00:00
|
|
|
s->EOL();
|
2010-06-28 21:30:43 +00:00
|
|
|
}
|
2010-06-08 16:52:24 +00:00
|
|
|
s->IndentLess();
|
|
|
|
|
s->IndentLess();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool lldb_private::operator==(const SymbolContext &lhs,
|
|
|
|
|
const SymbolContext &rhs) {
|
2011-01-27 06:44:37 +00:00
|
|
|
return lhs.function == rhs.function && lhs.symbol == rhs.symbol &&
|
|
|
|
|
lhs.module_sp.get() == rhs.module_sp.get() &&
|
|
|
|
|
lhs.comp_unit == rhs.comp_unit &&
|
|
|
|
|
lhs.target_sp.get() == rhs.target_sp.get() &&
|
2015-01-15 02:59:20 +00:00
|
|
|
LineEntry::Compare(lhs.line_entry, rhs.line_entry) == 0 &&
|
|
|
|
|
lhs.variable == rhs.variable;
|
2010-06-08 16:52:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool lldb_private::operator!=(const SymbolContext &lhs,
|
|
|
|
|
const SymbolContext &rhs) {
|
2018-12-29 04:57:00 +00:00
|
|
|
return !(lhs == rhs);
|
2010-06-08 16:52:24 +00:00
|
|
|
}
|
|
|
|
|
|
2011-04-23 02:04:55 +00:00
|
|
|
bool SymbolContext::GetAddressRange(uint32_t scope, uint32_t range_idx,
|
|
|
|
|
bool use_inline_block_range,
|
|
|
|
|
AddressRange &range) const {
|
2010-06-08 16:52:24 +00:00
|
|
|
if ((scope & eSymbolContextLineEntry) && line_entry.IsValid()) {
|
|
|
|
|
range = line_entry.range;
|
|
|
|
|
return true;
|
2016-09-06 20:57:50 +00:00
|
|
|
}
|
|
|
|
|
|
2014-04-20 13:17:36 +00:00
|
|
|
if ((scope & eSymbolContextBlock) && (block != nullptr)) {
|
2011-04-23 02:04:55 +00:00
|
|
|
if (use_inline_block_range) {
|
|
|
|
|
Block *inline_block = block->GetContainingInlinedBlock();
|
|
|
|
|
if (inline_block)
|
|
|
|
|
return inline_block->GetRangeAtIndex(range_idx, range);
|
2016-09-06 20:57:50 +00:00
|
|
|
} else {
|
2011-04-23 02:04:55 +00:00
|
|
|
return block->GetRangeAtIndex(range_idx, range);
|
2016-09-06 20:57:50 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2014-04-20 13:17:36 +00:00
|
|
|
if ((scope & eSymbolContextFunction) && (function != nullptr)) {
|
2011-04-23 02:04:55 +00:00
|
|
|
if (range_idx == 0) {
|
|
|
|
|
range = function->GetAddressRange();
|
2010-06-08 16:52:24 +00:00
|
|
|
return true;
|
2016-09-06 20:57:50 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2014-04-20 13:17:36 +00:00
|
|
|
if ((scope & eSymbolContextSymbol) && (symbol != nullptr)) {
|
2011-04-23 02:04:55 +00:00
|
|
|
if (range_idx == 0) {
|
2012-03-07 21:03:09 +00:00
|
|
|
if (symbol->ValueIsAddress()) {
|
2015-06-25 21:46:34 +00:00
|
|
|
range.GetBaseAddress() = symbol->GetAddressRef();
|
2012-03-07 21:03:09 +00:00
|
|
|
range.SetByteSize(symbol->GetByteSize());
|
2010-06-08 16:52:24 +00:00
|
|
|
return true;
|
2016-09-06 20:57:50 +00:00
|
|
|
}
|
2010-06-08 16:52:24 +00:00
|
|
|
}
|
2011-04-23 02:04:55 +00:00
|
|
|
}
|
|
|
|
|
range.Clear();
|
2010-06-08 16:52:24 +00:00
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2015-12-16 19:40:00 +00:00
|
|
|
LanguageType SymbolContext::GetLanguage() const {
|
|
|
|
|
LanguageType lang;
|
|
|
|
|
if (function && (lang = function->GetLanguage()) != eLanguageTypeUnknown) {
|
|
|
|
|
return lang;
|
|
|
|
|
} else if (variable &&
|
|
|
|
|
(lang = variable->GetLanguage()) != eLanguageTypeUnknown) {
|
|
|
|
|
return lang;
|
|
|
|
|
} else if (symbol && (lang = symbol->GetLanguage()) != eLanguageTypeUnknown) {
|
|
|
|
|
return lang;
|
|
|
|
|
} else if (comp_unit &&
|
|
|
|
|
(lang = comp_unit->GetLanguage()) != eLanguageTypeUnknown) {
|
|
|
|
|
return lang;
|
|
|
|
|
} else if (symbol) {
|
|
|
|
|
// If all else fails, try to guess the language from the name.
|
|
|
|
|
return symbol->GetMangled().GuessLanguage();
|
|
|
|
|
}
|
|
|
|
|
return eLanguageTypeUnknown;
|
|
|
|
|
}
|
|
|
|
|
|
2011-10-01 00:45:15 +00:00
|
|
|
bool SymbolContext::GetParentOfInlinedScope(const Address &curr_frame_pc,
|
|
|
|
|
SymbolContext &next_frame_sc,
|
|
|
|
|
Address &next_frame_pc) const {
|
2013-02-23 04:12:47 +00:00
|
|
|
next_frame_sc.Clear(false);
|
2011-10-01 00:45:15 +00:00
|
|
|
next_frame_pc.Clear();
|
2016-09-06 20:57:50 +00:00
|
|
|
|
2011-09-26 07:11:27 +00:00
|
|
|
if (block) {
|
|
|
|
|
// const addr_t curr_frame_file_addr = curr_frame_pc.GetFileAddress();
|
2016-09-06 20:57:50 +00:00
|
|
|
|
2018-04-30 16:49:04 +00:00
|
|
|
// In order to get the parent of an inlined function we first need to see
|
|
|
|
|
// if we are in an inlined block as "this->block" could be an inlined
|
|
|
|
|
// block, or a parent of "block" could be. So lets check if this block or
|
|
|
|
|
// one of this blocks parents is an inlined function.
|
2011-10-01 00:45:15 +00:00
|
|
|
Block *curr_inlined_block = block->GetContainingInlinedBlock();
|
|
|
|
|
if (curr_inlined_block) {
|
2018-04-30 16:49:04 +00:00
|
|
|
// "this->block" is contained in an inline function block, so to get the
|
|
|
|
|
// scope above the inlined block, we get the parent of the inlined block
|
|
|
|
|
// itself
|
2011-10-01 00:45:15 +00:00
|
|
|
Block *next_frame_block = curr_inlined_block->GetParent();
|
|
|
|
|
// Now calculate the symbol context of the containing block
|
|
|
|
|
next_frame_block->CalculateSymbolContext(&next_frame_sc);
|
2016-09-06 20:57:50 +00:00
|
|
|
|
2011-10-01 00:45:15 +00:00
|
|
|
// If we get here we weren't able to find the return line entry using the
|
2018-04-30 16:49:04 +00:00
|
|
|
// nesting of the blocks and the line table. So just use the call site
|
|
|
|
|
// info from our inlined block.
|
2016-09-06 20:57:50 +00:00
|
|
|
|
2011-09-26 07:11:27 +00:00
|
|
|
AddressRange range;
|
2011-10-06 23:32:32 +00:00
|
|
|
if (curr_inlined_block->GetRangeContainingAddress(curr_frame_pc, range)) {
|
2018-04-30 16:49:04 +00:00
|
|
|
// To see there this new frame block it, we need to look at the call
|
|
|
|
|
// site information from
|
2011-10-06 23:32:32 +00:00
|
|
|
const InlineFunctionInfo *curr_inlined_block_inlined_info =
|
|
|
|
|
curr_inlined_block->GetInlinedFunctionInfo();
|
|
|
|
|
next_frame_pc = range.GetBaseAddress();
|
|
|
|
|
next_frame_sc.line_entry.range.GetBaseAddress() = next_frame_pc;
|
|
|
|
|
next_frame_sc.line_entry.file =
|
2016-05-11 22:46:53 +00:00
|
|
|
curr_inlined_block_inlined_info->GetCallSite().GetFile();
|
|
|
|
|
next_frame_sc.line_entry.original_file =
|
2011-10-06 23:32:32 +00:00
|
|
|
curr_inlined_block_inlined_info->GetCallSite().GetFile();
|
|
|
|
|
next_frame_sc.line_entry.line =
|
|
|
|
|
curr_inlined_block_inlined_info->GetCallSite().GetLine();
|
|
|
|
|
next_frame_sc.line_entry.column =
|
|
|
|
|
curr_inlined_block_inlined_info->GetCallSite().GetColumn();
|
|
|
|
|
return true;
|
|
|
|
|
} else {
|
2013-03-27 23:08:40 +00:00
|
|
|
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_SYMBOLS));
|
2016-09-06 20:57:50 +00:00
|
|
|
|
2011-10-06 23:32:32 +00:00
|
|
|
if (log) {
|
2019-07-24 17:56:10 +00:00
|
|
|
LLDB_LOGF(
|
|
|
|
|
log,
|
2012-11-29 21:49:15 +00:00
|
|
|
"warning: inlined block 0x%8.8" PRIx64
|
|
|
|
|
" doesn't have a range that contains file address 0x%" PRIx64,
|
2011-10-06 23:32:32 +00:00
|
|
|
curr_inlined_block->GetID(), curr_frame_pc.GetFileAddress());
|
|
|
|
|
}
|
|
|
|
|
#ifdef LLDB_CONFIGURATION_DEBUG
|
|
|
|
|
else {
|
[lldb] NFC modernize codebase with modernize-use-nullptr
Summary:
NFC = [[ https://llvm.org/docs/Lexicon.html#nfc | Non functional change ]]
This commit is the result of modernizing the LLDB codebase by using
`nullptr` instread of `0` or `NULL`. See
https://clang.llvm.org/extra/clang-tidy/checks/modernize-use-nullptr.html
for more information.
This is the command I ran and I to fix and format the code base:
```
run-clang-tidy.py \
-header-filter='.*' \
-checks='-*,modernize-use-nullptr' \
-fix ~/dev/llvm-project/lldb/.* \
-format \
-style LLVM \
-p ~/llvm-builds/debug-ninja-gcc
```
NOTE: There were also changes to `llvm/utils/unittest` but I did not
include them because I felt that maybe this library shall be updated in
isolation somehow.
NOTE: I know this is a rather large commit but it is a nobrainer in most
parts.
Reviewers: martong, espindola, shafik, #lldb, JDevlieghere
Reviewed By: JDevlieghere
Subscribers: arsenm, jvesely, nhaehnle, hiraditya, JDevlieghere, teemperor, rnkovacs, emaste, kubamracek, nemanjai, ki.stfu, javed.absar, arichardson, kbarton, jrtc27, MaskRay, atanasyan, dexonsmith, arphaman, jfb, jsji, jdoerfert, lldb-commits, llvm-commits
Tags: #lldb, #llvm
Differential Revision: https://reviews.llvm.org/D61847
llvm-svn: 361484
2019-05-23 11:14:47 +00:00
|
|
|
ObjectFile *objfile = nullptr;
|
2011-10-07 01:49:45 +00:00
|
|
|
if (module_sp) {
|
2019-08-08 11:49:55 +00:00
|
|
|
if (SymbolFile *symbol_file = module_sp->GetSymbolFile())
|
|
|
|
|
objfile = symbol_file->GetObjectFile();
|
2016-09-06 20:57:50 +00:00
|
|
|
}
|
2011-10-07 01:49:45 +00:00
|
|
|
if (objfile) {
|
2012-01-05 03:57:59 +00:00
|
|
|
Host::SystemLog(
|
|
|
|
|
Host::eSystemLogWarning,
|
2013-04-29 17:25:54 +00:00
|
|
|
"warning: inlined block 0x%8.8" PRIx64
|
|
|
|
|
" doesn't have a range that contains file address 0x%" PRIx64
|
|
|
|
|
" in %s\n",
|
2016-05-11 22:46:53 +00:00
|
|
|
curr_inlined_block->GetID(), curr_frame_pc.GetFileAddress(),
|
Add a first pass at a "stop hook" mechanism. This allows you to add commands that get run every time the debugger stops, whether due to a breakpoint, the end of a step, interrupt, etc. You can also specify in which context you want the stop hook to run, for instance only on a particular thread, or only in a particular shared library, function, file, line range within a file.
Still need to add "in methods of a class" to the specifiers, and the ability to write the stop hooks in the Scripting language as well as in the Command Language.
llvm-svn: 127457
2011-03-11 03:53:59 +00:00
|
|
|
objfile->GetFileSpec().GetPath().c_str());
|
2016-09-06 20:57:50 +00:00
|
|
|
} else {
|
2012-01-05 03:57:59 +00:00
|
|
|
Host::SystemLog(
|
|
|
|
|
Host::eSystemLogWarning,
|
2013-04-29 17:25:54 +00:00
|
|
|
"warning: inlined block 0x%8.8" PRIx64
|
|
|
|
|
" doesn't have a range that contains file address 0x%" PRIx64
|
2016-09-06 20:57:50 +00:00
|
|
|
"\n",
|
2016-05-11 22:46:53 +00:00
|
|
|
curr_inlined_block->GetID(), curr_frame_pc.GetFileAddress());
|
2016-09-06 20:57:50 +00:00
|
|
|
}
|
2011-09-26 07:11:27 +00:00
|
|
|
}
|
2016-09-06 20:57:50 +00:00
|
|
|
#endif
|
|
|
|
|
}
|
2011-09-26 07:11:27 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2012-07-14 00:53:55 +00:00
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Block *SymbolContext::GetFunctionBlock() {
|
|
|
|
|
if (function) {
|
2014-04-20 13:17:36 +00:00
|
|
|
if (block) {
|
2018-04-30 16:49:04 +00:00
|
|
|
// If this symbol context has a block, check to see if this block is
|
|
|
|
|
// itself, or is contained within a block with inlined function
|
|
|
|
|
// information. If so, then the inlined block is the block that defines
|
|
|
|
|
// the function.
|
2012-07-14 00:53:55 +00:00
|
|
|
Block *inlined_block = block->GetContainingInlinedBlock();
|
|
|
|
|
if (inlined_block)
|
|
|
|
|
return inlined_block;
|
2016-09-06 20:57:50 +00:00
|
|
|
|
2018-04-30 16:49:04 +00:00
|
|
|
// The block in this symbol context is not inside an inlined block, so
|
|
|
|
|
// the block that defines the function is the function's top level block,
|
|
|
|
|
// which is returned below.
|
2016-09-06 20:57:50 +00:00
|
|
|
}
|
|
|
|
|
|
2018-04-30 16:49:04 +00:00
|
|
|
// There is no block information in this symbol context, so we must assume
|
|
|
|
|
// that the block that is desired is the top level block of the function
|
|
|
|
|
// itself.
|
2012-07-14 00:53:55 +00:00
|
|
|
return &function->GetBlock(true);
|
2016-09-06 20:57:50 +00:00
|
|
|
}
|
2014-04-20 13:17:36 +00:00
|
|
|
return nullptr;
|
2016-09-06 20:57:50 +00:00
|
|
|
}
|
2012-07-14 00:53:55 +00:00
|
|
|
|
Removed all of the "#ifndef SWIG" from the SB header files since we are using
interface (.i) files for each class.
Changed the FindFunction class from:
uint32_t
SBTarget::FindFunctions (const char *name,
uint32_t name_type_mask,
bool append,
lldb::SBSymbolContextList& sc_list)
uint32_t
SBModule::FindFunctions (const char *name,
uint32_t name_type_mask,
bool append,
lldb::SBSymbolContextList& sc_list)
To:
lldb::SBSymbolContextList
SBTarget::FindFunctions (const char *name,
uint32_t name_type_mask = lldb::eFunctionNameTypeAny);
lldb::SBSymbolContextList
SBModule::FindFunctions (const char *name,
uint32_t name_type_mask = lldb::eFunctionNameTypeAny);
This makes the API easier to use from python. Also added the ability to
append a SBSymbolContext or a SBSymbolContextList to a SBSymbolContextList.
Exposed properties for lldb.SBSymbolContextList in python:
lldb.SBSymbolContextList.modules => list() or all lldb.SBModule objects in the list
lldb.SBSymbolContextList.compile_units => list() or all lldb.SBCompileUnits objects in the list
lldb.SBSymbolContextList.functions => list() or all lldb.SBFunction objects in the list
lldb.SBSymbolContextList.blocks => list() or all lldb.SBBlock objects in the list
lldb.SBSymbolContextList.line_entries => list() or all lldb.SBLineEntry objects in the list
lldb.SBSymbolContextList.symbols => list() or all lldb.SBSymbol objects in the list
This allows a call to the SBTarget::FindFunctions(...) and SBModule::FindFunctions(...)
and then the result can be used to extract the desired information:
sc_list = lldb.target.FindFunctions("erase")
for function in sc_list.functions:
print function
for symbol in sc_list.symbols:
print symbol
Exposed properties for the lldb.SBSymbolContext objects in python:
lldb.SBSymbolContext.module => lldb.SBModule
lldb.SBSymbolContext.compile_unit => lldb.SBCompileUnit
lldb.SBSymbolContext.function => lldb.SBFunction
lldb.SBSymbolContext.block => lldb.SBBlock
lldb.SBSymbolContext.line_entry => lldb.SBLineEntry
lldb.SBSymbolContext.symbol => lldb.SBSymbol
Exposed properties for the lldb.SBBlock objects in python:
lldb.SBBlock.parent => lldb.SBBlock for the parent block that contains
lldb.SBBlock.sibling => lldb.SBBlock for the sibling block to the current block
lldb.SBBlock.first_child => lldb.SBBlock for the first child block to the current block
lldb.SBBlock.call_site => for inline functions, return a lldb.declaration object that gives the call site file, line and column
lldb.SBBlock.name => for inline functions this is the name of the inline function that this block represents
lldb.SBBlock.inlined_block => returns the inlined function block that contains this block (might return itself if the current block is an inlined block)
lldb.SBBlock.range[int] => access the address ranges for a block by index, a list() with start and end address is returned
lldb.SBBlock.ranges => an array or all address ranges for this block
lldb.SBBlock.num_ranges => the number of address ranges for this blcok
SBFunction objects can now get the SBType and the SBBlock that represents the
top scope of the function.
SBBlock objects can now get the variable list from the current block. The value
list returned allows varaibles to be viewed prior with no process if code
wants to check the variables in a function. There are two ways to get a variable
list from a SBBlock:
lldb::SBValueList
SBBlock::GetVariables (lldb::SBFrame& frame,
bool arguments,
bool locals,
bool statics,
lldb::DynamicValueType use_dynamic);
lldb::SBValueList
SBBlock::GetVariables (lldb::SBTarget& target,
bool arguments,
bool locals,
bool statics);
When a SBFrame is used, the values returned will be locked down to the frame
and the values will be evaluated in the context of that frame.
When a SBTarget is used, global an static variables can be viewed without a
running process.
llvm-svn: 149853
2012-02-06 01:44:54 +00:00
|
|
|
bool SymbolContext::GetFunctionMethodInfo(lldb::LanguageType &language,
|
2015-08-24 23:46:31 +00:00
|
|
|
bool &is_instance_method,
|
|
|
|
|
ConstString &language_object_name)
|
2012-07-14 00:53:55 +00:00
|
|
|
|
|
|
|
|
{
|
2015-08-24 23:46:31 +00:00
|
|
|
Block *function_block = GetFunctionBlock();
|
2012-07-14 00:53:55 +00:00
|
|
|
if (function_block) {
|
2015-08-24 23:46:31 +00:00
|
|
|
CompilerDeclContext decl_ctx = function_block->GetDeclContext();
|
|
|
|
|
if (decl_ctx)
|
|
|
|
|
return decl_ctx.IsClassMethod(&language, &is_instance_method,
|
|
|
|
|
&language_object_name);
|
2012-07-14 00:53:55 +00:00
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2015-11-19 23:10:45 +00:00
|
|
|
void SymbolContext::SortTypeList(TypeMap &type_map, TypeList &type_list) const {
|
2015-10-08 09:45:41 +00:00
|
|
|
Block *curr_block = block;
|
|
|
|
|
bool isInlinedblock = false;
|
|
|
|
|
if (curr_block != nullptr &&
|
|
|
|
|
curr_block->GetContainingInlinedBlock() != nullptr)
|
2015-11-19 23:10:45 +00:00
|
|
|
isInlinedblock = true;
|
2016-09-06 20:57:50 +00:00
|
|
|
|
2018-04-30 16:49:04 +00:00
|
|
|
// Find all types that match the current block if we have one and put them
|
|
|
|
|
// first in the list. Keep iterating up through all blocks.
|
2015-11-19 23:10:45 +00:00
|
|
|
while (curr_block != nullptr && !isInlinedblock) {
|
|
|
|
|
type_map.ForEach(
|
|
|
|
|
[curr_block, &type_list](const lldb::TypeSP &type_sp) -> bool {
|
|
|
|
|
SymbolContextScope *scs = type_sp->GetSymbolContextScope();
|
|
|
|
|
if (scs && curr_block == scs->CalculateSymbolContextBlock())
|
|
|
|
|
type_list.Insert(type_sp);
|
|
|
|
|
return true; // Keep iterating
|
|
|
|
|
});
|
2016-09-06 20:57:50 +00:00
|
|
|
|
2018-04-30 16:49:04 +00:00
|
|
|
// Remove any entries that are now in "type_list" from "type_map" since we
|
|
|
|
|
// can't remove from type_map while iterating
|
2015-11-19 23:10:45 +00:00
|
|
|
type_list.ForEach([&type_map](const lldb::TypeSP &type_sp) -> bool {
|
|
|
|
|
type_map.Remove(type_sp);
|
|
|
|
|
return true; // Keep iterating
|
2016-09-06 20:57:50 +00:00
|
|
|
});
|
2015-10-08 09:45:41 +00:00
|
|
|
curr_block = curr_block->GetParent();
|
|
|
|
|
}
|
2018-04-30 16:49:04 +00:00
|
|
|
// Find all types that match the current function, if we have onem, and put
|
|
|
|
|
// them next in the list.
|
2015-11-19 23:10:45 +00:00
|
|
|
if (function != nullptr && !type_map.Empty()) {
|
|
|
|
|
const size_t old_type_list_size = type_list.GetSize();
|
|
|
|
|
type_map.ForEach([this, &type_list](const lldb::TypeSP &type_sp) -> bool {
|
|
|
|
|
SymbolContextScope *scs = type_sp->GetSymbolContextScope();
|
|
|
|
|
if (scs && function == scs->CalculateSymbolContextFunction())
|
|
|
|
|
type_list.Insert(type_sp);
|
|
|
|
|
return true; // Keep iterating
|
2016-09-06 20:57:50 +00:00
|
|
|
});
|
|
|
|
|
|
2018-04-30 16:49:04 +00:00
|
|
|
// Remove any entries that are now in "type_list" from "type_map" since we
|
|
|
|
|
// can't remove from type_map while iterating
|
2015-11-19 23:10:45 +00:00
|
|
|
const size_t new_type_list_size = type_list.GetSize();
|
|
|
|
|
if (new_type_list_size > old_type_list_size) {
|
|
|
|
|
for (size_t i = old_type_list_size; i < new_type_list_size; ++i)
|
|
|
|
|
type_map.Remove(type_list.GetTypeAtIndex(i));
|
2016-09-06 20:57:50 +00:00
|
|
|
}
|
|
|
|
|
}
|
2018-04-30 16:49:04 +00:00
|
|
|
// Find all types that match the current compile unit, if we have one, and
|
|
|
|
|
// put them next in the list.
|
2015-11-19 23:10:45 +00:00
|
|
|
if (comp_unit != nullptr && !type_map.Empty()) {
|
|
|
|
|
const size_t old_type_list_size = type_list.GetSize();
|
2016-09-06 20:57:50 +00:00
|
|
|
|
2015-11-19 23:10:45 +00:00
|
|
|
type_map.ForEach([this, &type_list](const lldb::TypeSP &type_sp) -> bool {
|
|
|
|
|
SymbolContextScope *scs = type_sp->GetSymbolContextScope();
|
|
|
|
|
if (scs && comp_unit == scs->CalculateSymbolContextCompileUnit())
|
|
|
|
|
type_list.Insert(type_sp);
|
|
|
|
|
return true; // Keep iterating
|
2016-09-06 20:57:50 +00:00
|
|
|
});
|
|
|
|
|
|
2018-04-30 16:49:04 +00:00
|
|
|
// Remove any entries that are now in "type_list" from "type_map" since we
|
|
|
|
|
// can't remove from type_map while iterating
|
2015-11-19 23:10:45 +00:00
|
|
|
const size_t new_type_list_size = type_list.GetSize();
|
|
|
|
|
if (new_type_list_size > old_type_list_size) {
|
|
|
|
|
for (size_t i = old_type_list_size; i < new_type_list_size; ++i)
|
|
|
|
|
type_map.Remove(type_list.GetTypeAtIndex(i));
|
2016-09-06 20:57:50 +00:00
|
|
|
}
|
|
|
|
|
}
|
2018-04-30 16:49:04 +00:00
|
|
|
// Find all types that match the current module, if we have one, and put them
|
|
|
|
|
// next in the list.
|
2015-11-19 23:10:45 +00:00
|
|
|
if (module_sp && !type_map.Empty()) {
|
|
|
|
|
const size_t old_type_list_size = type_list.GetSize();
|
|
|
|
|
type_map.ForEach([this, &type_list](const lldb::TypeSP &type_sp) -> bool {
|
|
|
|
|
SymbolContextScope *scs = type_sp->GetSymbolContextScope();
|
|
|
|
|
if (scs && module_sp == scs->CalculateSymbolContextModule())
|
|
|
|
|
type_list.Insert(type_sp);
|
|
|
|
|
return true; // Keep iterating
|
2016-09-06 20:57:50 +00:00
|
|
|
});
|
2018-04-30 16:49:04 +00:00
|
|
|
// Remove any entries that are now in "type_list" from "type_map" since we
|
|
|
|
|
// can't remove from type_map while iterating
|
2015-11-19 23:10:45 +00:00
|
|
|
const size_t new_type_list_size = type_list.GetSize();
|
|
|
|
|
if (new_type_list_size > old_type_list_size) {
|
|
|
|
|
for (size_t i = old_type_list_size; i < new_type_list_size; ++i)
|
|
|
|
|
type_map.Remove(type_list.GetTypeAtIndex(i));
|
2016-09-06 20:57:50 +00:00
|
|
|
}
|
|
|
|
|
}
|
2015-11-19 23:10:45 +00:00
|
|
|
// Any types that are left get copied into the list an any order.
|
|
|
|
|
if (!type_map.Empty()) {
|
|
|
|
|
type_map.ForEach([&type_list](const lldb::TypeSP &type_sp) -> bool {
|
|
|
|
|
type_list.Insert(type_sp);
|
|
|
|
|
return true; // Keep iterating
|
2016-09-06 20:57:50 +00:00
|
|
|
});
|
|
|
|
|
}
|
2015-10-08 09:45:41 +00:00
|
|
|
}
|
|
|
|
|
|
2012-07-14 00:53:55 +00:00
|
|
|
ConstString
|
2013-05-17 00:56:10 +00:00
|
|
|
SymbolContext::GetFunctionName(Mangled::NamePreference preference) const {
|
2011-09-27 19:48:20 +00:00
|
|
|
if (function) {
|
|
|
|
|
if (block) {
|
2011-09-27 23:59:35 +00:00
|
|
|
Block *inlined_block = block->GetContainingInlinedBlock();
|
2016-09-06 20:57:50 +00:00
|
|
|
|
2011-09-27 23:59:35 +00:00
|
|
|
if (inlined_block) {
|
|
|
|
|
const InlineFunctionInfo *inline_info =
|
|
|
|
|
inlined_block->GetInlinedFunctionInfo();
|
|
|
|
|
if (inline_info)
|
2020-01-30 21:55:18 -08:00
|
|
|
return inline_info->GetName();
|
2011-09-27 19:48:20 +00:00
|
|
|
}
|
2016-09-06 20:57:50 +00:00
|
|
|
}
|
2020-01-30 21:55:18 -08:00
|
|
|
return function->GetMangled().GetName(preference);
|
2012-03-07 21:03:09 +00:00
|
|
|
} else if (symbol && symbol->ValueIsAddress()) {
|
2020-01-30 21:55:18 -08:00
|
|
|
return symbol->GetMangled().GetName(preference);
|
2011-09-27 19:48:20 +00:00
|
|
|
} else {
|
|
|
|
|
// No function, return an empty string.
|
|
|
|
|
return ConstString();
|
|
|
|
|
}
|
|
|
|
|
}
|
2011-09-26 07:11:27 +00:00
|
|
|
|
2013-05-17 00:56:10 +00:00
|
|
|
LineEntry SymbolContext::GetFunctionStartLineEntry() const {
|
|
|
|
|
LineEntry line_entry;
|
|
|
|
|
Address start_addr;
|
|
|
|
|
if (block) {
|
|
|
|
|
Block *inlined_block = block->GetContainingInlinedBlock();
|
|
|
|
|
if (inlined_block) {
|
|
|
|
|
if (inlined_block->GetStartAddress(start_addr)) {
|
|
|
|
|
if (start_addr.CalculateSymbolContextLineEntry(line_entry))
|
|
|
|
|
return line_entry;
|
|
|
|
|
}
|
|
|
|
|
return LineEntry();
|
2016-09-06 20:57:50 +00:00
|
|
|
}
|
2013-05-17 00:56:10 +00:00
|
|
|
}
|
2016-09-06 20:57:50 +00:00
|
|
|
|
2013-05-17 00:56:10 +00:00
|
|
|
if (function) {
|
|
|
|
|
if (function->GetAddressRange()
|
|
|
|
|
.GetBaseAddress()
|
|
|
|
|
.CalculateSymbolContextLineEntry(line_entry))
|
|
|
|
|
return line_entry;
|
|
|
|
|
}
|
|
|
|
|
return LineEntry();
|
|
|
|
|
}
|
|
|
|
|
|
2016-02-13 00:31:47 +00:00
|
|
|
bool SymbolContext::GetAddressRangeFromHereToEndLine(uint32_t end_line,
|
|
|
|
|
AddressRange &range,
|
2017-05-12 04:51:55 +00:00
|
|
|
Status &error) {
|
2016-02-13 00:31:47 +00:00
|
|
|
if (!line_entry.IsValid()) {
|
|
|
|
|
error.SetErrorString("Symbol context has no line table.");
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
range = line_entry.range;
|
|
|
|
|
if (line_entry.line > end_line) {
|
|
|
|
|
error.SetErrorStringWithFormat(
|
|
|
|
|
"end line option %d must be after the current line: %d", end_line,
|
|
|
|
|
line_entry.line);
|
|
|
|
|
return false;
|
2016-09-06 20:57:50 +00:00
|
|
|
}
|
|
|
|
|
|
2016-02-13 00:31:47 +00:00
|
|
|
uint32_t line_index = 0;
|
|
|
|
|
bool found = false;
|
2019-05-24 00:44:33 +00:00
|
|
|
while (true) {
|
2016-02-13 00:31:47 +00:00
|
|
|
LineEntry this_line;
|
|
|
|
|
line_index = comp_unit->FindLineEntry(line_index, line_entry.line, nullptr,
|
|
|
|
|
false, &this_line);
|
|
|
|
|
if (line_index == UINT32_MAX)
|
2016-09-06 20:57:50 +00:00
|
|
|
break;
|
2016-02-13 00:31:47 +00:00
|
|
|
if (LineEntry::Compare(this_line, line_entry) == 0) {
|
|
|
|
|
found = true;
|
2016-09-06 20:57:50 +00:00
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2016-02-13 00:31:47 +00:00
|
|
|
LineEntry end_entry;
|
|
|
|
|
if (!found) {
|
|
|
|
|
// Can't find the index of the SymbolContext's line entry in the
|
|
|
|
|
// SymbolContext's CompUnit.
|
|
|
|
|
error.SetErrorString(
|
|
|
|
|
"Can't find the current line entry in the CompUnit - can't process "
|
|
|
|
|
"the end-line option");
|
|
|
|
|
return false;
|
2016-09-06 20:57:50 +00:00
|
|
|
}
|
|
|
|
|
|
2016-02-13 00:31:47 +00:00
|
|
|
line_index = comp_unit->FindLineEntry(line_index, end_line, nullptr, false,
|
2016-09-06 20:57:50 +00:00
|
|
|
&end_entry);
|
2016-02-13 00:31:47 +00:00
|
|
|
if (line_index == UINT32_MAX) {
|
|
|
|
|
error.SetErrorStringWithFormat(
|
|
|
|
|
"could not find a line table entry corresponding "
|
|
|
|
|
"to end line number %d",
|
|
|
|
|
end_line);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
2016-09-06 20:57:50 +00:00
|
|
|
|
2016-02-13 00:31:47 +00:00
|
|
|
Block *func_block = GetFunctionBlock();
|
2019-09-04 22:38:20 +00:00
|
|
|
if (func_block && func_block->GetRangeIndexContainingAddress(
|
|
|
|
|
end_entry.range.GetBaseAddress()) == UINT32_MAX) {
|
2016-02-13 00:31:47 +00:00
|
|
|
error.SetErrorStringWithFormat(
|
|
|
|
|
"end line number %d is not contained within the current function.",
|
|
|
|
|
end_line);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
lldb::addr_t range_size = end_entry.range.GetBaseAddress().GetFileAddress() -
|
|
|
|
|
range.GetBaseAddress().GetFileAddress();
|
|
|
|
|
range.SetByteSize(range_size);
|
2015-11-19 23:10:45 +00:00
|
|
|
return true;
|
2016-09-06 20:57:50 +00:00
|
|
|
}
|
2016-02-13 00:31:47 +00:00
|
|
|
|
2019-09-04 22:38:20 +00:00
|
|
|
const Symbol *SymbolContext::FindBestGlobalDataSymbol(ConstString name,
|
|
|
|
|
Status &error) {
|
2017-05-16 23:46:13 +00:00
|
|
|
error.Clear();
|
2019-01-08 01:35:00 +00:00
|
|
|
|
2017-05-16 23:46:13 +00:00
|
|
|
if (!target_sp) {
|
|
|
|
|
return nullptr;
|
|
|
|
|
}
|
2019-01-08 01:35:00 +00:00
|
|
|
|
2017-05-16 23:46:13 +00:00
|
|
|
Target &target = *target_sp;
|
|
|
|
|
Module *module = module_sp.get();
|
2019-01-08 01:35:00 +00:00
|
|
|
|
2019-09-04 22:38:20 +00:00
|
|
|
auto ProcessMatches = [this, &name, &target,
|
|
|
|
|
module](SymbolContextList &sc_list,
|
|
|
|
|
Status &error) -> const Symbol * {
|
2017-05-16 23:46:13 +00:00
|
|
|
llvm::SmallVector<const Symbol *, 1> external_symbols;
|
|
|
|
|
llvm::SmallVector<const Symbol *, 1> internal_symbols;
|
|
|
|
|
const uint32_t matches = sc_list.GetSize();
|
|
|
|
|
for (uint32_t i = 0; i < matches; ++i) {
|
|
|
|
|
SymbolContext sym_ctx;
|
|
|
|
|
sc_list.GetContextAtIndex(i, sym_ctx);
|
|
|
|
|
if (sym_ctx.symbol) {
|
|
|
|
|
const Symbol *symbol = sym_ctx.symbol;
|
|
|
|
|
const Address sym_address = symbol->GetAddress();
|
2019-01-08 01:35:00 +00:00
|
|
|
|
2017-05-16 23:46:13 +00:00
|
|
|
if (sym_address.IsValid()) {
|
|
|
|
|
switch (symbol->GetType()) {
|
2019-09-04 22:38:20 +00:00
|
|
|
case eSymbolTypeData:
|
|
|
|
|
case eSymbolTypeRuntime:
|
|
|
|
|
case eSymbolTypeAbsolute:
|
|
|
|
|
case eSymbolTypeObjCClass:
|
|
|
|
|
case eSymbolTypeObjCMetaClass:
|
|
|
|
|
case eSymbolTypeObjCIVar:
|
|
|
|
|
if (symbol->GetDemangledNameIsSynthesized()) {
|
|
|
|
|
// If the demangled name was synthesized, then don't use it for
|
|
|
|
|
// expressions. Only let the symbol match if the mangled named
|
|
|
|
|
// matches for these symbols.
|
|
|
|
|
if (symbol->GetMangled().GetMangledName() != name)
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
if (symbol->IsExternal()) {
|
|
|
|
|
external_symbols.push_back(symbol);
|
|
|
|
|
} else {
|
|
|
|
|
internal_symbols.push_back(symbol);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case eSymbolTypeReExported: {
|
|
|
|
|
ConstString reexport_name = symbol->GetReExportedSymbolName();
|
|
|
|
|
if (reexport_name) {
|
|
|
|
|
ModuleSP reexport_module_sp;
|
|
|
|
|
ModuleSpec reexport_module_spec;
|
|
|
|
|
reexport_module_spec.GetPlatformFileSpec() =
|
|
|
|
|
symbol->GetReExportedSymbolSharedLibrary();
|
|
|
|
|
if (reexport_module_spec.GetPlatformFileSpec()) {
|
|
|
|
|
reexport_module_sp =
|
2017-05-16 23:46:13 +00:00
|
|
|
target.GetImages().FindFirstModule(reexport_module_spec);
|
2019-09-04 22:38:20 +00:00
|
|
|
if (!reexport_module_sp) {
|
|
|
|
|
reexport_module_spec.GetPlatformFileSpec()
|
|
|
|
|
.GetDirectory()
|
|
|
|
|
.Clear();
|
|
|
|
|
reexport_module_sp =
|
|
|
|
|
target.GetImages().FindFirstModule(reexport_module_spec);
|
2017-05-16 23:46:13 +00:00
|
|
|
}
|
|
|
|
|
}
|
2019-09-04 22:38:20 +00:00
|
|
|
// Don't allow us to try and resolve a re-exported symbol if it
|
|
|
|
|
// is the same as the current symbol
|
|
|
|
|
if (name == symbol->GetReExportedSymbolName() &&
|
|
|
|
|
module == reexport_module_sp.get())
|
|
|
|
|
return nullptr;
|
|
|
|
|
|
|
|
|
|
return FindBestGlobalDataSymbol(symbol->GetReExportedSymbolName(),
|
|
|
|
|
error);
|
|
|
|
|
}
|
|
|
|
|
} break;
|
|
|
|
|
|
|
|
|
|
case eSymbolTypeCode: // We already lookup functions elsewhere
|
|
|
|
|
case eSymbolTypeVariable:
|
|
|
|
|
case eSymbolTypeLocal:
|
|
|
|
|
case eSymbolTypeParam:
|
|
|
|
|
case eSymbolTypeTrampoline:
|
|
|
|
|
case eSymbolTypeInvalid:
|
|
|
|
|
case eSymbolTypeException:
|
|
|
|
|
case eSymbolTypeSourceFile:
|
|
|
|
|
case eSymbolTypeHeaderFile:
|
|
|
|
|
case eSymbolTypeObjectFile:
|
|
|
|
|
case eSymbolTypeCommonBlock:
|
|
|
|
|
case eSymbolTypeBlock:
|
|
|
|
|
case eSymbolTypeVariableType:
|
|
|
|
|
case eSymbolTypeLineEntry:
|
|
|
|
|
case eSymbolTypeLineHeader:
|
|
|
|
|
case eSymbolTypeScopeBegin:
|
|
|
|
|
case eSymbolTypeScopeEnd:
|
|
|
|
|
case eSymbolTypeAdditional:
|
|
|
|
|
case eSymbolTypeCompiler:
|
|
|
|
|
case eSymbolTypeInstrumentation:
|
|
|
|
|
case eSymbolTypeUndefined:
|
|
|
|
|
case eSymbolTypeResolver:
|
|
|
|
|
break;
|
2017-05-16 23:46:13 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2019-01-08 01:35:00 +00:00
|
|
|
|
2017-05-16 23:46:13 +00:00
|
|
|
if (external_symbols.size() > 1) {
|
|
|
|
|
StreamString ss;
|
|
|
|
|
ss.Printf("Multiple external symbols found for '%s'\n", name.AsCString());
|
|
|
|
|
for (const Symbol *symbol : external_symbols) {
|
|
|
|
|
symbol->GetDescription(&ss, eDescriptionLevelFull, &target);
|
|
|
|
|
}
|
|
|
|
|
ss.PutChar('\n');
|
|
|
|
|
error.SetErrorString(ss.GetData());
|
|
|
|
|
return nullptr;
|
|
|
|
|
} else if (external_symbols.size()) {
|
|
|
|
|
return external_symbols[0];
|
|
|
|
|
} else if (internal_symbols.size() > 1) {
|
|
|
|
|
StreamString ss;
|
|
|
|
|
ss.Printf("Multiple internal symbols found for '%s'\n", name.AsCString());
|
|
|
|
|
for (const Symbol *symbol : internal_symbols) {
|
|
|
|
|
symbol->GetDescription(&ss, eDescriptionLevelVerbose, &target);
|
|
|
|
|
ss.PutChar('\n');
|
|
|
|
|
}
|
|
|
|
|
error.SetErrorString(ss.GetData());
|
|
|
|
|
return nullptr;
|
|
|
|
|
} else if (internal_symbols.size()) {
|
|
|
|
|
return internal_symbols[0];
|
|
|
|
|
} else {
|
|
|
|
|
return nullptr;
|
|
|
|
|
}
|
|
|
|
|
};
|
2019-01-08 01:35:00 +00:00
|
|
|
|
2017-05-16 23:46:13 +00:00
|
|
|
if (module) {
|
|
|
|
|
SymbolContextList sc_list;
|
|
|
|
|
module->FindSymbolsWithNameAndType(name, eSymbolTypeAny, sc_list);
|
|
|
|
|
const Symbol *const module_symbol = ProcessMatches(sc_list, error);
|
2019-01-08 01:35:00 +00:00
|
|
|
|
2017-05-16 23:46:13 +00:00
|
|
|
if (!error.Success()) {
|
|
|
|
|
return nullptr;
|
|
|
|
|
} else if (module_symbol) {
|
|
|
|
|
return module_symbol;
|
|
|
|
|
}
|
|
|
|
|
}
|
2019-01-08 01:35:00 +00:00
|
|
|
|
2017-05-16 23:46:13 +00:00
|
|
|
{
|
|
|
|
|
SymbolContextList sc_list;
|
|
|
|
|
target.GetImages().FindSymbolsWithNameAndType(name, eSymbolTypeAny,
|
|
|
|
|
sc_list);
|
|
|
|
|
const Symbol *const target_symbol = ProcessMatches(sc_list, error);
|
2019-01-08 01:35:00 +00:00
|
|
|
|
2017-05-16 23:46:13 +00:00
|
|
|
if (!error.Success()) {
|
|
|
|
|
return nullptr;
|
|
|
|
|
} else if (target_symbol) {
|
|
|
|
|
return target_symbol;
|
|
|
|
|
}
|
|
|
|
|
}
|
2019-01-08 01:35:00 +00:00
|
|
|
|
2017-05-16 23:46:13 +00:00
|
|
|
return nullptr; // no error; we just didn't find anything
|
|
|
|
|
}
|
|
|
|
|
|
Add a first pass at a "stop hook" mechanism. This allows you to add commands that get run every time the debugger stops, whether due to a breakpoint, the end of a step, interrupt, etc. You can also specify in which context you want the stop hook to run, for instance only on a particular thread, or only in a particular shared library, function, file, line range within a file.
Still need to add "in methods of a class" to the specifiers, and the ability to write the stop hooks in the Scripting language as well as in the Command Language.
llvm-svn: 127457
2011-03-11 03:53:59 +00:00
|
|
|
//
|
|
|
|
|
// SymbolContextSpecifier
|
|
|
|
|
//
|
|
|
|
|
|
2011-09-17 06:21:20 +00:00
|
|
|
SymbolContextSpecifier::SymbolContextSpecifier(const TargetSP &target_sp)
|
2019-02-13 06:25:41 +00:00
|
|
|
: m_target_sp(target_sp), m_module_spec(), m_module_sp(), m_file_spec_up(),
|
2011-09-17 06:21:20 +00:00
|
|
|
m_start_line(0), m_end_line(0), m_function_spec(), m_class_name(),
|
2019-02-13 06:25:41 +00:00
|
|
|
m_address_range_up(), m_type(eNothingSpecified) {}
|
2016-09-06 20:57:50 +00:00
|
|
|
|
2011-09-17 06:21:20 +00:00
|
|
|
SymbolContextSpecifier::~SymbolContextSpecifier() {}
|
2016-09-06 20:57:50 +00:00
|
|
|
|
2011-09-17 06:21:20 +00:00
|
|
|
bool SymbolContextSpecifier::AddLineSpecification(uint32_t line_no,
|
Add a first pass at a "stop hook" mechanism. This allows you to add commands that get run every time the debugger stops, whether due to a breakpoint, the end of a step, interrupt, etc. You can also specify in which context you want the stop hook to run, for instance only on a particular thread, or only in a particular shared library, function, file, line range within a file.
Still need to add "in methods of a class" to the specifiers, and the ability to write the stop hooks in the Scripting language as well as in the Command Language.
llvm-svn: 127457
2011-03-11 03:53:59 +00:00
|
|
|
SpecificationType type) {
|
|
|
|
|
bool return_value = true;
|
2011-09-17 06:21:20 +00:00
|
|
|
switch (type) {
|
Add a first pass at a "stop hook" mechanism. This allows you to add commands that get run every time the debugger stops, whether due to a breakpoint, the end of a step, interrupt, etc. You can also specify in which context you want the stop hook to run, for instance only on a particular thread, or only in a particular shared library, function, file, line range within a file.
Still need to add "in methods of a class" to the specifiers, and the ability to write the stop hooks in the Scripting language as well as in the Command Language.
llvm-svn: 127457
2011-03-11 03:53:59 +00:00
|
|
|
case eNothingSpecified:
|
2011-09-17 06:21:20 +00:00
|
|
|
Clear();
|
2016-09-06 20:57:50 +00:00
|
|
|
break;
|
Add a first pass at a "stop hook" mechanism. This allows you to add commands that get run every time the debugger stops, whether due to a breakpoint, the end of a step, interrupt, etc. You can also specify in which context you want the stop hook to run, for instance only on a particular thread, or only in a particular shared library, function, file, line range within a file.
Still need to add "in methods of a class" to the specifiers, and the ability to write the stop hooks in the Scripting language as well as in the Command Language.
llvm-svn: 127457
2011-03-11 03:53:59 +00:00
|
|
|
case eLineStartSpecified:
|
|
|
|
|
m_start_line = line_no;
|
2011-09-17 06:21:20 +00:00
|
|
|
m_type |= eLineStartSpecified;
|
2016-09-06 20:57:50 +00:00
|
|
|
break;
|
Add a first pass at a "stop hook" mechanism. This allows you to add commands that get run every time the debugger stops, whether due to a breakpoint, the end of a step, interrupt, etc. You can also specify in which context you want the stop hook to run, for instance only on a particular thread, or only in a particular shared library, function, file, line range within a file.
Still need to add "in methods of a class" to the specifiers, and the ability to write the stop hooks in the Scripting language as well as in the Command Language.
llvm-svn: 127457
2011-03-11 03:53:59 +00:00
|
|
|
case eLineEndSpecified:
|
|
|
|
|
m_end_line = line_no;
|
|
|
|
|
m_type |= eLineEndSpecified;
|
2016-09-06 20:57:50 +00:00
|
|
|
break;
|
|
|
|
|
default:
|
Add a first pass at a "stop hook" mechanism. This allows you to add commands that get run every time the debugger stops, whether due to a breakpoint, the end of a step, interrupt, etc. You can also specify in which context you want the stop hook to run, for instance only on a particular thread, or only in a particular shared library, function, file, line range within a file.
Still need to add "in methods of a class" to the specifiers, and the ability to write the stop hooks in the Scripting language as well as in the Command Language.
llvm-svn: 127457
2011-03-11 03:53:59 +00:00
|
|
|
return_value = false;
|
2016-09-06 20:57:50 +00:00
|
|
|
break;
|
|
|
|
|
}
|
Add a first pass at a "stop hook" mechanism. This allows you to add commands that get run every time the debugger stops, whether due to a breakpoint, the end of a step, interrupt, etc. You can also specify in which context you want the stop hook to run, for instance only on a particular thread, or only in a particular shared library, function, file, line range within a file.
Still need to add "in methods of a class" to the specifiers, and the ability to write the stop hooks in the Scripting language as well as in the Command Language.
llvm-svn: 127457
2011-03-11 03:53:59 +00:00
|
|
|
return return_value;
|
2011-09-17 06:21:20 +00:00
|
|
|
}
|
|
|
|
|
|
Add a first pass at a "stop hook" mechanism. This allows you to add commands that get run every time the debugger stops, whether due to a breakpoint, the end of a step, interrupt, etc. You can also specify in which context you want the stop hook to run, for instance only on a particular thread, or only in a particular shared library, function, file, line range within a file.
Still need to add "in methods of a class" to the specifiers, and the ability to write the stop hooks in the Scripting language as well as in the Command Language.
llvm-svn: 127457
2011-03-11 03:53:59 +00:00
|
|
|
bool SymbolContextSpecifier::AddSpecification(const char *spec_string,
|
|
|
|
|
SpecificationType type) {
|
|
|
|
|
bool return_value = true;
|
|
|
|
|
switch (type) {
|
|
|
|
|
case eNothingSpecified:
|
|
|
|
|
Clear();
|
2016-09-06 20:57:50 +00:00
|
|
|
break;
|
Add a first pass at a "stop hook" mechanism. This allows you to add commands that get run every time the debugger stops, whether due to a breakpoint, the end of a step, interrupt, etc. You can also specify in which context you want the stop hook to run, for instance only on a particular thread, or only in a particular shared library, function, file, line range within a file.
Still need to add "in methods of a class" to the specifiers, and the ability to write the stop hooks in the Scripting language as well as in the Command Language.
llvm-svn: 127457
2011-03-11 03:53:59 +00:00
|
|
|
case eModuleSpecified: {
|
Many improvements to the Platform base class and subclasses. The base Platform
class now implements the Host functionality for a lot of things that make
sense by default so that subclasses can check:
int
PlatformSubclass::Foo ()
{
if (IsHost())
return Platform::Foo (); // Let the platform base class do the host specific stuff
// Platform subclass specific code...
int result = ...
return result;
}
Added new functions to the platform:
virtual const char *Platform::GetUserName (uint32_t uid);
virtual const char *Platform::GetGroupName (uint32_t gid);
The user and group names are cached locally so that remote platforms can avoid
sending packets multiple times to resolve this information.
Added the parent process ID to the ProcessInfo class.
Added a new ProcessInfoMatch class which helps us to match processes up
and changed the Host layer over to using this new class. The new class allows
us to search for processs:
1 - by name (equal to, starts with, ends with, contains, and regex)
2 - by pid
3 - And further check for parent pid == value, uid == value, gid == value,
euid == value, egid == value, arch == value, parent == value.
This is all hookup up to the "platform process list" command which required
adding dumping routines to dump process information. If the Host class
implements the process lookup routines, you can now lists processes on
your local machine:
machine1.foo.com % lldb
(lldb) platform process list
PID PARENT USER GROUP EFF USER EFF GROUP TRIPLE NAME
====== ====== ========== ========== ========== ========== ======================== ============================
99538 1 username usergroup username usergroup x86_64-apple-darwin FileMerge
94943 1 username usergroup username usergroup x86_64-apple-darwin mdworker
94852 244 username usergroup username usergroup x86_64-apple-darwin Safari
94727 244 username usergroup username usergroup x86_64-apple-darwin Xcode
92742 92710 username usergroup username usergroup i386-apple-darwin debugserver
This of course also works remotely with the lldb-platform:
machine1.foo.com % lldb-platform --listen 1234
machine2.foo.com % lldb
(lldb) platform create remote-macosx
Platform: remote-macosx
Connected: no
(lldb) platform connect connect://localhost:1444
Platform: remote-macosx
Triple: x86_64-apple-darwin
OS Version: 10.6.7 (10J869)
Kernel: Darwin Kernel Version 10.7.0: Sat Jan 29 15:17:16 PST 2011; root:xnu-1504.9.37~1/RELEASE_I386
Hostname: machine1.foo.com
Connected: yes
(lldb) platform process list
PID PARENT USER GROUP EFF USER EFF GROUP TRIPLE NAME
====== ====== ========== ========== ========== ========== ======================== ============================
99556 244 username usergroup username usergroup x86_64-apple-darwin trustevaluation
99548 65539 username usergroup username usergroup x86_64-apple-darwin lldb
99538 1 username usergroup username usergroup x86_64-apple-darwin FileMerge
94943 1 username usergroup username usergroup x86_64-apple-darwin mdworker
94852 244 username usergroup username usergroup x86_64-apple-darwin Safari
The lldb-platform implements everything with the Host:: layer, so this should
"just work" for linux. I will probably be adding more stuff to the Host layer
for launching processes and attaching to processes so that this support should
eventually just work as well.
Modified the target to be able to be created with an architecture that differs
from the main executable. This is needed for iOS debugging since we can have
an "armv6" binary which can run on an "armv7" machine, so we want to be able
to do:
% lldb
(lldb) platform create remote-ios
(lldb) file --arch armv7 a.out
Where "a.out" is an armv6 executable. The platform then can correctly decide
to open all "armv7" images for all dependent shared libraries.
Modified the disassembly to show the current PC value. Example output:
(lldb) disassemble --frame
a.out`main:
0x1eb7: pushl %ebp
0x1eb8: movl %esp, %ebp
0x1eba: pushl %ebx
0x1ebb: subl $20, %esp
0x1ebe: calll 0x1ec3 ; main + 12 at test.c:18
0x1ec3: popl %ebx
-> 0x1ec4: calll 0x1f12 ; getpid
0x1ec9: movl %eax, 4(%esp)
0x1ecd: leal 199(%ebx), %eax
0x1ed3: movl %eax, (%esp)
0x1ed6: calll 0x1f18 ; printf
0x1edb: leal 213(%ebx), %eax
0x1ee1: movl %eax, (%esp)
0x1ee4: calll 0x1f1e ; puts
0x1ee9: calll 0x1f0c ; getchar
0x1eee: movl $20, (%esp)
0x1ef5: calll 0x1e6a ; sleep_loop at test.c:6
0x1efa: movl $12, %eax
0x1eff: addl $20, %esp
0x1f02: popl %ebx
0x1f03: leave
0x1f04: ret
This can be handy when dealing with the new --line options that was recently
added:
(lldb) disassemble --line
a.out`main + 13 at test.c:19
18 {
-> 19 printf("Process: %i\n\n", getpid());
20 puts("Press any key to continue..."); getchar();
-> 0x1ec4: calll 0x1f12 ; getpid
0x1ec9: movl %eax, 4(%esp)
0x1ecd: leal 199(%ebx), %eax
0x1ed3: movl %eax, (%esp)
0x1ed6: calll 0x1f18 ; printf
Modified the ModuleList to have a lookup based solely on a UUID. Since the
UUID is typically the MD5 checksum of a binary image, there is no need
to give the path and architecture when searching for a pre-existing
image in an image list.
Now that we support remote debugging a bit better, our lldb_private::Module
needs to be able to track what the original path for file was as the platform
knows it, as well as where the file is locally. The module has the two
following functions to retrieve both paths:
const FileSpec &Module::GetFileSpec () const;
const FileSpec &Module::GetPlatformFileSpec () const;
llvm-svn: 128563
2011-03-30 18:16:51 +00:00
|
|
|
// See if we can find the Module, if so stick it in the SymbolContext.
|
2018-11-01 21:05:36 +00:00
|
|
|
FileSpec module_file_spec(spec_string);
|
2012-02-26 05:51:37 +00:00
|
|
|
ModuleSpec module_spec(module_file_spec);
|
|
|
|
|
lldb::ModuleSP module_sp(
|
|
|
|
|
m_target_sp->GetImages().FindFirstModule(module_spec));
|
Add a first pass at a "stop hook" mechanism. This allows you to add commands that get run every time the debugger stops, whether due to a breakpoint, the end of a step, interrupt, etc. You can also specify in which context you want the stop hook to run, for instance only on a particular thread, or only in a particular shared library, function, file, line range within a file.
Still need to add "in methods of a class" to the specifiers, and the ability to write the stop hooks in the Scripting language as well as in the Command Language.
llvm-svn: 127457
2011-03-11 03:53:59 +00:00
|
|
|
m_type |= eModuleSpecified;
|
|
|
|
|
if (module_sp)
|
|
|
|
|
m_module_sp = module_sp;
|
2016-09-06 20:57:50 +00:00
|
|
|
else
|
Add a first pass at a "stop hook" mechanism. This allows you to add commands that get run every time the debugger stops, whether due to a breakpoint, the end of a step, interrupt, etc. You can also specify in which context you want the stop hook to run, for instance only on a particular thread, or only in a particular shared library, function, file, line range within a file.
Still need to add "in methods of a class" to the specifiers, and the ability to write the stop hooks in the Scripting language as well as in the Command Language.
llvm-svn: 127457
2011-03-11 03:53:59 +00:00
|
|
|
m_module_spec.assign(spec_string);
|
|
|
|
|
} break;
|
|
|
|
|
case eFileSpecified:
|
|
|
|
|
// CompUnits can't necessarily be resolved here, since an inlined function
|
2018-04-30 16:49:04 +00:00
|
|
|
// might show up in a number of CompUnits. Instead we just convert to a
|
|
|
|
|
// FileSpec and store it away.
|
2020-06-24 17:44:33 -07:00
|
|
|
m_file_spec_up = std::make_unique<FileSpec>(spec_string);
|
Add a first pass at a "stop hook" mechanism. This allows you to add commands that get run every time the debugger stops, whether due to a breakpoint, the end of a step, interrupt, etc. You can also specify in which context you want the stop hook to run, for instance only on a particular thread, or only in a particular shared library, function, file, line range within a file.
Still need to add "in methods of a class" to the specifiers, and the ability to write the stop hooks in the Scripting language as well as in the Command Language.
llvm-svn: 127457
2011-03-11 03:53:59 +00:00
|
|
|
m_type |= eFileSpecified;
|
2016-09-06 20:57:50 +00:00
|
|
|
break;
|
Add a first pass at a "stop hook" mechanism. This allows you to add commands that get run every time the debugger stops, whether due to a breakpoint, the end of a step, interrupt, etc. You can also specify in which context you want the stop hook to run, for instance only on a particular thread, or only in a particular shared library, function, file, line range within a file.
Still need to add "in methods of a class" to the specifiers, and the ability to write the stop hooks in the Scripting language as well as in the Command Language.
llvm-svn: 127457
2011-03-11 03:53:59 +00:00
|
|
|
case eLineStartSpecified:
|
|
|
|
|
m_start_line = StringConvert::ToSInt32(spec_string, 0, 0, &return_value);
|
|
|
|
|
if (return_value)
|
|
|
|
|
m_type |= eLineStartSpecified;
|
|
|
|
|
break;
|
|
|
|
|
case eLineEndSpecified:
|
|
|
|
|
m_end_line = StringConvert::ToSInt32(spec_string, 0, 0, &return_value);
|
|
|
|
|
if (return_value)
|
|
|
|
|
m_type |= eLineEndSpecified;
|
|
|
|
|
break;
|
|
|
|
|
case eFunctionSpecified:
|
|
|
|
|
m_function_spec.assign(spec_string);
|
|
|
|
|
m_type |= eFunctionSpecified;
|
|
|
|
|
break;
|
|
|
|
|
case eClassOrNamespaceSpecified:
|
2016-09-06 20:57:50 +00:00
|
|
|
Clear();
|
Add a first pass at a "stop hook" mechanism. This allows you to add commands that get run every time the debugger stops, whether due to a breakpoint, the end of a step, interrupt, etc. You can also specify in which context you want the stop hook to run, for instance only on a particular thread, or only in a particular shared library, function, file, line range within a file.
Still need to add "in methods of a class" to the specifiers, and the ability to write the stop hooks in the Scripting language as well as in the Command Language.
llvm-svn: 127457
2011-03-11 03:53:59 +00:00
|
|
|
m_class_name.assign(spec_string);
|
|
|
|
|
m_type = eClassOrNamespaceSpecified;
|
|
|
|
|
break;
|
|
|
|
|
case eAddressRangeSpecified:
|
|
|
|
|
// Not specified yet...
|
2016-09-06 20:57:50 +00:00
|
|
|
break;
|
Add a first pass at a "stop hook" mechanism. This allows you to add commands that get run every time the debugger stops, whether due to a breakpoint, the end of a step, interrupt, etc. You can also specify in which context you want the stop hook to run, for instance only on a particular thread, or only in a particular shared library, function, file, line range within a file.
Still need to add "in methods of a class" to the specifiers, and the ability to write the stop hooks in the Scripting language as well as in the Command Language.
llvm-svn: 127457
2011-03-11 03:53:59 +00:00
|
|
|
}
|
2016-09-06 20:57:50 +00:00
|
|
|
|
Add a first pass at a "stop hook" mechanism. This allows you to add commands that get run every time the debugger stops, whether due to a breakpoint, the end of a step, interrupt, etc. You can also specify in which context you want the stop hook to run, for instance only on a particular thread, or only in a particular shared library, function, file, line range within a file.
Still need to add "in methods of a class" to the specifiers, and the ability to write the stop hooks in the Scripting language as well as in the Command Language.
llvm-svn: 127457
2011-03-11 03:53:59 +00:00
|
|
|
return return_value;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void SymbolContextSpecifier::Clear() {
|
2012-02-26 05:51:37 +00:00
|
|
|
m_module_spec.clear();
|
2019-02-13 06:25:41 +00:00
|
|
|
m_file_spec_up.reset();
|
Add a first pass at a "stop hook" mechanism. This allows you to add commands that get run every time the debugger stops, whether due to a breakpoint, the end of a step, interrupt, etc. You can also specify in which context you want the stop hook to run, for instance only on a particular thread, or only in a particular shared library, function, file, line range within a file.
Still need to add "in methods of a class" to the specifiers, and the ability to write the stop hooks in the Scripting language as well as in the Command Language.
llvm-svn: 127457
2011-03-11 03:53:59 +00:00
|
|
|
m_function_spec.clear();
|
|
|
|
|
m_class_name.clear();
|
2015-01-15 20:08:35 +00:00
|
|
|
m_start_line = 0;
|
|
|
|
|
m_end_line = 0;
|
2019-02-13 06:25:41 +00:00
|
|
|
m_address_range_up.reset();
|
Add a first pass at a "stop hook" mechanism. This allows you to add commands that get run every time the debugger stops, whether due to a breakpoint, the end of a step, interrupt, etc. You can also specify in which context you want the stop hook to run, for instance only on a particular thread, or only in a particular shared library, function, file, line range within a file.
Still need to add "in methods of a class" to the specifiers, and the ability to write the stop hooks in the Scripting language as well as in the Command Language.
llvm-svn: 127457
2011-03-11 03:53:59 +00:00
|
|
|
|
|
|
|
|
m_type = eNothingSpecified;
|
|
|
|
|
}
|
|
|
|
|
|
2020-09-28 10:28:29 -07:00
|
|
|
bool SymbolContextSpecifier::SymbolContextMatches(const SymbolContext &sc) {
|
Add a first pass at a "stop hook" mechanism. This allows you to add commands that get run every time the debugger stops, whether due to a breakpoint, the end of a step, interrupt, etc. You can also specify in which context you want the stop hook to run, for instance only on a particular thread, or only in a particular shared library, function, file, line range within a file.
Still need to add "in methods of a class" to the specifiers, and the ability to write the stop hooks in the Scripting language as well as in the Command Language.
llvm-svn: 127457
2011-03-11 03:53:59 +00:00
|
|
|
if (m_type == eNothingSpecified)
|
|
|
|
|
return true;
|
2016-09-06 20:57:50 +00:00
|
|
|
|
2020-09-28 10:28:29 -07:00
|
|
|
// Only compare targets if this specifier has one and it's not the Dummy
|
|
|
|
|
// target. Otherwise if a specifier gets made in the dummy target and
|
|
|
|
|
// copied over we'll artificially fail the comparision.
|
|
|
|
|
if (m_target_sp && !m_target_sp->IsDummyTarget() &&
|
|
|
|
|
m_target_sp != sc.target_sp)
|
2016-02-13 00:31:47 +00:00
|
|
|
return false;
|
2016-09-06 20:57:50 +00:00
|
|
|
|
Add a first pass at a "stop hook" mechanism. This allows you to add commands that get run every time the debugger stops, whether due to a breakpoint, the end of a step, interrupt, etc. You can also specify in which context you want the stop hook to run, for instance only on a particular thread, or only in a particular shared library, function, file, line range within a file.
Still need to add "in methods of a class" to the specifiers, and the ability to write the stop hooks in the Scripting language as well as in the Command Language.
llvm-svn: 127457
2011-03-11 03:53:59 +00:00
|
|
|
if (m_type & eModuleSpecified) {
|
|
|
|
|
if (sc.module_sp) {
|
2014-04-20 13:17:36 +00:00
|
|
|
if (m_module_sp.get() != nullptr) {
|
Add a first pass at a "stop hook" mechanism. This allows you to add commands that get run every time the debugger stops, whether due to a breakpoint, the end of a step, interrupt, etc. You can also specify in which context you want the stop hook to run, for instance only on a particular thread, or only in a particular shared library, function, file, line range within a file.
Still need to add "in methods of a class" to the specifiers, and the ability to write the stop hooks in the Scripting language as well as in the Command Language.
llvm-svn: 127457
2011-03-11 03:53:59 +00:00
|
|
|
if (m_module_sp.get() != sc.module_sp.get())
|
2016-02-13 00:31:47 +00:00
|
|
|
return false;
|
2016-09-06 20:57:50 +00:00
|
|
|
} else {
|
2018-11-01 21:05:36 +00:00
|
|
|
FileSpec module_file_spec(m_module_spec);
|
[lldb] s/FileSpec::Equal/FileSpec::Match
Summary:
The FileSpec class is often used as a sort of a pattern -- one specifies
a bare file name to search, and we check if in matches the full file
name of an existing module (for example).
These comparisons used FileSpec::Equal, which had some support for it
(via the full=false argument), but it was not a good fit for this job.
For one, it did a symmetric comparison, which makes sense for a function
called "equal", but not for typical searches (when searching for
"/foo/bar.so", we don't want to find a module whose name is just
"bar.so"). This resulted in patterns like:
if (FileSpec::Equal(pattern, file, pattern.GetDirectory()))
which would request a "full" match only if the pattern really contained
a directory. This worked, but the intended behavior was very unobvious.
On top of that, a lot of the code wanted to handle the case of an
"empty" pattern, and treat it as matching everything. This resulted in
conditions like:
if (pattern && !FileSpec::Equal(pattern, file, pattern.GetDirectory())
which are nearly impossible to decipher.
This patch introduces a FileSpec::Match function, which does exactly
what most of FileSpec::Equal callers want, an asymmetric match between a
"pattern" FileSpec and a an actual FileSpec. Empty paterns match
everything, filename-only patterns match only the filename component.
I've tried to update all callers of FileSpec::Equal to use a simpler
interface. Those that hardcoded full=true have been changed to use
operator==. Those passing full=pattern.GetDirectory() have been changed
to use FileSpec::Match.
There was also a handful of places which hardcoded full=false. I've
changed these to use FileSpec::Match too. This is a slight change in
semantics, but it does not look like that was ever intended, and it was
more likely a result of a misunderstanding of the "proper" way to use
FileSpec::Equal.
[In an ideal world a "FileSpec" and a "FileSpec pattern" would be two
different types, but given how widespread FileSpec is, it is unlikely
we'll get there in one go. This at least provides a good starting point
by centralizing all matching behavior.]
Reviewers: teemperor, JDevlieghere, jdoerfert
Subscribers: emaste, lldb-commits
Tags: #lldb
Differential Revision: https://reviews.llvm.org/D70851
2019-11-29 11:31:00 +01:00
|
|
|
if (!FileSpec::Match(module_file_spec, sc.module_sp->GetFileSpec()))
|
2016-02-13 00:31:47 +00:00
|
|
|
return false;
|
2016-09-06 20:57:50 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
Add a first pass at a "stop hook" mechanism. This allows you to add commands that get run every time the debugger stops, whether due to a breakpoint, the end of a step, interrupt, etc. You can also specify in which context you want the stop hook to run, for instance only on a particular thread, or only in a particular shared library, function, file, line range within a file.
Still need to add "in methods of a class" to the specifiers, and the ability to write the stop hooks in the Scripting language as well as in the Command Language.
llvm-svn: 127457
2011-03-11 03:53:59 +00:00
|
|
|
if (m_type & eFileSpecified) {
|
2019-02-13 06:25:41 +00:00
|
|
|
if (m_file_spec_up) {
|
Add a first pass at a "stop hook" mechanism. This allows you to add commands that get run every time the debugger stops, whether due to a breakpoint, the end of a step, interrupt, etc. You can also specify in which context you want the stop hook to run, for instance only on a particular thread, or only in a particular shared library, function, file, line range within a file.
Still need to add "in methods of a class" to the specifiers, and the ability to write the stop hooks in the Scripting language as well as in the Command Language.
llvm-svn: 127457
2011-03-11 03:53:59 +00:00
|
|
|
// If we don't have a block or a comp_unit, then we aren't going to match
|
|
|
|
|
// a source file.
|
2014-04-20 13:17:36 +00:00
|
|
|
if (sc.block == nullptr && sc.comp_unit == nullptr)
|
Add a first pass at a "stop hook" mechanism. This allows you to add commands that get run every time the debugger stops, whether due to a breakpoint, the end of a step, interrupt, etc. You can also specify in which context you want the stop hook to run, for instance only on a particular thread, or only in a particular shared library, function, file, line range within a file.
Still need to add "in methods of a class" to the specifiers, and the ability to write the stop hooks in the Scripting language as well as in the Command Language.
llvm-svn: 127457
2011-03-11 03:53:59 +00:00
|
|
|
return false;
|
2016-09-06 20:57:50 +00:00
|
|
|
|
Add a first pass at a "stop hook" mechanism. This allows you to add commands that get run every time the debugger stops, whether due to a breakpoint, the end of a step, interrupt, etc. You can also specify in which context you want the stop hook to run, for instance only on a particular thread, or only in a particular shared library, function, file, line range within a file.
Still need to add "in methods of a class" to the specifiers, and the ability to write the stop hooks in the Scripting language as well as in the Command Language.
llvm-svn: 127457
2011-03-11 03:53:59 +00:00
|
|
|
// Check if the block is present, and if so is it inlined:
|
|
|
|
|
bool was_inlined = false;
|
2014-04-20 13:17:36 +00:00
|
|
|
if (sc.block != nullptr) {
|
Add a first pass at a "stop hook" mechanism. This allows you to add commands that get run every time the debugger stops, whether due to a breakpoint, the end of a step, interrupt, etc. You can also specify in which context you want the stop hook to run, for instance only on a particular thread, or only in a particular shared library, function, file, line range within a file.
Still need to add "in methods of a class" to the specifiers, and the ability to write the stop hooks in the Scripting language as well as in the Command Language.
llvm-svn: 127457
2011-03-11 03:53:59 +00:00
|
|
|
const InlineFunctionInfo *inline_info =
|
|
|
|
|
sc.block->GetInlinedFunctionInfo();
|
2014-04-20 13:17:36 +00:00
|
|
|
if (inline_info != nullptr) {
|
Add a first pass at a "stop hook" mechanism. This allows you to add commands that get run every time the debugger stops, whether due to a breakpoint, the end of a step, interrupt, etc. You can also specify in which context you want the stop hook to run, for instance only on a particular thread, or only in a particular shared library, function, file, line range within a file.
Still need to add "in methods of a class" to the specifiers, and the ability to write the stop hooks in the Scripting language as well as in the Command Language.
llvm-svn: 127457
2011-03-11 03:53:59 +00:00
|
|
|
was_inlined = true;
|
[lldb] s/FileSpec::Equal/FileSpec::Match
Summary:
The FileSpec class is often used as a sort of a pattern -- one specifies
a bare file name to search, and we check if in matches the full file
name of an existing module (for example).
These comparisons used FileSpec::Equal, which had some support for it
(via the full=false argument), but it was not a good fit for this job.
For one, it did a symmetric comparison, which makes sense for a function
called "equal", but not for typical searches (when searching for
"/foo/bar.so", we don't want to find a module whose name is just
"bar.so"). This resulted in patterns like:
if (FileSpec::Equal(pattern, file, pattern.GetDirectory()))
which would request a "full" match only if the pattern really contained
a directory. This worked, but the intended behavior was very unobvious.
On top of that, a lot of the code wanted to handle the case of an
"empty" pattern, and treat it as matching everything. This resulted in
conditions like:
if (pattern && !FileSpec::Equal(pattern, file, pattern.GetDirectory())
which are nearly impossible to decipher.
This patch introduces a FileSpec::Match function, which does exactly
what most of FileSpec::Equal callers want, an asymmetric match between a
"pattern" FileSpec and a an actual FileSpec. Empty paterns match
everything, filename-only patterns match only the filename component.
I've tried to update all callers of FileSpec::Equal to use a simpler
interface. Those that hardcoded full=true have been changed to use
operator==. Those passing full=pattern.GetDirectory() have been changed
to use FileSpec::Match.
There was also a handful of places which hardcoded full=false. I've
changed these to use FileSpec::Match too. This is a slight change in
semantics, but it does not look like that was ever intended, and it was
more likely a result of a misunderstanding of the "proper" way to use
FileSpec::Equal.
[In an ideal world a "FileSpec" and a "FileSpec pattern" would be two
different types, but given how widespread FileSpec is, it is unlikely
we'll get there in one go. This at least provides a good starting point
by centralizing all matching behavior.]
Reviewers: teemperor, JDevlieghere, jdoerfert
Subscribers: emaste, lldb-commits
Tags: #lldb
Differential Revision: https://reviews.llvm.org/D70851
2019-11-29 11:31:00 +01:00
|
|
|
if (!FileSpec::Match(*m_file_spec_up,
|
|
|
|
|
inline_info->GetDeclaration().GetFile()))
|
Add a first pass at a "stop hook" mechanism. This allows you to add commands that get run every time the debugger stops, whether due to a breakpoint, the end of a step, interrupt, etc. You can also specify in which context you want the stop hook to run, for instance only on a particular thread, or only in a particular shared library, function, file, line range within a file.
Still need to add "in methods of a class" to the specifiers, and the ability to write the stop hooks in the Scripting language as well as in the Command Language.
llvm-svn: 127457
2011-03-11 03:53:59 +00:00
|
|
|
return false;
|
|
|
|
|
}
|
2016-09-06 20:57:50 +00:00
|
|
|
}
|
|
|
|
|
|
Add a first pass at a "stop hook" mechanism. This allows you to add commands that get run every time the debugger stops, whether due to a breakpoint, the end of a step, interrupt, etc. You can also specify in which context you want the stop hook to run, for instance only on a particular thread, or only in a particular shared library, function, file, line range within a file.
Still need to add "in methods of a class" to the specifiers, and the ability to write the stop hooks in the Scripting language as well as in the Command Language.
llvm-svn: 127457
2011-03-11 03:53:59 +00:00
|
|
|
// Next check the comp unit, but only if the SymbolContext was not
|
|
|
|
|
// inlined.
|
2014-04-20 13:17:36 +00:00
|
|
|
if (!was_inlined && sc.comp_unit != nullptr) {
|
[lldb] s/FileSpec::Equal/FileSpec::Match
Summary:
The FileSpec class is often used as a sort of a pattern -- one specifies
a bare file name to search, and we check if in matches the full file
name of an existing module (for example).
These comparisons used FileSpec::Equal, which had some support for it
(via the full=false argument), but it was not a good fit for this job.
For one, it did a symmetric comparison, which makes sense for a function
called "equal", but not for typical searches (when searching for
"/foo/bar.so", we don't want to find a module whose name is just
"bar.so"). This resulted in patterns like:
if (FileSpec::Equal(pattern, file, pattern.GetDirectory()))
which would request a "full" match only if the pattern really contained
a directory. This worked, but the intended behavior was very unobvious.
On top of that, a lot of the code wanted to handle the case of an
"empty" pattern, and treat it as matching everything. This resulted in
conditions like:
if (pattern && !FileSpec::Equal(pattern, file, pattern.GetDirectory())
which are nearly impossible to decipher.
This patch introduces a FileSpec::Match function, which does exactly
what most of FileSpec::Equal callers want, an asymmetric match between a
"pattern" FileSpec and a an actual FileSpec. Empty paterns match
everything, filename-only patterns match only the filename component.
I've tried to update all callers of FileSpec::Equal to use a simpler
interface. Those that hardcoded full=true have been changed to use
operator==. Those passing full=pattern.GetDirectory() have been changed
to use FileSpec::Match.
There was also a handful of places which hardcoded full=false. I've
changed these to use FileSpec::Match too. This is a slight change in
semantics, but it does not look like that was ever intended, and it was
more likely a result of a misunderstanding of the "proper" way to use
FileSpec::Equal.
[In an ideal world a "FileSpec" and a "FileSpec pattern" would be two
different types, but given how widespread FileSpec is, it is unlikely
we'll get there in one go. This at least provides a good starting point
by centralizing all matching behavior.]
Reviewers: teemperor, JDevlieghere, jdoerfert
Subscribers: emaste, lldb-commits
Tags: #lldb
Differential Revision: https://reviews.llvm.org/D70851
2019-11-29 11:31:00 +01:00
|
|
|
if (!FileSpec::Match(*m_file_spec_up, sc.comp_unit->GetPrimaryFile()))
|
2016-02-13 00:31:47 +00:00
|
|
|
return false;
|
2016-09-06 20:57:50 +00:00
|
|
|
}
|
|
|
|
|
}
|
Add a first pass at a "stop hook" mechanism. This allows you to add commands that get run every time the debugger stops, whether due to a breakpoint, the end of a step, interrupt, etc. You can also specify in which context you want the stop hook to run, for instance only on a particular thread, or only in a particular shared library, function, file, line range within a file.
Still need to add "in methods of a class" to the specifiers, and the ability to write the stop hooks in the Scripting language as well as in the Command Language.
llvm-svn: 127457
2011-03-11 03:53:59 +00:00
|
|
|
}
|
|
|
|
|
if (m_type & eLineStartSpecified || m_type & eLineEndSpecified) {
|
|
|
|
|
if (sc.line_entry.line < m_start_line || sc.line_entry.line > m_end_line)
|
2016-02-13 00:31:47 +00:00
|
|
|
return false;
|
2016-09-06 20:57:50 +00:00
|
|
|
}
|
|
|
|
|
|
Add a first pass at a "stop hook" mechanism. This allows you to add commands that get run every time the debugger stops, whether due to a breakpoint, the end of a step, interrupt, etc. You can also specify in which context you want the stop hook to run, for instance only on a particular thread, or only in a particular shared library, function, file, line range within a file.
Still need to add "in methods of a class" to the specifiers, and the ability to write the stop hooks in the Scripting language as well as in the Command Language.
llvm-svn: 127457
2011-03-11 03:53:59 +00:00
|
|
|
if (m_type & eFunctionSpecified) {
|
|
|
|
|
// First check the current block, and if it is inlined, get the inlined
|
|
|
|
|
// function name:
|
|
|
|
|
bool was_inlined = false;
|
|
|
|
|
ConstString func_name(m_function_spec.c_str());
|
2016-09-06 20:57:50 +00:00
|
|
|
|
2014-04-20 13:17:36 +00:00
|
|
|
if (sc.block != nullptr) {
|
Add a first pass at a "stop hook" mechanism. This allows you to add commands that get run every time the debugger stops, whether due to a breakpoint, the end of a step, interrupt, etc. You can also specify in which context you want the stop hook to run, for instance only on a particular thread, or only in a particular shared library, function, file, line range within a file.
Still need to add "in methods of a class" to the specifiers, and the ability to write the stop hooks in the Scripting language as well as in the Command Language.
llvm-svn: 127457
2011-03-11 03:53:59 +00:00
|
|
|
const InlineFunctionInfo *inline_info =
|
|
|
|
|
sc.block->GetInlinedFunctionInfo();
|
2014-04-20 13:17:36 +00:00
|
|
|
if (inline_info != nullptr) {
|
Add a first pass at a "stop hook" mechanism. This allows you to add commands that get run every time the debugger stops, whether due to a breakpoint, the end of a step, interrupt, etc. You can also specify in which context you want the stop hook to run, for instance only on a particular thread, or only in a particular shared library, function, file, line range within a file.
Still need to add "in methods of a class" to the specifiers, and the ability to write the stop hooks in the Scripting language as well as in the Command Language.
llvm-svn: 127457
2011-03-11 03:53:59 +00:00
|
|
|
was_inlined = true;
|
|
|
|
|
const Mangled &name = inline_info->GetMangled();
|
2020-01-30 21:55:18 -08:00
|
|
|
if (!name.NameMatches(func_name))
|
2016-02-13 00:31:47 +00:00
|
|
|
return false;
|
2016-09-06 20:57:50 +00:00
|
|
|
}
|
|
|
|
|
}
|
Add a first pass at a "stop hook" mechanism. This allows you to add commands that get run every time the debugger stops, whether due to a breakpoint, the end of a step, interrupt, etc. You can also specify in which context you want the stop hook to run, for instance only on a particular thread, or only in a particular shared library, function, file, line range within a file.
Still need to add "in methods of a class" to the specifiers, and the ability to write the stop hooks in the Scripting language as well as in the Command Language.
llvm-svn: 127457
2011-03-11 03:53:59 +00:00
|
|
|
// If it wasn't inlined, check the name in the function or symbol:
|
|
|
|
|
if (!was_inlined) {
|
2014-04-20 13:17:36 +00:00
|
|
|
if (sc.function != nullptr) {
|
2020-01-30 21:55:18 -08:00
|
|
|
if (!sc.function->GetMangled().NameMatches(func_name))
|
2016-02-13 00:31:47 +00:00
|
|
|
return false;
|
2014-04-20 13:17:36 +00:00
|
|
|
} else if (sc.symbol != nullptr) {
|
2020-01-30 21:55:18 -08:00
|
|
|
if (!sc.symbol->GetMangled().NameMatches(func_name))
|
Add a first pass at a "stop hook" mechanism. This allows you to add commands that get run every time the debugger stops, whether due to a breakpoint, the end of a step, interrupt, etc. You can also specify in which context you want the stop hook to run, for instance only on a particular thread, or only in a particular shared library, function, file, line range within a file.
Still need to add "in methods of a class" to the specifiers, and the ability to write the stop hooks in the Scripting language as well as in the Command Language.
llvm-svn: 127457
2011-03-11 03:53:59 +00:00
|
|
|
return false;
|
2016-09-06 20:57:50 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
Add a first pass at a "stop hook" mechanism. This allows you to add commands that get run every time the debugger stops, whether due to a breakpoint, the end of a step, interrupt, etc. You can also specify in which context you want the stop hook to run, for instance only on a particular thread, or only in a particular shared library, function, file, line range within a file.
Still need to add "in methods of a class" to the specifiers, and the ability to write the stop hooks in the Scripting language as well as in the Command Language.
llvm-svn: 127457
2011-03-11 03:53:59 +00:00
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool SymbolContextSpecifier::AddressMatches(lldb::addr_t addr) {
|
|
|
|
|
if (m_type & eAddressRangeSpecified) {
|
2016-09-06 20:57:50 +00:00
|
|
|
|
Add a first pass at a "stop hook" mechanism. This allows you to add commands that get run every time the debugger stops, whether due to a breakpoint, the end of a step, interrupt, etc. You can also specify in which context you want the stop hook to run, for instance only on a particular thread, or only in a particular shared library, function, file, line range within a file.
Still need to add "in methods of a class" to the specifiers, and the ability to write the stop hooks in the Scripting language as well as in the Command Language.
llvm-svn: 127457
2011-03-11 03:53:59 +00:00
|
|
|
} else {
|
2014-04-20 13:17:36 +00:00
|
|
|
Address match_address(addr, nullptr);
|
Add a first pass at a "stop hook" mechanism. This allows you to add commands that get run every time the debugger stops, whether due to a breakpoint, the end of a step, interrupt, etc. You can also specify in which context you want the stop hook to run, for instance only on a particular thread, or only in a particular shared library, function, file, line range within a file.
Still need to add "in methods of a class" to the specifiers, and the ability to write the stop hooks in the Scripting language as well as in the Command Language.
llvm-svn: 127457
2011-03-11 03:53:59 +00:00
|
|
|
SymbolContext sc;
|
|
|
|
|
m_target_sp->GetImages().ResolveSymbolContextForAddress(
|
|
|
|
|
match_address, eSymbolContextEverything, sc);
|
|
|
|
|
return SymbolContextMatches(sc);
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void SymbolContextSpecifier::GetDescription(
|
|
|
|
|
Stream *s, lldb::DescriptionLevel level) const {
|
|
|
|
|
char path_str[PATH_MAX + 1];
|
|
|
|
|
|
|
|
|
|
if (m_type == eNothingSpecified) {
|
|
|
|
|
s->Printf("Nothing specified.\n");
|
|
|
|
|
}
|
2016-09-06 20:57:50 +00:00
|
|
|
|
Add a first pass at a "stop hook" mechanism. This allows you to add commands that get run every time the debugger stops, whether due to a breakpoint, the end of a step, interrupt, etc. You can also specify in which context you want the stop hook to run, for instance only on a particular thread, or only in a particular shared library, function, file, line range within a file.
Still need to add "in methods of a class" to the specifiers, and the ability to write the stop hooks in the Scripting language as well as in the Command Language.
llvm-svn: 127457
2011-03-11 03:53:59 +00:00
|
|
|
if (m_type == eModuleSpecified) {
|
|
|
|
|
s->Indent();
|
|
|
|
|
if (m_module_sp) {
|
|
|
|
|
m_module_sp->GetFileSpec().GetPath(path_str, PATH_MAX);
|
|
|
|
|
s->Printf("Module: %s\n", path_str);
|
|
|
|
|
} else
|
|
|
|
|
s->Printf("Module: %s\n", m_module_spec.c_str());
|
|
|
|
|
}
|
2016-09-06 20:57:50 +00:00
|
|
|
|
2019-02-13 06:25:41 +00:00
|
|
|
if (m_type == eFileSpecified && m_file_spec_up != nullptr) {
|
|
|
|
|
m_file_spec_up->GetPath(path_str, PATH_MAX);
|
Add a first pass at a "stop hook" mechanism. This allows you to add commands that get run every time the debugger stops, whether due to a breakpoint, the end of a step, interrupt, etc. You can also specify in which context you want the stop hook to run, for instance only on a particular thread, or only in a particular shared library, function, file, line range within a file.
Still need to add "in methods of a class" to the specifiers, and the ability to write the stop hooks in the Scripting language as well as in the Command Language.
llvm-svn: 127457
2011-03-11 03:53:59 +00:00
|
|
|
s->Indent();
|
|
|
|
|
s->Printf("File: %s", path_str);
|
|
|
|
|
if (m_type == eLineStartSpecified) {
|
2014-03-03 19:15:20 +00:00
|
|
|
s->Printf(" from line %" PRIu64 "", (uint64_t)m_start_line);
|
Add a first pass at a "stop hook" mechanism. This allows you to add commands that get run every time the debugger stops, whether due to a breakpoint, the end of a step, interrupt, etc. You can also specify in which context you want the stop hook to run, for instance only on a particular thread, or only in a particular shared library, function, file, line range within a file.
Still need to add "in methods of a class" to the specifiers, and the ability to write the stop hooks in the Scripting language as well as in the Command Language.
llvm-svn: 127457
2011-03-11 03:53:59 +00:00
|
|
|
if (m_type == eLineEndSpecified)
|
2014-03-03 19:15:20 +00:00
|
|
|
s->Printf("to line %" PRIu64 "", (uint64_t)m_end_line);
|
Add a first pass at a "stop hook" mechanism. This allows you to add commands that get run every time the debugger stops, whether due to a breakpoint, the end of a step, interrupt, etc. You can also specify in which context you want the stop hook to run, for instance only on a particular thread, or only in a particular shared library, function, file, line range within a file.
Still need to add "in methods of a class" to the specifiers, and the ability to write the stop hooks in the Scripting language as well as in the Command Language.
llvm-svn: 127457
2011-03-11 03:53:59 +00:00
|
|
|
else
|
2011-09-20 21:44:10 +00:00
|
|
|
s->Printf("to end");
|
Add a first pass at a "stop hook" mechanism. This allows you to add commands that get run every time the debugger stops, whether due to a breakpoint, the end of a step, interrupt, etc. You can also specify in which context you want the stop hook to run, for instance only on a particular thread, or only in a particular shared library, function, file, line range within a file.
Still need to add "in methods of a class" to the specifiers, and the ability to write the stop hooks in the Scripting language as well as in the Command Language.
llvm-svn: 127457
2011-03-11 03:53:59 +00:00
|
|
|
} else if (m_type == eLineEndSpecified) {
|
2014-03-03 19:15:20 +00:00
|
|
|
s->Printf(" from start to line %" PRIu64 "", (uint64_t)m_end_line);
|
Add a first pass at a "stop hook" mechanism. This allows you to add commands that get run every time the debugger stops, whether due to a breakpoint, the end of a step, interrupt, etc. You can also specify in which context you want the stop hook to run, for instance only on a particular thread, or only in a particular shared library, function, file, line range within a file.
Still need to add "in methods of a class" to the specifiers, and the ability to write the stop hooks in the Scripting language as well as in the Command Language.
llvm-svn: 127457
2011-03-11 03:53:59 +00:00
|
|
|
}
|
|
|
|
|
s->Printf(".\n");
|
|
|
|
|
}
|
2016-09-06 20:57:50 +00:00
|
|
|
|
Add a first pass at a "stop hook" mechanism. This allows you to add commands that get run every time the debugger stops, whether due to a breakpoint, the end of a step, interrupt, etc. You can also specify in which context you want the stop hook to run, for instance only on a particular thread, or only in a particular shared library, function, file, line range within a file.
Still need to add "in methods of a class" to the specifiers, and the ability to write the stop hooks in the Scripting language as well as in the Command Language.
llvm-svn: 127457
2011-03-11 03:53:59 +00:00
|
|
|
if (m_type == eLineStartSpecified) {
|
|
|
|
|
s->Indent();
|
2014-03-03 19:15:20 +00:00
|
|
|
s->Printf("From line %" PRIu64 "", (uint64_t)m_start_line);
|
Add a first pass at a "stop hook" mechanism. This allows you to add commands that get run every time the debugger stops, whether due to a breakpoint, the end of a step, interrupt, etc. You can also specify in which context you want the stop hook to run, for instance only on a particular thread, or only in a particular shared library, function, file, line range within a file.
Still need to add "in methods of a class" to the specifiers, and the ability to write the stop hooks in the Scripting language as well as in the Command Language.
llvm-svn: 127457
2011-03-11 03:53:59 +00:00
|
|
|
if (m_type == eLineEndSpecified)
|
2014-03-03 19:15:20 +00:00
|
|
|
s->Printf("to line %" PRIu64 "", (uint64_t)m_end_line);
|
Add a first pass at a "stop hook" mechanism. This allows you to add commands that get run every time the debugger stops, whether due to a breakpoint, the end of a step, interrupt, etc. You can also specify in which context you want the stop hook to run, for instance only on a particular thread, or only in a particular shared library, function, file, line range within a file.
Still need to add "in methods of a class" to the specifiers, and the ability to write the stop hooks in the Scripting language as well as in the Command Language.
llvm-svn: 127457
2011-03-11 03:53:59 +00:00
|
|
|
else
|
2011-09-20 21:44:10 +00:00
|
|
|
s->Printf("to end");
|
Add a first pass at a "stop hook" mechanism. This allows you to add commands that get run every time the debugger stops, whether due to a breakpoint, the end of a step, interrupt, etc. You can also specify in which context you want the stop hook to run, for instance only on a particular thread, or only in a particular shared library, function, file, line range within a file.
Still need to add "in methods of a class" to the specifiers, and the ability to write the stop hooks in the Scripting language as well as in the Command Language.
llvm-svn: 127457
2011-03-11 03:53:59 +00:00
|
|
|
s->Printf(".\n");
|
|
|
|
|
} else if (m_type == eLineEndSpecified) {
|
2014-03-03 19:15:20 +00:00
|
|
|
s->Printf("From start to line %" PRIu64 ".\n", (uint64_t)m_end_line);
|
Add a first pass at a "stop hook" mechanism. This allows you to add commands that get run every time the debugger stops, whether due to a breakpoint, the end of a step, interrupt, etc. You can also specify in which context you want the stop hook to run, for instance only on a particular thread, or only in a particular shared library, function, file, line range within a file.
Still need to add "in methods of a class" to the specifiers, and the ability to write the stop hooks in the Scripting language as well as in the Command Language.
llvm-svn: 127457
2011-03-11 03:53:59 +00:00
|
|
|
}
|
2016-09-06 20:57:50 +00:00
|
|
|
|
Add a first pass at a "stop hook" mechanism. This allows you to add commands that get run every time the debugger stops, whether due to a breakpoint, the end of a step, interrupt, etc. You can also specify in which context you want the stop hook to run, for instance only on a particular thread, or only in a particular shared library, function, file, line range within a file.
Still need to add "in methods of a class" to the specifiers, and the ability to write the stop hooks in the Scripting language as well as in the Command Language.
llvm-svn: 127457
2011-03-11 03:53:59 +00:00
|
|
|
if (m_type == eFunctionSpecified) {
|
|
|
|
|
s->Indent();
|
|
|
|
|
s->Printf("Function: %s.\n", m_function_spec.c_str());
|
|
|
|
|
}
|
2016-09-06 20:57:50 +00:00
|
|
|
|
Add a first pass at a "stop hook" mechanism. This allows you to add commands that get run every time the debugger stops, whether due to a breakpoint, the end of a step, interrupt, etc. You can also specify in which context you want the stop hook to run, for instance only on a particular thread, or only in a particular shared library, function, file, line range within a file.
Still need to add "in methods of a class" to the specifiers, and the ability to write the stop hooks in the Scripting language as well as in the Command Language.
llvm-svn: 127457
2011-03-11 03:53:59 +00:00
|
|
|
if (m_type == eClassOrNamespaceSpecified) {
|
|
|
|
|
s->Indent();
|
|
|
|
|
s->Printf("Class name: %s.\n", m_class_name.c_str());
|
|
|
|
|
}
|
2016-09-06 20:57:50 +00:00
|
|
|
|
2019-02-13 06:25:41 +00:00
|
|
|
if (m_type == eAddressRangeSpecified && m_address_range_up != nullptr) {
|
Add a first pass at a "stop hook" mechanism. This allows you to add commands that get run every time the debugger stops, whether due to a breakpoint, the end of a step, interrupt, etc. You can also specify in which context you want the stop hook to run, for instance only on a particular thread, or only in a particular shared library, function, file, line range within a file.
Still need to add "in methods of a class" to the specifiers, and the ability to write the stop hooks in the Scripting language as well as in the Command Language.
llvm-svn: 127457
2011-03-11 03:53:59 +00:00
|
|
|
s->Indent();
|
|
|
|
|
s->PutCString("Address range: ");
|
2019-02-13 06:25:41 +00:00
|
|
|
m_address_range_up->Dump(s, m_target_sp.get(),
|
Add a first pass at a "stop hook" mechanism. This allows you to add commands that get run every time the debugger stops, whether due to a breakpoint, the end of a step, interrupt, etc. You can also specify in which context you want the stop hook to run, for instance only on a particular thread, or only in a particular shared library, function, file, line range within a file.
Still need to add "in methods of a class" to the specifiers, and the ability to write the stop hooks in the Scripting language as well as in the Command Language.
llvm-svn: 127457
2011-03-11 03:53:59 +00:00
|
|
|
Address::DumpStyleLoadAddress,
|
|
|
|
|
Address::DumpStyleFileAddress);
|
|
|
|
|
s->PutCString("\n");
|
|
|
|
|
}
|
|
|
|
|
}
|
2011-02-19 02:53:09 +00:00
|
|
|
|
2010-06-08 16:52:24 +00:00
|
|
|
//
|
|
|
|
|
// SymbolContextList
|
|
|
|
|
//
|
|
|
|
|
|
Removed all of the "#ifndef SWIG" from the SB header files since we are using
interface (.i) files for each class.
Changed the FindFunction class from:
uint32_t
SBTarget::FindFunctions (const char *name,
uint32_t name_type_mask,
bool append,
lldb::SBSymbolContextList& sc_list)
uint32_t
SBModule::FindFunctions (const char *name,
uint32_t name_type_mask,
bool append,
lldb::SBSymbolContextList& sc_list)
To:
lldb::SBSymbolContextList
SBTarget::FindFunctions (const char *name,
uint32_t name_type_mask = lldb::eFunctionNameTypeAny);
lldb::SBSymbolContextList
SBModule::FindFunctions (const char *name,
uint32_t name_type_mask = lldb::eFunctionNameTypeAny);
This makes the API easier to use from python. Also added the ability to
append a SBSymbolContext or a SBSymbolContextList to a SBSymbolContextList.
Exposed properties for lldb.SBSymbolContextList in python:
lldb.SBSymbolContextList.modules => list() or all lldb.SBModule objects in the list
lldb.SBSymbolContextList.compile_units => list() or all lldb.SBCompileUnits objects in the list
lldb.SBSymbolContextList.functions => list() or all lldb.SBFunction objects in the list
lldb.SBSymbolContextList.blocks => list() or all lldb.SBBlock objects in the list
lldb.SBSymbolContextList.line_entries => list() or all lldb.SBLineEntry objects in the list
lldb.SBSymbolContextList.symbols => list() or all lldb.SBSymbol objects in the list
This allows a call to the SBTarget::FindFunctions(...) and SBModule::FindFunctions(...)
and then the result can be used to extract the desired information:
sc_list = lldb.target.FindFunctions("erase")
for function in sc_list.functions:
print function
for symbol in sc_list.symbols:
print symbol
Exposed properties for the lldb.SBSymbolContext objects in python:
lldb.SBSymbolContext.module => lldb.SBModule
lldb.SBSymbolContext.compile_unit => lldb.SBCompileUnit
lldb.SBSymbolContext.function => lldb.SBFunction
lldb.SBSymbolContext.block => lldb.SBBlock
lldb.SBSymbolContext.line_entry => lldb.SBLineEntry
lldb.SBSymbolContext.symbol => lldb.SBSymbol
Exposed properties for the lldb.SBBlock objects in python:
lldb.SBBlock.parent => lldb.SBBlock for the parent block that contains
lldb.SBBlock.sibling => lldb.SBBlock for the sibling block to the current block
lldb.SBBlock.first_child => lldb.SBBlock for the first child block to the current block
lldb.SBBlock.call_site => for inline functions, return a lldb.declaration object that gives the call site file, line and column
lldb.SBBlock.name => for inline functions this is the name of the inline function that this block represents
lldb.SBBlock.inlined_block => returns the inlined function block that contains this block (might return itself if the current block is an inlined block)
lldb.SBBlock.range[int] => access the address ranges for a block by index, a list() with start and end address is returned
lldb.SBBlock.ranges => an array or all address ranges for this block
lldb.SBBlock.num_ranges => the number of address ranges for this blcok
SBFunction objects can now get the SBType and the SBBlock that represents the
top scope of the function.
SBBlock objects can now get the variable list from the current block. The value
list returned allows varaibles to be viewed prior with no process if code
wants to check the variables in a function. There are two ways to get a variable
list from a SBBlock:
lldb::SBValueList
SBBlock::GetVariables (lldb::SBFrame& frame,
bool arguments,
bool locals,
bool statics,
lldb::DynamicValueType use_dynamic);
lldb::SBValueList
SBBlock::GetVariables (lldb::SBTarget& target,
bool arguments,
bool locals,
bool statics);
When a SBFrame is used, the values returned will be locked down to the frame
and the values will be evaluated in the context of that frame.
When a SBTarget is used, global an static variables can be viewed without a
running process.
llvm-svn: 149853
2012-02-06 01:44:54 +00:00
|
|
|
SymbolContextList::SymbolContextList() : m_symbol_contexts() {}
|
2010-06-08 16:52:24 +00:00
|
|
|
|
|
|
|
|
SymbolContextList::~SymbolContextList() {}
|
|
|
|
|
|
|
|
|
|
void SymbolContextList::Append(const SymbolContext &sc) {
|
|
|
|
|
m_symbol_contexts.push_back(sc);
|
|
|
|
|
}
|
|
|
|
|
|
Removed all of the "#ifndef SWIG" from the SB header files since we are using
interface (.i) files for each class.
Changed the FindFunction class from:
uint32_t
SBTarget::FindFunctions (const char *name,
uint32_t name_type_mask,
bool append,
lldb::SBSymbolContextList& sc_list)
uint32_t
SBModule::FindFunctions (const char *name,
uint32_t name_type_mask,
bool append,
lldb::SBSymbolContextList& sc_list)
To:
lldb::SBSymbolContextList
SBTarget::FindFunctions (const char *name,
uint32_t name_type_mask = lldb::eFunctionNameTypeAny);
lldb::SBSymbolContextList
SBModule::FindFunctions (const char *name,
uint32_t name_type_mask = lldb::eFunctionNameTypeAny);
This makes the API easier to use from python. Also added the ability to
append a SBSymbolContext or a SBSymbolContextList to a SBSymbolContextList.
Exposed properties for lldb.SBSymbolContextList in python:
lldb.SBSymbolContextList.modules => list() or all lldb.SBModule objects in the list
lldb.SBSymbolContextList.compile_units => list() or all lldb.SBCompileUnits objects in the list
lldb.SBSymbolContextList.functions => list() or all lldb.SBFunction objects in the list
lldb.SBSymbolContextList.blocks => list() or all lldb.SBBlock objects in the list
lldb.SBSymbolContextList.line_entries => list() or all lldb.SBLineEntry objects in the list
lldb.SBSymbolContextList.symbols => list() or all lldb.SBSymbol objects in the list
This allows a call to the SBTarget::FindFunctions(...) and SBModule::FindFunctions(...)
and then the result can be used to extract the desired information:
sc_list = lldb.target.FindFunctions("erase")
for function in sc_list.functions:
print function
for symbol in sc_list.symbols:
print symbol
Exposed properties for the lldb.SBSymbolContext objects in python:
lldb.SBSymbolContext.module => lldb.SBModule
lldb.SBSymbolContext.compile_unit => lldb.SBCompileUnit
lldb.SBSymbolContext.function => lldb.SBFunction
lldb.SBSymbolContext.block => lldb.SBBlock
lldb.SBSymbolContext.line_entry => lldb.SBLineEntry
lldb.SBSymbolContext.symbol => lldb.SBSymbol
Exposed properties for the lldb.SBBlock objects in python:
lldb.SBBlock.parent => lldb.SBBlock for the parent block that contains
lldb.SBBlock.sibling => lldb.SBBlock for the sibling block to the current block
lldb.SBBlock.first_child => lldb.SBBlock for the first child block to the current block
lldb.SBBlock.call_site => for inline functions, return a lldb.declaration object that gives the call site file, line and column
lldb.SBBlock.name => for inline functions this is the name of the inline function that this block represents
lldb.SBBlock.inlined_block => returns the inlined function block that contains this block (might return itself if the current block is an inlined block)
lldb.SBBlock.range[int] => access the address ranges for a block by index, a list() with start and end address is returned
lldb.SBBlock.ranges => an array or all address ranges for this block
lldb.SBBlock.num_ranges => the number of address ranges for this blcok
SBFunction objects can now get the SBType and the SBBlock that represents the
top scope of the function.
SBBlock objects can now get the variable list from the current block. The value
list returned allows varaibles to be viewed prior with no process if code
wants to check the variables in a function. There are two ways to get a variable
list from a SBBlock:
lldb::SBValueList
SBBlock::GetVariables (lldb::SBFrame& frame,
bool arguments,
bool locals,
bool statics,
lldb::DynamicValueType use_dynamic);
lldb::SBValueList
SBBlock::GetVariables (lldb::SBTarget& target,
bool arguments,
bool locals,
bool statics);
When a SBFrame is used, the values returned will be locked down to the frame
and the values will be evaluated in the context of that frame.
When a SBTarget is used, global an static variables can be viewed without a
running process.
llvm-svn: 149853
2012-02-06 01:44:54 +00:00
|
|
|
void SymbolContextList::Append(const SymbolContextList &sc_list) {
|
|
|
|
|
collection::const_iterator pos, end = sc_list.m_symbol_contexts.end();
|
|
|
|
|
for (pos = sc_list.m_symbol_contexts.begin(); pos != end; ++pos)
|
|
|
|
|
m_symbol_contexts.push_back(*pos);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
uint32_t SymbolContextList::AppendIfUnique(const SymbolContextList &sc_list,
|
|
|
|
|
bool merge_symbol_into_function) {
|
|
|
|
|
uint32_t unique_sc_add_count = 0;
|
|
|
|
|
collection::const_iterator pos, end = sc_list.m_symbol_contexts.end();
|
|
|
|
|
for (pos = sc_list.m_symbol_contexts.begin(); pos != end; ++pos) {
|
|
|
|
|
if (AppendIfUnique(*pos, merge_symbol_into_function))
|
|
|
|
|
++unique_sc_add_count;
|
|
|
|
|
}
|
|
|
|
|
return unique_sc_add_count;
|
|
|
|
|
}
|
|
|
|
|
|
Added the ability to get the min and max instruction byte size for
an architecture into ArchSpec:
uint32_t
ArchSpec::GetMinimumOpcodeByteSize() const;
uint32_t
ArchSpec::GetMaximumOpcodeByteSize() const;
Added an AddressClass to the Instruction class in Disassembler.h.
This allows decoded instructions to know know if they are code,
code with alternate ISA (thumb), or even data which can be mixed
into code. The instruction does have an address, but it is a good
idea to cache this value so we don't have to look it up more than
once.
Fixed an issue in Opcode::SetOpcodeBytes() where the length wasn't
getting set.
Changed:
bool
SymbolContextList::AppendIfUnique (const SymbolContext& sc);
To:
bool
SymbolContextList::AppendIfUnique (const SymbolContext& sc,
bool merge_symbol_into_function);
This function was typically being used when looking up functions
and symbols. Now if you lookup a function, then find the symbol,
they can be merged into the same symbol context and not cause
multiple symbol contexts to appear in a symbol context list that
describes the same function.
Fixed the SymbolContext not equal operator which was causing mixed
mode disassembly to not work ("disassembler --mixed --name main").
Modified the disassembler classes to know about the fact we know,
for a given architecture, what the min and max opcode byte sizes
are. The InstructionList class was modified to return the max
opcode byte size for all of the instructions in its list.
These two fixes means when disassemble a list of instructions and dump
them and show the opcode bytes, we can format the output more
intelligently when showing opcode bytes. This affects any architectures
that have varying opcode byte sizes (x86_64 and i386). Knowing the max
opcode byte size also helps us to be able to disassemble N instructions
without having to re-read data if we didn't read enough bytes.
Added the ability to set the architecture for the disassemble command.
This means you can easily cross disassemble data for any supported
architecture. I also added the ability to specify "thumb" as an
architecture so that we can force disassembly into thumb mode when
needed. In GDB this was done using a hack of specifying an odd
address when disassembling. I don't want to repeat this hack in LLDB,
so the auto detection between ARM and thumb is failing, just specify
thumb when disassembling:
(lldb) disassemble --arch thumb --name main
You can also have data in say an x86_64 file executable and disassemble
data as any other supported architecture:
% lldb a.out
Current executable set to 'a.out' (x86_64).
(lldb) b main
(lldb) run
(lldb) disassemble --arch thumb --count 2 --start-address 0x0000000100001080 --bytes
0x100001080: 0xb580 push {r7, lr}
0x100001082: 0xaf00 add r7, sp, #0
Fixed Target::ReadMemory(...) to be able to deal with Address argument object
that isn't section offset. When an address object was supplied that was
out on the heap or stack, target read memory would fail. Disassembly uses
Target::ReadMemory(...), and the example above where we disassembler thumb
opcodes in an x86 binary was failing do to this bug.
llvm-svn: 128347
2011-03-26 19:14:58 +00:00
|
|
|
bool SymbolContextList::AppendIfUnique(const SymbolContext &sc,
|
|
|
|
|
bool merge_symbol_into_function) {
|
|
|
|
|
collection::iterator pos, end = m_symbol_contexts.end();
|
2011-01-27 06:44:37 +00:00
|
|
|
for (pos = m_symbol_contexts.begin(); pos != end; ++pos) {
|
|
|
|
|
if (*pos == sc)
|
|
|
|
|
return false;
|
|
|
|
|
}
|
Added the ability to get the min and max instruction byte size for
an architecture into ArchSpec:
uint32_t
ArchSpec::GetMinimumOpcodeByteSize() const;
uint32_t
ArchSpec::GetMaximumOpcodeByteSize() const;
Added an AddressClass to the Instruction class in Disassembler.h.
This allows decoded instructions to know know if they are code,
code with alternate ISA (thumb), or even data which can be mixed
into code. The instruction does have an address, but it is a good
idea to cache this value so we don't have to look it up more than
once.
Fixed an issue in Opcode::SetOpcodeBytes() where the length wasn't
getting set.
Changed:
bool
SymbolContextList::AppendIfUnique (const SymbolContext& sc);
To:
bool
SymbolContextList::AppendIfUnique (const SymbolContext& sc,
bool merge_symbol_into_function);
This function was typically being used when looking up functions
and symbols. Now if you lookup a function, then find the symbol,
they can be merged into the same symbol context and not cause
multiple symbol contexts to appear in a symbol context list that
describes the same function.
Fixed the SymbolContext not equal operator which was causing mixed
mode disassembly to not work ("disassembler --mixed --name main").
Modified the disassembler classes to know about the fact we know,
for a given architecture, what the min and max opcode byte sizes
are. The InstructionList class was modified to return the max
opcode byte size for all of the instructions in its list.
These two fixes means when disassemble a list of instructions and dump
them and show the opcode bytes, we can format the output more
intelligently when showing opcode bytes. This affects any architectures
that have varying opcode byte sizes (x86_64 and i386). Knowing the max
opcode byte size also helps us to be able to disassemble N instructions
without having to re-read data if we didn't read enough bytes.
Added the ability to set the architecture for the disassemble command.
This means you can easily cross disassemble data for any supported
architecture. I also added the ability to specify "thumb" as an
architecture so that we can force disassembly into thumb mode when
needed. In GDB this was done using a hack of specifying an odd
address when disassembling. I don't want to repeat this hack in LLDB,
so the auto detection between ARM and thumb is failing, just specify
thumb when disassembling:
(lldb) disassemble --arch thumb --name main
You can also have data in say an x86_64 file executable and disassemble
data as any other supported architecture:
% lldb a.out
Current executable set to 'a.out' (x86_64).
(lldb) b main
(lldb) run
(lldb) disassemble --arch thumb --count 2 --start-address 0x0000000100001080 --bytes
0x100001080: 0xb580 push {r7, lr}
0x100001082: 0xaf00 add r7, sp, #0
Fixed Target::ReadMemory(...) to be able to deal with Address argument object
that isn't section offset. When an address object was supplied that was
out on the heap or stack, target read memory would fail. Disassembly uses
Target::ReadMemory(...), and the example above where we disassembler thumb
opcodes in an x86 binary was failing do to this bug.
llvm-svn: 128347
2011-03-26 19:14:58 +00:00
|
|
|
if (merge_symbol_into_function && sc.symbol != nullptr &&
|
2014-04-20 13:17:36 +00:00
|
|
|
sc.comp_unit == nullptr && sc.function == nullptr &&
|
2018-12-15 00:15:33 +00:00
|
|
|
sc.block == nullptr && !sc.line_entry.IsValid()) {
|
2012-03-07 21:03:09 +00:00
|
|
|
if (sc.symbol->ValueIsAddress()) {
|
Added the ability to get the min and max instruction byte size for
an architecture into ArchSpec:
uint32_t
ArchSpec::GetMinimumOpcodeByteSize() const;
uint32_t
ArchSpec::GetMaximumOpcodeByteSize() const;
Added an AddressClass to the Instruction class in Disassembler.h.
This allows decoded instructions to know know if they are code,
code with alternate ISA (thumb), or even data which can be mixed
into code. The instruction does have an address, but it is a good
idea to cache this value so we don't have to look it up more than
once.
Fixed an issue in Opcode::SetOpcodeBytes() where the length wasn't
getting set.
Changed:
bool
SymbolContextList::AppendIfUnique (const SymbolContext& sc);
To:
bool
SymbolContextList::AppendIfUnique (const SymbolContext& sc,
bool merge_symbol_into_function);
This function was typically being used when looking up functions
and symbols. Now if you lookup a function, then find the symbol,
they can be merged into the same symbol context and not cause
multiple symbol contexts to appear in a symbol context list that
describes the same function.
Fixed the SymbolContext not equal operator which was causing mixed
mode disassembly to not work ("disassembler --mixed --name main").
Modified the disassembler classes to know about the fact we know,
for a given architecture, what the min and max opcode byte sizes
are. The InstructionList class was modified to return the max
opcode byte size for all of the instructions in its list.
These two fixes means when disassemble a list of instructions and dump
them and show the opcode bytes, we can format the output more
intelligently when showing opcode bytes. This affects any architectures
that have varying opcode byte sizes (x86_64 and i386). Knowing the max
opcode byte size also helps us to be able to disassemble N instructions
without having to re-read data if we didn't read enough bytes.
Added the ability to set the architecture for the disassemble command.
This means you can easily cross disassemble data for any supported
architecture. I also added the ability to specify "thumb" as an
architecture so that we can force disassembly into thumb mode when
needed. In GDB this was done using a hack of specifying an odd
address when disassembling. I don't want to repeat this hack in LLDB,
so the auto detection between ARM and thumb is failing, just specify
thumb when disassembling:
(lldb) disassemble --arch thumb --name main
You can also have data in say an x86_64 file executable and disassemble
data as any other supported architecture:
% lldb a.out
Current executable set to 'a.out' (x86_64).
(lldb) b main
(lldb) run
(lldb) disassemble --arch thumb --count 2 --start-address 0x0000000100001080 --bytes
0x100001080: 0xb580 push {r7, lr}
0x100001082: 0xaf00 add r7, sp, #0
Fixed Target::ReadMemory(...) to be able to deal with Address argument object
that isn't section offset. When an address object was supplied that was
out on the heap or stack, target read memory would fail. Disassembly uses
Target::ReadMemory(...), and the example above where we disassembler thumb
opcodes in an x86 binary was failing do to this bug.
llvm-svn: 128347
2011-03-26 19:14:58 +00:00
|
|
|
for (pos = m_symbol_contexts.begin(); pos != end; ++pos) {
|
2013-06-12 00:46:38 +00:00
|
|
|
// Don't merge symbols into inlined function symbol contexts
|
|
|
|
|
if (pos->block && pos->block->GetContainingInlinedBlock())
|
|
|
|
|
continue;
|
2016-09-06 20:57:50 +00:00
|
|
|
|
Added the ability to get the min and max instruction byte size for
an architecture into ArchSpec:
uint32_t
ArchSpec::GetMinimumOpcodeByteSize() const;
uint32_t
ArchSpec::GetMaximumOpcodeByteSize() const;
Added an AddressClass to the Instruction class in Disassembler.h.
This allows decoded instructions to know know if they are code,
code with alternate ISA (thumb), or even data which can be mixed
into code. The instruction does have an address, but it is a good
idea to cache this value so we don't have to look it up more than
once.
Fixed an issue in Opcode::SetOpcodeBytes() where the length wasn't
getting set.
Changed:
bool
SymbolContextList::AppendIfUnique (const SymbolContext& sc);
To:
bool
SymbolContextList::AppendIfUnique (const SymbolContext& sc,
bool merge_symbol_into_function);
This function was typically being used when looking up functions
and symbols. Now if you lookup a function, then find the symbol,
they can be merged into the same symbol context and not cause
multiple symbol contexts to appear in a symbol context list that
describes the same function.
Fixed the SymbolContext not equal operator which was causing mixed
mode disassembly to not work ("disassembler --mixed --name main").
Modified the disassembler classes to know about the fact we know,
for a given architecture, what the min and max opcode byte sizes
are. The InstructionList class was modified to return the max
opcode byte size for all of the instructions in its list.
These two fixes means when disassemble a list of instructions and dump
them and show the opcode bytes, we can format the output more
intelligently when showing opcode bytes. This affects any architectures
that have varying opcode byte sizes (x86_64 and i386). Knowing the max
opcode byte size also helps us to be able to disassemble N instructions
without having to re-read data if we didn't read enough bytes.
Added the ability to set the architecture for the disassemble command.
This means you can easily cross disassemble data for any supported
architecture. I also added the ability to specify "thumb" as an
architecture so that we can force disassembly into thumb mode when
needed. In GDB this was done using a hack of specifying an odd
address when disassembling. I don't want to repeat this hack in LLDB,
so the auto detection between ARM and thumb is failing, just specify
thumb when disassembling:
(lldb) disassemble --arch thumb --name main
You can also have data in say an x86_64 file executable and disassemble
data as any other supported architecture:
% lldb a.out
Current executable set to 'a.out' (x86_64).
(lldb) b main
(lldb) run
(lldb) disassemble --arch thumb --count 2 --start-address 0x0000000100001080 --bytes
0x100001080: 0xb580 push {r7, lr}
0x100001082: 0xaf00 add r7, sp, #0
Fixed Target::ReadMemory(...) to be able to deal with Address argument object
that isn't section offset. When an address object was supplied that was
out on the heap or stack, target read memory would fail. Disassembly uses
Target::ReadMemory(...), and the example above where we disassembler thumb
opcodes in an x86 binary was failing do to this bug.
llvm-svn: 128347
2011-03-26 19:14:58 +00:00
|
|
|
if (pos->function) {
|
2015-06-25 21:46:34 +00:00
|
|
|
if (pos->function->GetAddressRange().GetBaseAddress() ==
|
|
|
|
|
sc.symbol->GetAddressRef()) {
|
Added the ability to get the min and max instruction byte size for
an architecture into ArchSpec:
uint32_t
ArchSpec::GetMinimumOpcodeByteSize() const;
uint32_t
ArchSpec::GetMaximumOpcodeByteSize() const;
Added an AddressClass to the Instruction class in Disassembler.h.
This allows decoded instructions to know know if they are code,
code with alternate ISA (thumb), or even data which can be mixed
into code. The instruction does have an address, but it is a good
idea to cache this value so we don't have to look it up more than
once.
Fixed an issue in Opcode::SetOpcodeBytes() where the length wasn't
getting set.
Changed:
bool
SymbolContextList::AppendIfUnique (const SymbolContext& sc);
To:
bool
SymbolContextList::AppendIfUnique (const SymbolContext& sc,
bool merge_symbol_into_function);
This function was typically being used when looking up functions
and symbols. Now if you lookup a function, then find the symbol,
they can be merged into the same symbol context and not cause
multiple symbol contexts to appear in a symbol context list that
describes the same function.
Fixed the SymbolContext not equal operator which was causing mixed
mode disassembly to not work ("disassembler --mixed --name main").
Modified the disassembler classes to know about the fact we know,
for a given architecture, what the min and max opcode byte sizes
are. The InstructionList class was modified to return the max
opcode byte size for all of the instructions in its list.
These two fixes means when disassemble a list of instructions and dump
them and show the opcode bytes, we can format the output more
intelligently when showing opcode bytes. This affects any architectures
that have varying opcode byte sizes (x86_64 and i386). Knowing the max
opcode byte size also helps us to be able to disassemble N instructions
without having to re-read data if we didn't read enough bytes.
Added the ability to set the architecture for the disassemble command.
This means you can easily cross disassemble data for any supported
architecture. I also added the ability to specify "thumb" as an
architecture so that we can force disassembly into thumb mode when
needed. In GDB this was done using a hack of specifying an odd
address when disassembling. I don't want to repeat this hack in LLDB,
so the auto detection between ARM and thumb is failing, just specify
thumb when disassembling:
(lldb) disassemble --arch thumb --name main
You can also have data in say an x86_64 file executable and disassemble
data as any other supported architecture:
% lldb a.out
Current executable set to 'a.out' (x86_64).
(lldb) b main
(lldb) run
(lldb) disassemble --arch thumb --count 2 --start-address 0x0000000100001080 --bytes
0x100001080: 0xb580 push {r7, lr}
0x100001082: 0xaf00 add r7, sp, #0
Fixed Target::ReadMemory(...) to be able to deal with Address argument object
that isn't section offset. When an address object was supplied that was
out on the heap or stack, target read memory would fail. Disassembly uses
Target::ReadMemory(...), and the example above where we disassembler thumb
opcodes in an x86 binary was failing do to this bug.
llvm-svn: 128347
2011-03-26 19:14:58 +00:00
|
|
|
// Do we already have a function with this symbol?
|
|
|
|
|
if (pos->symbol == sc.symbol)
|
|
|
|
|
return false;
|
2014-04-20 13:17:36 +00:00
|
|
|
if (pos->symbol == nullptr) {
|
Added the ability to get the min and max instruction byte size for
an architecture into ArchSpec:
uint32_t
ArchSpec::GetMinimumOpcodeByteSize() const;
uint32_t
ArchSpec::GetMaximumOpcodeByteSize() const;
Added an AddressClass to the Instruction class in Disassembler.h.
This allows decoded instructions to know know if they are code,
code with alternate ISA (thumb), or even data which can be mixed
into code. The instruction does have an address, but it is a good
idea to cache this value so we don't have to look it up more than
once.
Fixed an issue in Opcode::SetOpcodeBytes() where the length wasn't
getting set.
Changed:
bool
SymbolContextList::AppendIfUnique (const SymbolContext& sc);
To:
bool
SymbolContextList::AppendIfUnique (const SymbolContext& sc,
bool merge_symbol_into_function);
This function was typically being used when looking up functions
and symbols. Now if you lookup a function, then find the symbol,
they can be merged into the same symbol context and not cause
multiple symbol contexts to appear in a symbol context list that
describes the same function.
Fixed the SymbolContext not equal operator which was causing mixed
mode disassembly to not work ("disassembler --mixed --name main").
Modified the disassembler classes to know about the fact we know,
for a given architecture, what the min and max opcode byte sizes
are. The InstructionList class was modified to return the max
opcode byte size for all of the instructions in its list.
These two fixes means when disassemble a list of instructions and dump
them and show the opcode bytes, we can format the output more
intelligently when showing opcode bytes. This affects any architectures
that have varying opcode byte sizes (x86_64 and i386). Knowing the max
opcode byte size also helps us to be able to disassemble N instructions
without having to re-read data if we didn't read enough bytes.
Added the ability to set the architecture for the disassemble command.
This means you can easily cross disassemble data for any supported
architecture. I also added the ability to specify "thumb" as an
architecture so that we can force disassembly into thumb mode when
needed. In GDB this was done using a hack of specifying an odd
address when disassembling. I don't want to repeat this hack in LLDB,
so the auto detection between ARM and thumb is failing, just specify
thumb when disassembling:
(lldb) disassemble --arch thumb --name main
You can also have data in say an x86_64 file executable and disassemble
data as any other supported architecture:
% lldb a.out
Current executable set to 'a.out' (x86_64).
(lldb) b main
(lldb) run
(lldb) disassemble --arch thumb --count 2 --start-address 0x0000000100001080 --bytes
0x100001080: 0xb580 push {r7, lr}
0x100001082: 0xaf00 add r7, sp, #0
Fixed Target::ReadMemory(...) to be able to deal with Address argument object
that isn't section offset. When an address object was supplied that was
out on the heap or stack, target read memory would fail. Disassembly uses
Target::ReadMemory(...), and the example above where we disassembler thumb
opcodes in an x86 binary was failing do to this bug.
llvm-svn: 128347
2011-03-26 19:14:58 +00:00
|
|
|
pos->symbol = sc.symbol;
|
|
|
|
|
return false;
|
|
|
|
|
}
|
2016-09-06 20:57:50 +00:00
|
|
|
}
|
Added the ability to get the min and max instruction byte size for
an architecture into ArchSpec:
uint32_t
ArchSpec::GetMinimumOpcodeByteSize() const;
uint32_t
ArchSpec::GetMaximumOpcodeByteSize() const;
Added an AddressClass to the Instruction class in Disassembler.h.
This allows decoded instructions to know know if they are code,
code with alternate ISA (thumb), or even data which can be mixed
into code. The instruction does have an address, but it is a good
idea to cache this value so we don't have to look it up more than
once.
Fixed an issue in Opcode::SetOpcodeBytes() where the length wasn't
getting set.
Changed:
bool
SymbolContextList::AppendIfUnique (const SymbolContext& sc);
To:
bool
SymbolContextList::AppendIfUnique (const SymbolContext& sc,
bool merge_symbol_into_function);
This function was typically being used when looking up functions
and symbols. Now if you lookup a function, then find the symbol,
they can be merged into the same symbol context and not cause
multiple symbol contexts to appear in a symbol context list that
describes the same function.
Fixed the SymbolContext not equal operator which was causing mixed
mode disassembly to not work ("disassembler --mixed --name main").
Modified the disassembler classes to know about the fact we know,
for a given architecture, what the min and max opcode byte sizes
are. The InstructionList class was modified to return the max
opcode byte size for all of the instructions in its list.
These two fixes means when disassemble a list of instructions and dump
them and show the opcode bytes, we can format the output more
intelligently when showing opcode bytes. This affects any architectures
that have varying opcode byte sizes (x86_64 and i386). Knowing the max
opcode byte size also helps us to be able to disassemble N instructions
without having to re-read data if we didn't read enough bytes.
Added the ability to set the architecture for the disassemble command.
This means you can easily cross disassemble data for any supported
architecture. I also added the ability to specify "thumb" as an
architecture so that we can force disassembly into thumb mode when
needed. In GDB this was done using a hack of specifying an odd
address when disassembling. I don't want to repeat this hack in LLDB,
so the auto detection between ARM and thumb is failing, just specify
thumb when disassembling:
(lldb) disassemble --arch thumb --name main
You can also have data in say an x86_64 file executable and disassemble
data as any other supported architecture:
% lldb a.out
Current executable set to 'a.out' (x86_64).
(lldb) b main
(lldb) run
(lldb) disassemble --arch thumb --count 2 --start-address 0x0000000100001080 --bytes
0x100001080: 0xb580 push {r7, lr}
0x100001082: 0xaf00 add r7, sp, #0
Fixed Target::ReadMemory(...) to be able to deal with Address argument object
that isn't section offset. When an address object was supplied that was
out on the heap or stack, target read memory would fail. Disassembly uses
Target::ReadMemory(...), and the example above where we disassembler thumb
opcodes in an x86 binary was failing do to this bug.
llvm-svn: 128347
2011-03-26 19:14:58 +00:00
|
|
|
}
|
2016-09-06 20:57:50 +00:00
|
|
|
}
|
Added the ability to get the min and max instruction byte size for
an architecture into ArchSpec:
uint32_t
ArchSpec::GetMinimumOpcodeByteSize() const;
uint32_t
ArchSpec::GetMaximumOpcodeByteSize() const;
Added an AddressClass to the Instruction class in Disassembler.h.
This allows decoded instructions to know know if they are code,
code with alternate ISA (thumb), or even data which can be mixed
into code. The instruction does have an address, but it is a good
idea to cache this value so we don't have to look it up more than
once.
Fixed an issue in Opcode::SetOpcodeBytes() where the length wasn't
getting set.
Changed:
bool
SymbolContextList::AppendIfUnique (const SymbolContext& sc);
To:
bool
SymbolContextList::AppendIfUnique (const SymbolContext& sc,
bool merge_symbol_into_function);
This function was typically being used when looking up functions
and symbols. Now if you lookup a function, then find the symbol,
they can be merged into the same symbol context and not cause
multiple symbol contexts to appear in a symbol context list that
describes the same function.
Fixed the SymbolContext not equal operator which was causing mixed
mode disassembly to not work ("disassembler --mixed --name main").
Modified the disassembler classes to know about the fact we know,
for a given architecture, what the min and max opcode byte sizes
are. The InstructionList class was modified to return the max
opcode byte size for all of the instructions in its list.
These two fixes means when disassemble a list of instructions and dump
them and show the opcode bytes, we can format the output more
intelligently when showing opcode bytes. This affects any architectures
that have varying opcode byte sizes (x86_64 and i386). Knowing the max
opcode byte size also helps us to be able to disassemble N instructions
without having to re-read data if we didn't read enough bytes.
Added the ability to set the architecture for the disassemble command.
This means you can easily cross disassemble data for any supported
architecture. I also added the ability to specify "thumb" as an
architecture so that we can force disassembly into thumb mode when
needed. In GDB this was done using a hack of specifying an odd
address when disassembling. I don't want to repeat this hack in LLDB,
so the auto detection between ARM and thumb is failing, just specify
thumb when disassembling:
(lldb) disassemble --arch thumb --name main
You can also have data in say an x86_64 file executable and disassemble
data as any other supported architecture:
% lldb a.out
Current executable set to 'a.out' (x86_64).
(lldb) b main
(lldb) run
(lldb) disassemble --arch thumb --count 2 --start-address 0x0000000100001080 --bytes
0x100001080: 0xb580 push {r7, lr}
0x100001082: 0xaf00 add r7, sp, #0
Fixed Target::ReadMemory(...) to be able to deal with Address argument object
that isn't section offset. When an address object was supplied that was
out on the heap or stack, target read memory would fail. Disassembly uses
Target::ReadMemory(...), and the example above where we disassembler thumb
opcodes in an x86 binary was failing do to this bug.
llvm-svn: 128347
2011-03-26 19:14:58 +00:00
|
|
|
}
|
2016-09-06 20:57:50 +00:00
|
|
|
}
|
2011-01-27 06:44:37 +00:00
|
|
|
m_symbol_contexts.push_back(sc);
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2010-06-08 16:52:24 +00:00
|
|
|
void SymbolContextList::Clear() { m_symbol_contexts.clear(); }
|
|
|
|
|
|
2010-09-14 23:36:40 +00:00
|
|
|
void SymbolContextList::Dump(Stream *s, Target *target) const {
|
2010-06-08 16:52:24 +00:00
|
|
|
|
2015-07-22 07:58:17 +00:00
|
|
|
*s << this << ": ";
|
2010-06-08 16:52:24 +00:00
|
|
|
s->Indent();
|
|
|
|
|
s->PutCString("SymbolContextList");
|
|
|
|
|
s->EOL();
|
|
|
|
|
s->IndentMore();
|
|
|
|
|
|
|
|
|
|
collection::const_iterator pos, end = m_symbol_contexts.end();
|
|
|
|
|
for (pos = m_symbol_contexts.begin(); pos != end; ++pos) {
|
2011-10-04 22:41:51 +00:00
|
|
|
// pos->Dump(s, target);
|
|
|
|
|
pos->GetDescription(s, eDescriptionLevelVerbose, target);
|
2010-06-08 16:52:24 +00:00
|
|
|
}
|
|
|
|
|
s->IndentLess();
|
|
|
|
|
}
|
|
|
|
|
|
2013-01-25 18:06:21 +00:00
|
|
|
bool SymbolContextList::GetContextAtIndex(size_t idx, SymbolContext &sc) const {
|
2010-06-08 16:52:24 +00:00
|
|
|
if (idx < m_symbol_contexts.size()) {
|
|
|
|
|
sc = m_symbol_contexts[idx];
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2013-01-25 18:06:21 +00:00
|
|
|
bool SymbolContextList::RemoveContextAtIndex(size_t idx) {
|
2010-06-08 16:52:24 +00:00
|
|
|
if (idx < m_symbol_contexts.size()) {
|
|
|
|
|
m_symbol_contexts.erase(m_symbol_contexts.begin() + idx);
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
uint32_t SymbolContextList::GetSize() const { return m_symbol_contexts.size(); }
|
Added a new option to the "source list" command that allows us to see where
line tables specify breakpoints can be set in the source. When dumping the
source, the number of breakpoints that can be set on a source line are shown
as a prefix:
(lldb) source list -f test.c -l1 -c222 -b
1 #include <stdio.h>
2 #include <sys/fcntl.h>
3 #include <unistd.h>
4 int
5 sleep_loop (const int num_secs)
[2] 6 {
7 int i;
[1] 8 for (i=0; i<num_secs; ++i)
9 {
[1] 10 printf("%d of %i - sleep(1);\n", i, num_secs);
[1] 11 sleep(1);
12 }
13 return 0;
[1] 14 }
15
16 int
17 main (int argc, char const* argv[])
[1] 18 {
[1] 19 printf("Process: %i\n\n", getpid());
[1] 20 puts("Press any key to continue..."); getchar();
[1] 21 sleep_loop (20);
22 return 12;
[1] 23 }
Above we can see there are two breakpoints for line 6 and one breakpoint for
lines 8, 10, 11, 14, 18, 19, 20, 21 and 23. All other lines have no line table
entries for them. This helps visualize the data provided in the debug
information without having to manually dump all line tables. It also includes
all inline breakpoint that may result for a given file which can also be very
handy to see.
llvm-svn: 129747
2011-04-19 04:19:37 +00:00
|
|
|
|
2019-09-04 22:38:20 +00:00
|
|
|
bool SymbolContextList::IsEmpty() const { return m_symbol_contexts.empty(); }
|
|
|
|
|
|
Added a new option to the "source list" command that allows us to see where
line tables specify breakpoints can be set in the source. When dumping the
source, the number of breakpoints that can be set on a source line are shown
as a prefix:
(lldb) source list -f test.c -l1 -c222 -b
1 #include <stdio.h>
2 #include <sys/fcntl.h>
3 #include <unistd.h>
4 int
5 sleep_loop (const int num_secs)
[2] 6 {
7 int i;
[1] 8 for (i=0; i<num_secs; ++i)
9 {
[1] 10 printf("%d of %i - sleep(1);\n", i, num_secs);
[1] 11 sleep(1);
12 }
13 return 0;
[1] 14 }
15
16 int
17 main (int argc, char const* argv[])
[1] 18 {
[1] 19 printf("Process: %i\n\n", getpid());
[1] 20 puts("Press any key to continue..."); getchar();
[1] 21 sleep_loop (20);
22 return 12;
[1] 23 }
Above we can see there are two breakpoints for line 6 and one breakpoint for
lines 8, 10, 11, 14, 18, 19, 20, 21 and 23. All other lines have no line table
entries for them. This helps visualize the data provided in the debug
information without having to manually dump all line tables. It also includes
all inline breakpoint that may result for a given file which can also be very
handy to see.
llvm-svn: 129747
2011-04-19 04:19:37 +00:00
|
|
|
uint32_t SymbolContextList::NumLineEntriesWithLine(uint32_t line) const {
|
|
|
|
|
uint32_t match_count = 0;
|
2013-01-25 18:06:21 +00:00
|
|
|
const size_t size = m_symbol_contexts.size();
|
|
|
|
|
for (size_t idx = 0; idx < size; ++idx) {
|
Added a new option to the "source list" command that allows us to see where
line tables specify breakpoints can be set in the source. When dumping the
source, the number of breakpoints that can be set on a source line are shown
as a prefix:
(lldb) source list -f test.c -l1 -c222 -b
1 #include <stdio.h>
2 #include <sys/fcntl.h>
3 #include <unistd.h>
4 int
5 sleep_loop (const int num_secs)
[2] 6 {
7 int i;
[1] 8 for (i=0; i<num_secs; ++i)
9 {
[1] 10 printf("%d of %i - sleep(1);\n", i, num_secs);
[1] 11 sleep(1);
12 }
13 return 0;
[1] 14 }
15
16 int
17 main (int argc, char const* argv[])
[1] 18 {
[1] 19 printf("Process: %i\n\n", getpid());
[1] 20 puts("Press any key to continue..."); getchar();
[1] 21 sleep_loop (20);
22 return 12;
[1] 23 }
Above we can see there are two breakpoints for line 6 and one breakpoint for
lines 8, 10, 11, 14, 18, 19, 20, 21 and 23. All other lines have no line table
entries for them. This helps visualize the data provided in the debug
information without having to manually dump all line tables. It also includes
all inline breakpoint that may result for a given file which can also be very
handy to see.
llvm-svn: 129747
2011-04-19 04:19:37 +00:00
|
|
|
if (m_symbol_contexts[idx].line_entry.line == line)
|
|
|
|
|
++match_count;
|
|
|
|
|
}
|
|
|
|
|
return match_count;
|
|
|
|
|
}
|
|
|
|
|
|
Removed all of the "#ifndef SWIG" from the SB header files since we are using
interface (.i) files for each class.
Changed the FindFunction class from:
uint32_t
SBTarget::FindFunctions (const char *name,
uint32_t name_type_mask,
bool append,
lldb::SBSymbolContextList& sc_list)
uint32_t
SBModule::FindFunctions (const char *name,
uint32_t name_type_mask,
bool append,
lldb::SBSymbolContextList& sc_list)
To:
lldb::SBSymbolContextList
SBTarget::FindFunctions (const char *name,
uint32_t name_type_mask = lldb::eFunctionNameTypeAny);
lldb::SBSymbolContextList
SBModule::FindFunctions (const char *name,
uint32_t name_type_mask = lldb::eFunctionNameTypeAny);
This makes the API easier to use from python. Also added the ability to
append a SBSymbolContext or a SBSymbolContextList to a SBSymbolContextList.
Exposed properties for lldb.SBSymbolContextList in python:
lldb.SBSymbolContextList.modules => list() or all lldb.SBModule objects in the list
lldb.SBSymbolContextList.compile_units => list() or all lldb.SBCompileUnits objects in the list
lldb.SBSymbolContextList.functions => list() or all lldb.SBFunction objects in the list
lldb.SBSymbolContextList.blocks => list() or all lldb.SBBlock objects in the list
lldb.SBSymbolContextList.line_entries => list() or all lldb.SBLineEntry objects in the list
lldb.SBSymbolContextList.symbols => list() or all lldb.SBSymbol objects in the list
This allows a call to the SBTarget::FindFunctions(...) and SBModule::FindFunctions(...)
and then the result can be used to extract the desired information:
sc_list = lldb.target.FindFunctions("erase")
for function in sc_list.functions:
print function
for symbol in sc_list.symbols:
print symbol
Exposed properties for the lldb.SBSymbolContext objects in python:
lldb.SBSymbolContext.module => lldb.SBModule
lldb.SBSymbolContext.compile_unit => lldb.SBCompileUnit
lldb.SBSymbolContext.function => lldb.SBFunction
lldb.SBSymbolContext.block => lldb.SBBlock
lldb.SBSymbolContext.line_entry => lldb.SBLineEntry
lldb.SBSymbolContext.symbol => lldb.SBSymbol
Exposed properties for the lldb.SBBlock objects in python:
lldb.SBBlock.parent => lldb.SBBlock for the parent block that contains
lldb.SBBlock.sibling => lldb.SBBlock for the sibling block to the current block
lldb.SBBlock.first_child => lldb.SBBlock for the first child block to the current block
lldb.SBBlock.call_site => for inline functions, return a lldb.declaration object that gives the call site file, line and column
lldb.SBBlock.name => for inline functions this is the name of the inline function that this block represents
lldb.SBBlock.inlined_block => returns the inlined function block that contains this block (might return itself if the current block is an inlined block)
lldb.SBBlock.range[int] => access the address ranges for a block by index, a list() with start and end address is returned
lldb.SBBlock.ranges => an array or all address ranges for this block
lldb.SBBlock.num_ranges => the number of address ranges for this blcok
SBFunction objects can now get the SBType and the SBBlock that represents the
top scope of the function.
SBBlock objects can now get the variable list from the current block. The value
list returned allows varaibles to be viewed prior with no process if code
wants to check the variables in a function. There are two ways to get a variable
list from a SBBlock:
lldb::SBValueList
SBBlock::GetVariables (lldb::SBFrame& frame,
bool arguments,
bool locals,
bool statics,
lldb::DynamicValueType use_dynamic);
lldb::SBValueList
SBBlock::GetVariables (lldb::SBTarget& target,
bool arguments,
bool locals,
bool statics);
When a SBFrame is used, the values returned will be locked down to the frame
and the values will be evaluated in the context of that frame.
When a SBTarget is used, global an static variables can be viewed without a
running process.
llvm-svn: 149853
2012-02-06 01:44:54 +00:00
|
|
|
void SymbolContextList::GetDescription(Stream *s, lldb::DescriptionLevel level,
|
|
|
|
|
Target *target) const {
|
2013-01-25 18:06:21 +00:00
|
|
|
const size_t size = m_symbol_contexts.size();
|
|
|
|
|
for (size_t idx = 0; idx < size; ++idx)
|
Removed all of the "#ifndef SWIG" from the SB header files since we are using
interface (.i) files for each class.
Changed the FindFunction class from:
uint32_t
SBTarget::FindFunctions (const char *name,
uint32_t name_type_mask,
bool append,
lldb::SBSymbolContextList& sc_list)
uint32_t
SBModule::FindFunctions (const char *name,
uint32_t name_type_mask,
bool append,
lldb::SBSymbolContextList& sc_list)
To:
lldb::SBSymbolContextList
SBTarget::FindFunctions (const char *name,
uint32_t name_type_mask = lldb::eFunctionNameTypeAny);
lldb::SBSymbolContextList
SBModule::FindFunctions (const char *name,
uint32_t name_type_mask = lldb::eFunctionNameTypeAny);
This makes the API easier to use from python. Also added the ability to
append a SBSymbolContext or a SBSymbolContextList to a SBSymbolContextList.
Exposed properties for lldb.SBSymbolContextList in python:
lldb.SBSymbolContextList.modules => list() or all lldb.SBModule objects in the list
lldb.SBSymbolContextList.compile_units => list() or all lldb.SBCompileUnits objects in the list
lldb.SBSymbolContextList.functions => list() or all lldb.SBFunction objects in the list
lldb.SBSymbolContextList.blocks => list() or all lldb.SBBlock objects in the list
lldb.SBSymbolContextList.line_entries => list() or all lldb.SBLineEntry objects in the list
lldb.SBSymbolContextList.symbols => list() or all lldb.SBSymbol objects in the list
This allows a call to the SBTarget::FindFunctions(...) and SBModule::FindFunctions(...)
and then the result can be used to extract the desired information:
sc_list = lldb.target.FindFunctions("erase")
for function in sc_list.functions:
print function
for symbol in sc_list.symbols:
print symbol
Exposed properties for the lldb.SBSymbolContext objects in python:
lldb.SBSymbolContext.module => lldb.SBModule
lldb.SBSymbolContext.compile_unit => lldb.SBCompileUnit
lldb.SBSymbolContext.function => lldb.SBFunction
lldb.SBSymbolContext.block => lldb.SBBlock
lldb.SBSymbolContext.line_entry => lldb.SBLineEntry
lldb.SBSymbolContext.symbol => lldb.SBSymbol
Exposed properties for the lldb.SBBlock objects in python:
lldb.SBBlock.parent => lldb.SBBlock for the parent block that contains
lldb.SBBlock.sibling => lldb.SBBlock for the sibling block to the current block
lldb.SBBlock.first_child => lldb.SBBlock for the first child block to the current block
lldb.SBBlock.call_site => for inline functions, return a lldb.declaration object that gives the call site file, line and column
lldb.SBBlock.name => for inline functions this is the name of the inline function that this block represents
lldb.SBBlock.inlined_block => returns the inlined function block that contains this block (might return itself if the current block is an inlined block)
lldb.SBBlock.range[int] => access the address ranges for a block by index, a list() with start and end address is returned
lldb.SBBlock.ranges => an array or all address ranges for this block
lldb.SBBlock.num_ranges => the number of address ranges for this blcok
SBFunction objects can now get the SBType and the SBBlock that represents the
top scope of the function.
SBBlock objects can now get the variable list from the current block. The value
list returned allows varaibles to be viewed prior with no process if code
wants to check the variables in a function. There are two ways to get a variable
list from a SBBlock:
lldb::SBValueList
SBBlock::GetVariables (lldb::SBFrame& frame,
bool arguments,
bool locals,
bool statics,
lldb::DynamicValueType use_dynamic);
lldb::SBValueList
SBBlock::GetVariables (lldb::SBTarget& target,
bool arguments,
bool locals,
bool statics);
When a SBFrame is used, the values returned will be locked down to the frame
and the values will be evaluated in the context of that frame.
When a SBTarget is used, global an static variables can be viewed without a
running process.
llvm-svn: 149853
2012-02-06 01:44:54 +00:00
|
|
|
m_symbol_contexts[idx].GetDescription(s, level, target);
|
|
|
|
|
}
|
|
|
|
|
|
2011-09-29 16:58:15 +00:00
|
|
|
bool lldb_private::operator==(const SymbolContextList &lhs,
|
|
|
|
|
const SymbolContextList &rhs) {
|
|
|
|
|
const uint32_t size = lhs.GetSize();
|
|
|
|
|
if (size != rhs.GetSize())
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
SymbolContext lhs_sc;
|
|
|
|
|
SymbolContext rhs_sc;
|
|
|
|
|
for (uint32_t i = 0; i < size; ++i) {
|
|
|
|
|
lhs.GetContextAtIndex(i, lhs_sc);
|
|
|
|
|
rhs.GetContextAtIndex(i, rhs_sc);
|
|
|
|
|
if (lhs_sc != rhs_sc)
|
Add a first pass at a "stop hook" mechanism. This allows you to add commands that get run every time the debugger stops, whether due to a breakpoint, the end of a step, interrupt, etc. You can also specify in which context you want the stop hook to run, for instance only on a particular thread, or only in a particular shared library, function, file, line range within a file.
Still need to add "in methods of a class" to the specifiers, and the ability to write the stop hooks in the Scripting language as well as in the Command Language.
llvm-svn: 127457
2011-03-11 03:53:59 +00:00
|
|
|
return false;
|
2016-09-06 20:57:50 +00:00
|
|
|
}
|
2011-09-29 16:58:15 +00:00
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool lldb_private::operator!=(const SymbolContextList &lhs,
|
2010-06-08 16:52:24 +00:00
|
|
|
const SymbolContextList &rhs) {
|
2011-04-23 02:04:55 +00:00
|
|
|
return !(lhs == rhs);
|
2016-09-06 20:57:50 +00:00
|
|
|
}
|