2010-06-09 00:52:24 +08:00
|
|
|
//===-- SBModule.cpp --------------------------------------------*- C++ -*-===//
|
|
|
|
//
|
2019-01-19 16:50:56 +08: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-09 00:52:24 +08:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#include "lldb/API/SBModule.h"
|
2019-03-06 08:06:00 +08:00
|
|
|
#include "SBReproducerPrivate.h"
|
2010-09-11 02:31:35 +08:00
|
|
|
#include "lldb/API/SBAddress.h"
|
|
|
|
#include "lldb/API/SBFileSpec.h"
|
Added a way to extract the module specifications from a file. A module specification is information that is required to describe a module (executable, shared library, object file, ect). This information includes host path, platform path (remote path), symbol file path, UUID, object name (for objects in .a files for example you could have an object name of "foo.o"), and target triple. Module specification can be used to create a module, or used to add a module to a target. A list of module specifications can be used to enumerate objects in container objects (like universal mach files and BSD archive files).
There are two new classes:
lldb::SBModuleSpec
lldb::SBModuleSpecList
The SBModuleSpec wraps up a lldb_private::ModuleSpec, and SBModuleSpecList wraps up a lldb_private::ModuleSpecList.
llvm-svn: 185877
2013-07-09 06:22:41 +08:00
|
|
|
#include "lldb/API/SBModuleSpec.h"
|
2012-02-05 10:38:54 +08:00
|
|
|
#include "lldb/API/SBProcess.h"
|
2010-09-20 13:20:02 +08:00
|
|
|
#include "lldb/API/SBStream.h"
|
2011-06-21 09:34:41 +08:00
|
|
|
#include "lldb/API/SBSymbolContextList.h"
|
2010-06-09 00:52:24 +08: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-30 05:13:06 +08:00
|
|
|
#include "lldb/Core/Section.h"
|
2011-06-30 06:09:02 +08:00
|
|
|
#include "lldb/Core/ValueObjectList.h"
|
|
|
|
#include "lldb/Core/ValueObjectVariable.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-30 05:13:06 +08:00
|
|
|
#include "lldb/Symbol/ObjectFile.h"
|
2016-02-11 05:28:13 +08:00
|
|
|
#include "lldb/Symbol/SymbolFile.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-30 05:13:06 +08:00
|
|
|
#include "lldb/Symbol/Symtab.h"
|
TypeSystem is now a plugin interface and removed any "ClangASTContext &Class::GetClangASTContext()" functions.
This cleans up type systems to be more pluggable. Prior to this we had issues:
- Module, SymbolFile, and many others has "ClangASTContext &GetClangASTContext()" functions. All have been switched over to use "TypeSystem *GetTypeSystemForLanguage()"
- Cleaned up any places that were using the GetClangASTContext() functions to use TypeSystem
- Cleaned up Module so that it no longer has dedicated type system member variables:
lldb::ClangASTContextUP m_ast; ///< The Clang AST context for this module.
lldb::GoASTContextUP m_go_ast; ///< The Go AST context for this module.
Now we have a type system map:
typedef std::map<lldb::LanguageType, lldb::TypeSystemSP> TypeSystemMap;
TypeSystemMap m_type_system_map; ///< A map of any type systems associated with this module
- Many places in code were using ClangASTContext static functions to place with CompilerType objects and add modifiers (const, volatile, restrict) and to make typedefs, L and R value references and more. These have been made into CompilerType functions that are abstract:
class CompilerType
{
...
//----------------------------------------------------------------------
// Return a new CompilerType that is a L value reference to this type if
// this type is valid and the type system supports L value references,
// else return an invalid type.
//----------------------------------------------------------------------
CompilerType
GetLValueReferenceType () const;
//----------------------------------------------------------------------
// Return a new CompilerType that is a R value reference to this type if
// this type is valid and the type system supports R value references,
// else return an invalid type.
//----------------------------------------------------------------------
CompilerType
GetRValueReferenceType () const;
//----------------------------------------------------------------------
// Return a new CompilerType adds a const modifier to this type if
// this type is valid and the type system supports const modifiers,
// else return an invalid type.
//----------------------------------------------------------------------
CompilerType
AddConstModifier () const;
//----------------------------------------------------------------------
// Return a new CompilerType adds a volatile modifier to this type if
// this type is valid and the type system supports volatile modifiers,
// else return an invalid type.
//----------------------------------------------------------------------
CompilerType
AddVolatileModifier () const;
//----------------------------------------------------------------------
// Return a new CompilerType adds a restrict modifier to this type if
// this type is valid and the type system supports restrict modifiers,
// else return an invalid type.
//----------------------------------------------------------------------
CompilerType
AddRestrictModifier () const;
//----------------------------------------------------------------------
// Create a typedef to this type using "name" as the name of the typedef
// this type is valid and the type system supports typedefs, else return
// an invalid type.
//----------------------------------------------------------------------
CompilerType
CreateTypedef (const char *name, const CompilerDeclContext &decl_ctx) const;
};
Other changes include:
- Removed "CompilerType TypeSystem::GetIntTypeFromBitSize(...)" and CompilerType TypeSystem::GetFloatTypeFromBitSize(...) and replaced it with "CompilerType TypeSystem::GetBuiltinTypeForEncodingAndBitSize(lldb::Encoding encoding, size_t bit_size);"
- Fixed code in Type.h to not request the full type for a type for no good reason, just request the forward type and let the type expand as needed
llvm-svn: 247953
2015-09-18 06:23:34 +08:00
|
|
|
#include "lldb/Symbol/TypeSystem.h"
|
2011-06-30 06:09:02 +08:00
|
|
|
#include "lldb/Symbol/VariableList.h"
|
|
|
|
#include "lldb/Target/Target.h"
|
2017-02-03 05:39:50 +08:00
|
|
|
#include "lldb/Utility/StreamString.h"
|
2010-06-09 00:52:24 +08:00
|
|
|
|
|
|
|
using namespace lldb;
|
2010-10-26 11:11:13 +08:00
|
|
|
using namespace lldb_private;
|
2010-06-09 00:52:24 +08:00
|
|
|
|
2019-03-06 08:06:00 +08:00
|
|
|
SBModule::SBModule() : m_opaque_sp() {
|
|
|
|
LLDB_RECORD_CONSTRUCTOR_NO_ARGS(SBModule);
|
|
|
|
}
|
2010-06-09 00:52:24 +08:00
|
|
|
|
|
|
|
SBModule::SBModule(const lldb::ModuleSP &module_sp) : m_opaque_sp(module_sp) {}
|
|
|
|
|
Added a way to extract the module specifications from a file. A module specification is information that is required to describe a module (executable, shared library, object file, ect). This information includes host path, platform path (remote path), symbol file path, UUID, object name (for objects in .a files for example you could have an object name of "foo.o"), and target triple. Module specification can be used to create a module, or used to add a module to a target. A list of module specifications can be used to enumerate objects in container objects (like universal mach files and BSD archive files).
There are two new classes:
lldb::SBModuleSpec
lldb::SBModuleSpecList
The SBModuleSpec wraps up a lldb_private::ModuleSpec, and SBModuleSpecList wraps up a lldb_private::ModuleSpecList.
llvm-svn: 185877
2013-07-09 06:22:41 +08:00
|
|
|
SBModule::SBModule(const SBModuleSpec &module_spec) : m_opaque_sp() {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_CONSTRUCTOR(SBModule, (const lldb::SBModuleSpec &), module_spec);
|
|
|
|
|
Added a way to extract the module specifications from a file. A module specification is information that is required to describe a module (executable, shared library, object file, ect). This information includes host path, platform path (remote path), symbol file path, UUID, object name (for objects in .a files for example you could have an object name of "foo.o"), and target triple. Module specification can be used to create a module, or used to add a module to a target. A list of module specifications can be used to enumerate objects in container objects (like universal mach files and BSD archive files).
There are two new classes:
lldb::SBModuleSpec
lldb::SBModuleSpecList
The SBModuleSpec wraps up a lldb_private::ModuleSpec, and SBModuleSpecList wraps up a lldb_private::ModuleSpecList.
llvm-svn: 185877
2013-07-09 06:22:41 +08:00
|
|
|
ModuleSP module_sp;
|
[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 19:14:47 +08:00
|
|
|
Status error = ModuleList::GetSharedModule(
|
|
|
|
*module_spec.m_opaque_up, module_sp, nullptr, nullptr, nullptr);
|
Added a way to extract the module specifications from a file. A module specification is information that is required to describe a module (executable, shared library, object file, ect). This information includes host path, platform path (remote path), symbol file path, UUID, object name (for objects in .a files for example you could have an object name of "foo.o"), and target triple. Module specification can be used to create a module, or used to add a module to a target. A list of module specifications can be used to enumerate objects in container objects (like universal mach files and BSD archive files).
There are two new classes:
lldb::SBModuleSpec
lldb::SBModuleSpecList
The SBModuleSpec wraps up a lldb_private::ModuleSpec, and SBModuleSpecList wraps up a lldb_private::ModuleSpecList.
llvm-svn: 185877
2013-07-09 06:22:41 +08:00
|
|
|
if (module_sp)
|
|
|
|
SetSP(module_sp);
|
|
|
|
}
|
|
|
|
|
2019-03-06 08:06:00 +08:00
|
|
|
SBModule::SBModule(const SBModule &rhs) : m_opaque_sp(rhs.m_opaque_sp) {
|
|
|
|
LLDB_RECORD_CONSTRUCTOR(SBModule, (const lldb::SBModule &), rhs);
|
|
|
|
}
|
2010-11-06 07:17:00 +08:00
|
|
|
|
2012-02-05 10:38:54 +08:00
|
|
|
SBModule::SBModule(lldb::SBProcess &process, lldb::addr_t header_addr)
|
|
|
|
: m_opaque_sp() {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_CONSTRUCTOR(SBModule, (lldb::SBProcess &, lldb::addr_t), process,
|
|
|
|
header_addr);
|
|
|
|
|
2012-02-05 10:38:54 +08:00
|
|
|
ProcessSP process_sp(process.GetSP());
|
|
|
|
if (process_sp) {
|
2013-02-02 05:38:35 +08:00
|
|
|
m_opaque_sp = process_sp->ReadModuleFromMemory(FileSpec(), header_addr);
|
|
|
|
if (m_opaque_sp) {
|
|
|
|
Target &target = process_sp->GetTarget();
|
|
|
|
bool changed = false;
|
2014-02-08 06:54:47 +08:00
|
|
|
m_opaque_sp->SetLoadAddress(target, 0, true, changed);
|
2013-02-02 05:38:35 +08:00
|
|
|
target.GetImages().Append(m_opaque_sp);
|
2012-02-14 07:10:39 +08:00
|
|
|
}
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
2012-02-05 10:38:54 +08:00
|
|
|
}
|
|
|
|
|
2010-11-06 07:17:00 +08:00
|
|
|
const SBModule &SBModule::operator=(const SBModule &rhs) {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD(const lldb::SBModule &,
|
|
|
|
SBModule, operator=,(const lldb::SBModule &), rhs);
|
|
|
|
|
2010-11-06 07:17:00 +08:00
|
|
|
if (this != &rhs)
|
|
|
|
m_opaque_sp = rhs.m_opaque_sp;
|
2019-04-04 05:31:22 +08:00
|
|
|
return LLDB_RECORD_RESULT(*this);
|
2010-11-06 07:17:00 +08:00
|
|
|
}
|
|
|
|
|
2010-06-09 00:52:24 +08:00
|
|
|
SBModule::~SBModule() {}
|
|
|
|
|
2019-03-06 08:06:00 +08:00
|
|
|
bool SBModule::IsValid() const {
|
|
|
|
LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBModule, IsValid);
|
Add "operator bool" to SB APIs
Summary:
Our python version of the SB API has (the python equivalent of)
operator bool, but the C++ version doesn't.
This is because our python operators are added by modify-python-lldb.py,
which performs postprocessing on the swig-generated interface files.
In this patch, I add the "operator bool" to all SB classes which have an
IsValid method (which is the same logic used by modify-python-lldb.py).
This way, we make the two interfaces more constent, and it allows us to
rely on swig's automatic syntesis of python __nonzero__ methods instead
of doing manual fixups.
Reviewers: zturner, jingham, clayborg, jfb, serge-sans-paille
Subscribers: jdoerfert, lldb-commits
Differential Revision: https://reviews.llvm.org/D58792
llvm-svn: 355824
2019-03-11 21:58:46 +08:00
|
|
|
return this->operator bool();
|
|
|
|
}
|
|
|
|
SBModule::operator bool() const {
|
|
|
|
LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBModule, operator bool);
|
2019-03-06 08:06:00 +08:00
|
|
|
|
[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 19:14:47 +08:00
|
|
|
return m_opaque_sp.get() != nullptr;
|
2019-03-06 08:06:00 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void SBModule::Clear() {
|
|
|
|
LLDB_RECORD_METHOD_NO_ARGS(void, SBModule, Clear);
|
2010-06-09 00:52:24 +08:00
|
|
|
|
2019-03-06 08:06:00 +08:00
|
|
|
m_opaque_sp.reset();
|
|
|
|
}
|
2011-12-20 04:39:44 +08:00
|
|
|
|
2010-06-09 00:52:24 +08:00
|
|
|
SBFileSpec SBModule::GetFileSpec() const {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD_CONST_NO_ARGS(lldb::SBFileSpec, SBModule, GetFileSpec);
|
|
|
|
|
2010-06-09 00:52:24 +08:00
|
|
|
SBFileSpec file_spec;
|
2012-02-23 03:41:02 +08:00
|
|
|
ModuleSP module_sp(GetSP());
|
|
|
|
if (module_sp)
|
|
|
|
file_spec.SetFileSpec(module_sp->GetFileSpec());
|
2010-10-26 11:11:13 +08:00
|
|
|
|
2019-03-06 08:06:00 +08:00
|
|
|
return LLDB_RECORD_RESULT(file_spec);
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
|
|
|
|
2011-04-30 09:09:13 +08:00
|
|
|
lldb::SBFileSpec SBModule::GetPlatformFileSpec() const {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD_CONST_NO_ARGS(lldb::SBFileSpec, SBModule,
|
|
|
|
GetPlatformFileSpec);
|
|
|
|
|
2014-04-04 12:06:10 +08:00
|
|
|
|
2011-04-30 09:09:13 +08:00
|
|
|
SBFileSpec file_spec;
|
2012-02-23 03:41:02 +08:00
|
|
|
ModuleSP module_sp(GetSP());
|
|
|
|
if (module_sp)
|
|
|
|
file_spec.SetFileSpec(module_sp->GetPlatformFileSpec());
|
2014-04-04 12:06:10 +08:00
|
|
|
|
2019-03-06 08:06:00 +08:00
|
|
|
return LLDB_RECORD_RESULT(file_spec);
|
2011-04-30 09:09:13 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
bool SBModule::SetPlatformFileSpec(const lldb::SBFileSpec &platform_file) {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD(bool, SBModule, SetPlatformFileSpec,
|
|
|
|
(const lldb::SBFileSpec &), platform_file);
|
|
|
|
|
2011-04-30 09:09:13 +08:00
|
|
|
bool result = false;
|
2014-04-04 12:06:10 +08:00
|
|
|
|
2012-02-23 03:41:02 +08:00
|
|
|
ModuleSP module_sp(GetSP());
|
|
|
|
if (module_sp) {
|
|
|
|
module_sp->SetPlatformFileSpec(*platform_file);
|
2011-04-30 09:09:13 +08:00
|
|
|
result = true;
|
|
|
|
}
|
2014-04-04 12:06:10 +08:00
|
|
|
|
2013-11-21 05:07:01 +08:00
|
|
|
return result;
|
|
|
|
}
|
2011-04-30 09:09:13 +08:00
|
|
|
|
2010-06-09 00:52:24 +08:00
|
|
|
lldb::SBFileSpec SBModule::GetRemoteInstallFileSpec() {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD_NO_ARGS(lldb::SBFileSpec, SBModule,
|
|
|
|
GetRemoteInstallFileSpec);
|
|
|
|
|
2013-03-28 07:08:40 +08:00
|
|
|
SBFileSpec sb_file_spec;
|
2012-02-23 03:41:02 +08:00
|
|
|
ModuleSP module_sp(GetSP());
|
|
|
|
if (module_sp)
|
|
|
|
sb_file_spec.SetFileSpec(module_sp->GetRemoteInstallFileSpec());
|
2019-03-06 08:06:00 +08:00
|
|
|
return LLDB_RECORD_RESULT(sb_file_spec);
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
|
|
|
|
2013-11-21 05:07:01 +08:00
|
|
|
bool SBModule::SetRemoteInstallFileSpec(lldb::SBFileSpec &file) {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD(bool, SBModule, SetRemoteInstallFileSpec,
|
|
|
|
(lldb::SBFileSpec &), file);
|
|
|
|
|
Add =shlibs-added/=shlibs-removed notifications (MI)
Summary:
This patch adds =shlibs-added/=shlibs-removed notifications in lldb-mi. In more detail:
# Add Target::ModulesDidLoad/ModulesDidUnload notifications
# Improve Target::TargetEventData:
## Refactoring
## Move it back to include/lldb/Target/Target.h
## Add Target::{GetModuleListFromEvent,GetModuleList}; Add Target::m_module_list
# Add SBModule::{GetSymbolVendorMainFileSpec,GetObjectFileHeaderAddress}
# Add SBTarget::{EventIsTaretEvent,GetTargetFromEvent,GetNumModulesFromEvent,GetModuleAtIndexFromEvent}
All tests pass on OS X.
Reviewers: abidh, zturner, jingham, clayborg
Reviewed By: clayborg
Subscribers: jingham, zturner, lldb-commits, clayborg, abidh
Differential Revision: http://reviews.llvm.org/D8201
llvm-svn: 231858
2015-03-11 05:59:55 +08:00
|
|
|
ModuleSP module_sp(GetSP());
|
2013-11-21 05:07:01 +08:00
|
|
|
if (module_sp) {
|
2011-04-01 08:35:55 +08:00
|
|
|
module_sp->SetRemoteInstallFileSpec(file.ref());
|
|
|
|
return true;
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
2013-11-21 05:07:01 +08:00
|
|
|
return false;
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
|
|
|
|
2011-04-01 08:35:55 +08:00
|
|
|
const uint8_t *SBModule::GetUUIDBytes() const {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD_CONST_NO_ARGS(const uint8_t *, SBModule, GetUUIDBytes);
|
|
|
|
|
[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 19:14:47 +08:00
|
|
|
const uint8_t *uuid_bytes = nullptr;
|
2012-02-23 03:41:02 +08:00
|
|
|
ModuleSP module_sp(GetSP());
|
|
|
|
if (module_sp)
|
2018-06-21 23:07:43 +08:00
|
|
|
uuid_bytes = module_sp->GetUUID().GetBytes().data();
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2015-02-12 03:16:38 +08:00
|
|
|
return uuid_bytes;
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
|
|
|
|
2011-06-30 06:09:02 +08:00
|
|
|
const char *SBModule::GetUUIDString() const {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD_CONST_NO_ARGS(const char *, SBModule, GetUUIDString);
|
|
|
|
|
[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 19:14:47 +08:00
|
|
|
const char *uuid_cstr = nullptr;
|
Add =shlibs-added/=shlibs-removed notifications (MI)
Summary:
This patch adds =shlibs-added/=shlibs-removed notifications in lldb-mi. In more detail:
# Add Target::ModulesDidLoad/ModulesDidUnload notifications
# Improve Target::TargetEventData:
## Refactoring
## Move it back to include/lldb/Target/Target.h
## Add Target::{GetModuleListFromEvent,GetModuleList}; Add Target::m_module_list
# Add SBModule::{GetSymbolVendorMainFileSpec,GetObjectFileHeaderAddress}
# Add SBTarget::{EventIsTaretEvent,GetTargetFromEvent,GetNumModulesFromEvent,GetModuleAtIndexFromEvent}
All tests pass on OS X.
Reviewers: abidh, zturner, jingham, clayborg
Reviewed By: clayborg
Subscribers: jingham, zturner, lldb-commits, clayborg, abidh
Differential Revision: http://reviews.llvm.org/D8201
llvm-svn: 231858
2015-03-11 05:59:55 +08:00
|
|
|
ModuleSP module_sp(GetSP());
|
2013-11-21 05:07:01 +08:00
|
|
|
if (module_sp) {
|
2018-05-01 00:49:04 +08:00
|
|
|
// We are going to return a "const char *" value through the public API, so
|
|
|
|
// we need to constify it so it gets added permanently the string pool and
|
|
|
|
// then we don't need to worry about the lifetime of the string as it will
|
|
|
|
// never go away once it has been put into the ConstString string pool
|
2015-02-12 03:16:38 +08:00
|
|
|
uuid_cstr = ConstString(module_sp->GetUUID().GetAsString()).GetCString();
|
2013-05-04 07:56:12 +08:00
|
|
|
}
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2015-02-12 03:16:38 +08:00
|
|
|
if (uuid_cstr && uuid_cstr[0]) {
|
|
|
|
return uuid_cstr;
|
2011-04-01 08:35:55 +08:00
|
|
|
}
|
|
|
|
|
[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 19:14:47 +08:00
|
|
|
return nullptr;
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
bool SBModule::operator==(const SBModule &rhs) const {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD_CONST(bool, SBModule, operator==,(const lldb::SBModule &),
|
|
|
|
rhs);
|
|
|
|
|
2010-06-23 09:19:29 +08:00
|
|
|
if (m_opaque_sp)
|
|
|
|
return m_opaque_sp.get() == rhs.m_opaque_sp.get();
|
2010-06-09 00:52:24 +08:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2012-01-30 17:04:36 +08:00
|
|
|
bool SBModule::operator!=(const SBModule &rhs) const {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD_CONST(bool, SBModule, operator!=,(const lldb::SBModule &),
|
|
|
|
rhs);
|
|
|
|
|
2012-01-30 17:04:36 +08:00
|
|
|
if (m_opaque_sp)
|
2011-09-24 08:52:29 +08:00
|
|
|
return m_opaque_sp.get() != rhs.m_opaque_sp.get();
|
2013-11-21 05:07:01 +08:00
|
|
|
return false;
|
2011-09-24 08:52:29 +08:00
|
|
|
}
|
2010-06-09 00:52:24 +08:00
|
|
|
|
2012-01-30 17:04:36 +08:00
|
|
|
ModuleSP SBModule::GetSP() const { return m_opaque_sp; }
|
2010-06-09 00:52:24 +08:00
|
|
|
|
2011-09-24 08:52:29 +08:00
|
|
|
void SBModule::SetSP(const ModuleSP &module_sp) { m_opaque_sp = module_sp; }
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2011-09-24 08:52:29 +08:00
|
|
|
SBAddress SBModule::ResolveFileAddress(lldb::addr_t vm_addr) {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD(lldb::SBAddress, SBModule, ResolveFileAddress,
|
|
|
|
(lldb::addr_t), vm_addr);
|
|
|
|
|
2011-09-24 08:52:29 +08:00
|
|
|
lldb::SBAddress sb_addr;
|
2012-02-23 03:41:02 +08:00
|
|
|
ModuleSP module_sp(GetSP());
|
|
|
|
if (module_sp) {
|
2011-09-24 08:52:29 +08:00
|
|
|
Address addr;
|
2012-02-23 03:41:02 +08:00
|
|
|
if (module_sp->ResolveFileAddress(vm_addr, addr))
|
2011-09-24 08:52:29 +08:00
|
|
|
sb_addr.ref() = addr;
|
|
|
|
}
|
2019-03-06 08:06:00 +08:00
|
|
|
return LLDB_RECORD_RESULT(sb_addr);
|
2010-09-11 02:31:35 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
SBSymbolContext
|
|
|
|
SBModule::ResolveSymbolContextForAddress(const SBAddress &addr,
|
|
|
|
uint32_t resolve_scope) {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD(lldb::SBSymbolContext, SBModule,
|
|
|
|
ResolveSymbolContextForAddress,
|
|
|
|
(const lldb::SBAddress &, uint32_t), addr, resolve_scope);
|
|
|
|
|
2010-09-11 02:31:35 +08:00
|
|
|
SBSymbolContext sb_sc;
|
2012-02-23 03:41:02 +08:00
|
|
|
ModuleSP module_sp(GetSP());
|
2018-10-26 04:45:19 +08:00
|
|
|
SymbolContextItem scope = static_cast<SymbolContextItem>(resolve_scope);
|
2012-02-23 03:41:02 +08:00
|
|
|
if (module_sp && addr.IsValid())
|
2018-10-26 04:45:19 +08:00
|
|
|
module_sp->ResolveSymbolContextForAddress(addr.ref(), scope, *sb_sc);
|
2019-03-06 08:06:00 +08:00
|
|
|
return LLDB_RECORD_RESULT(sb_sc);
|
2010-09-11 02:31:35 +08:00
|
|
|
}
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2010-09-20 13:20:02 +08:00
|
|
|
bool SBModule::GetDescription(SBStream &description) {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD(bool, SBModule, GetDescription, (lldb::SBStream &),
|
|
|
|
description);
|
|
|
|
|
2011-11-13 14:57:31 +08:00
|
|
|
Stream &strm = description.ref();
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2012-02-23 03:41:02 +08:00
|
|
|
ModuleSP module_sp(GetSP());
|
|
|
|
if (module_sp) {
|
2019-12-04 16:20:42 +08:00
|
|
|
module_sp->GetDescription(strm.AsRawOstream());
|
2016-09-07 04:57:50 +08:00
|
|
|
} else
|
2012-02-23 03:41:02 +08:00
|
|
|
strm.PutCString("No value");
|
2016-09-07 04:57:50 +08:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2012-03-17 04:46:10 +08:00
|
|
|
uint32_t SBModule::GetNumCompileUnits() {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD_NO_ARGS(uint32_t, SBModule, GetNumCompileUnits);
|
|
|
|
|
2012-02-23 03:41:02 +08:00
|
|
|
ModuleSP module_sp(GetSP());
|
|
|
|
if (module_sp) {
|
|
|
|
return module_sp->GetNumCompileUnits();
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
2012-03-17 04:46:10 +08:00
|
|
|
return 0;
|
2010-09-20 13:20:02 +08:00
|
|
|
}
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2011-11-13 14:57:31 +08:00
|
|
|
SBCompileUnit SBModule::GetCompileUnitAtIndex(uint32_t index) {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD(lldb::SBCompileUnit, SBModule, GetCompileUnitAtIndex,
|
|
|
|
(uint32_t), index);
|
|
|
|
|
2012-03-17 04:46:10 +08:00
|
|
|
SBCompileUnit sb_cu;
|
Add =shlibs-added/=shlibs-removed notifications (MI)
Summary:
This patch adds =shlibs-added/=shlibs-removed notifications in lldb-mi. In more detail:
# Add Target::ModulesDidLoad/ModulesDidUnload notifications
# Improve Target::TargetEventData:
## Refactoring
## Move it back to include/lldb/Target/Target.h
## Add Target::{GetModuleListFromEvent,GetModuleList}; Add Target::m_module_list
# Add SBModule::{GetSymbolVendorMainFileSpec,GetObjectFileHeaderAddress}
# Add SBTarget::{EventIsTaretEvent,GetTargetFromEvent,GetNumModulesFromEvent,GetModuleAtIndexFromEvent}
All tests pass on OS X.
Reviewers: abidh, zturner, jingham, clayborg
Reviewed By: clayborg
Subscribers: jingham, zturner, lldb-commits, clayborg, abidh
Differential Revision: http://reviews.llvm.org/D8201
llvm-svn: 231858
2015-03-11 05:59:55 +08:00
|
|
|
ModuleSP module_sp(GetSP());
|
2011-11-13 14:57:31 +08:00
|
|
|
if (module_sp) {
|
|
|
|
CompUnitSP cu_sp = module_sp->GetCompileUnitAtIndex(index);
|
2012-03-17 04:46:10 +08:00
|
|
|
sb_cu.reset(cu_sp.get());
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
2019-03-06 08:06:00 +08:00
|
|
|
return LLDB_RECORD_RESULT(sb_cu);
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
|
|
|
|
2019-03-06 08:06:00 +08:00
|
|
|
SBSymbolContextList SBModule::FindCompileUnits(const SBFileSpec &sb_file_spec) {
|
|
|
|
LLDB_RECORD_METHOD(lldb::SBSymbolContextList, SBModule, FindCompileUnits,
|
|
|
|
(const lldb::SBFileSpec &), sb_file_spec);
|
|
|
|
|
2018-07-03 22:22:44 +08:00
|
|
|
SBSymbolContextList sb_sc_list;
|
|
|
|
const ModuleSP module_sp(GetSP());
|
|
|
|
if (sb_file_spec.IsValid() && module_sp) {
|
2019-10-18 03:56:40 +08:00
|
|
|
module_sp->FindCompileUnits(*sb_file_spec, *sb_sc_list);
|
2018-07-03 22:22:44 +08:00
|
|
|
}
|
2019-03-06 08:06:00 +08:00
|
|
|
return LLDB_RECORD_RESULT(sb_sc_list);
|
2018-07-03 22:22:44 +08:00
|
|
|
}
|
|
|
|
|
2011-11-13 14:57:31 +08:00
|
|
|
static Symtab *GetUnifiedSymbolTable(const lldb::ModuleSP &module_sp) {
|
2019-08-05 17:21:47 +08:00
|
|
|
if (module_sp)
|
|
|
|
return module_sp->GetSymtab();
|
[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 19:14:47 +08:00
|
|
|
return nullptr;
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
|
|
|
|
2010-12-07 13:40:31 +08:00
|
|
|
size_t SBModule::GetNumSymbols() {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD_NO_ARGS(size_t, SBModule, GetNumSymbols);
|
|
|
|
|
Add =shlibs-added/=shlibs-removed notifications (MI)
Summary:
This patch adds =shlibs-added/=shlibs-removed notifications in lldb-mi. In more detail:
# Add Target::ModulesDidLoad/ModulesDidUnload notifications
# Improve Target::TargetEventData:
## Refactoring
## Move it back to include/lldb/Target/Target.h
## Add Target::{GetModuleListFromEvent,GetModuleList}; Add Target::m_module_list
# Add SBModule::{GetSymbolVendorMainFileSpec,GetObjectFileHeaderAddress}
# Add SBTarget::{EventIsTaretEvent,GetTargetFromEvent,GetNumModulesFromEvent,GetModuleAtIndexFromEvent}
All tests pass on OS X.
Reviewers: abidh, zturner, jingham, clayborg
Reviewed By: clayborg
Subscribers: jingham, zturner, lldb-commits, clayborg, abidh
Differential Revision: http://reviews.llvm.org/D8201
llvm-svn: 231858
2015-03-11 05:59:55 +08:00
|
|
|
ModuleSP module_sp(GetSP());
|
2019-08-05 17:21:47 +08:00
|
|
|
if (Symtab *symtab = GetUnifiedSymbolTable(module_sp))
|
|
|
|
return symtab->GetNumSymbols();
|
2010-09-20 13:20:02 +08:00
|
|
|
return 0;
|
|
|
|
}
|
2010-12-07 13:40:31 +08:00
|
|
|
|
2012-03-17 04:46:10 +08:00
|
|
|
SBSymbol SBModule::GetSymbolAtIndex(size_t idx) {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD(lldb::SBSymbol, SBModule, GetSymbolAtIndex, (size_t), idx);
|
|
|
|
|
2010-12-07 13:40:31 +08:00
|
|
|
SBSymbol sb_symbol;
|
2012-03-17 04:46:10 +08:00
|
|
|
ModuleSP module_sp(GetSP());
|
|
|
|
Symtab *symtab = GetUnifiedSymbolTable(module_sp);
|
|
|
|
if (symtab)
|
|
|
|
sb_symbol.SetSymbol(symtab->SymbolAtIndex(idx));
|
2019-03-06 08:06:00 +08:00
|
|
|
return LLDB_RECORD_RESULT(sb_symbol);
|
2012-03-17 04:46:10 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
lldb::SBSymbol SBModule::FindSymbol(const char *name,
|
|
|
|
lldb::SymbolType symbol_type) {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD(lldb::SBSymbol, SBModule, FindSymbol,
|
|
|
|
(const char *, lldb::SymbolType), name, symbol_type);
|
|
|
|
|
2012-03-17 04:46:10 +08:00
|
|
|
SBSymbol sb_symbol;
|
|
|
|
if (name && name[0]) {
|
|
|
|
ModuleSP module_sp(GetSP());
|
|
|
|
Symtab *symtab = GetUnifiedSymbolTable(module_sp);
|
|
|
|
if (symtab)
|
|
|
|
sb_symbol.SetSymbol(symtab->FindFirstSymbolWithNameAndType(
|
|
|
|
ConstString(name), symbol_type, Symtab::eDebugAny,
|
|
|
|
Symtab::eVisibilityAny));
|
|
|
|
}
|
2019-03-06 08:06:00 +08:00
|
|
|
return LLDB_RECORD_RESULT(sb_symbol);
|
2012-03-17 04:46:10 +08:00
|
|
|
}
|
|
|
|
|
2013-07-02 03:45:50 +08:00
|
|
|
lldb::SBSymbolContextList SBModule::FindSymbols(const char *name,
|
2012-12-04 10:22:16 +08:00
|
|
|
lldb::SymbolType symbol_type) {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD(lldb::SBSymbolContextList, SBModule, FindSymbols,
|
|
|
|
(const char *, lldb::SymbolType), name, symbol_type);
|
|
|
|
|
2012-12-04 10:22:16 +08:00
|
|
|
SBSymbolContextList sb_sc_list;
|
2013-07-02 03:45:50 +08:00
|
|
|
if (name && name[0]) {
|
|
|
|
ModuleSP module_sp(GetSP());
|
|
|
|
Symtab *symtab = GetUnifiedSymbolTable(module_sp);
|
|
|
|
if (symtab) {
|
|
|
|
std::vector<uint32_t> matching_symbol_indexes;
|
2019-10-18 03:56:40 +08:00
|
|
|
symtab->FindAllSymbolsWithNameAndType(ConstString(name), symbol_type,
|
|
|
|
matching_symbol_indexes);
|
|
|
|
const size_t num_matches = matching_symbol_indexes.size();
|
2013-07-02 03:45:50 +08:00
|
|
|
if (num_matches) {
|
|
|
|
SymbolContext sc;
|
|
|
|
sc.module_sp = module_sp;
|
|
|
|
SymbolContextList &sc_list = *sb_sc_list;
|
|
|
|
for (size_t i = 0; i < num_matches; ++i) {
|
|
|
|
sc.symbol = symtab->SymbolAtIndex(matching_symbol_indexes[i]);
|
|
|
|
if (sc.symbol)
|
|
|
|
sc_list.Append(sc);
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
|
|
|
}
|
2013-07-02 03:45:50 +08:00
|
|
|
}
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
2019-03-06 08:06:00 +08:00
|
|
|
return LLDB_RECORD_RESULT(sb_sc_list);
|
2013-07-02 03:45:50 +08:00
|
|
|
}
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2010-12-07 13:40:31 +08:00
|
|
|
size_t SBModule::GetNumSections() {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD_NO_ARGS(size_t, SBModule, GetNumSections);
|
|
|
|
|
Add =shlibs-added/=shlibs-removed notifications (MI)
Summary:
This patch adds =shlibs-added/=shlibs-removed notifications in lldb-mi. In more detail:
# Add Target::ModulesDidLoad/ModulesDidUnload notifications
# Improve Target::TargetEventData:
## Refactoring
## Move it back to include/lldb/Target/Target.h
## Add Target::{GetModuleListFromEvent,GetModuleList}; Add Target::m_module_list
# Add SBModule::{GetSymbolVendorMainFileSpec,GetObjectFileHeaderAddress}
# Add SBTarget::{EventIsTaretEvent,GetTargetFromEvent,GetNumModulesFromEvent,GetModuleAtIndexFromEvent}
All tests pass on OS X.
Reviewers: abidh, zturner, jingham, clayborg
Reviewed By: clayborg
Subscribers: jingham, zturner, lldb-commits, clayborg, abidh
Differential Revision: http://reviews.llvm.org/D8201
llvm-svn: 231858
2015-03-11 05:59:55 +08:00
|
|
|
ModuleSP module_sp(GetSP());
|
2012-03-17 04:46:10 +08:00
|
|
|
if (module_sp) {
|
2013-07-02 03:45:50 +08:00
|
|
|
// Give the symbol vendor a chance to add to the unified section list.
|
2019-08-06 17:12:42 +08:00
|
|
|
module_sp->GetSymbolFile();
|
2013-07-10 09:23:25 +08:00
|
|
|
SectionList *section_list = module_sp->GetSectionList();
|
2013-07-02 03:45:50 +08:00
|
|
|
if (section_list)
|
|
|
|
return section_list->GetSize();
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
2010-12-07 13:40:31 +08:00
|
|
|
return 0;
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
|
|
|
|
2011-09-24 08:52:29 +08:00
|
|
|
SBSection SBModule::GetSectionAtIndex(size_t idx) {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD(lldb::SBSection, SBModule, GetSectionAtIndex, (size_t),
|
|
|
|
idx);
|
|
|
|
|
2011-09-24 08:52:29 +08:00
|
|
|
SBSection sb_section;
|
Add =shlibs-added/=shlibs-removed notifications (MI)
Summary:
This patch adds =shlibs-added/=shlibs-removed notifications in lldb-mi. In more detail:
# Add Target::ModulesDidLoad/ModulesDidUnload notifications
# Improve Target::TargetEventData:
## Refactoring
## Move it back to include/lldb/Target/Target.h
## Add Target::{GetModuleListFromEvent,GetModuleList}; Add Target::m_module_list
# Add SBModule::{GetSymbolVendorMainFileSpec,GetObjectFileHeaderAddress}
# Add SBTarget::{EventIsTaretEvent,GetTargetFromEvent,GetNumModulesFromEvent,GetModuleAtIndexFromEvent}
All tests pass on OS X.
Reviewers: abidh, zturner, jingham, clayborg
Reviewed By: clayborg
Subscribers: jingham, zturner, lldb-commits, clayborg, abidh
Differential Revision: http://reviews.llvm.org/D8201
llvm-svn: 231858
2015-03-11 05:59:55 +08:00
|
|
|
ModuleSP module_sp(GetSP());
|
2010-12-07 13:40:31 +08:00
|
|
|
if (module_sp) {
|
2013-07-02 03:45:50 +08:00
|
|
|
// Give the symbol vendor a chance to add to the unified section list.
|
2019-08-06 17:12:42 +08:00
|
|
|
module_sp->GetSymbolFile();
|
2013-07-10 09:23:25 +08:00
|
|
|
SectionList *section_list = module_sp->GetSectionList();
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2013-07-02 03:45:50 +08:00
|
|
|
if (section_list)
|
|
|
|
sb_section.SetSP(section_list->GetSectionAtIndex(idx));
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
2019-03-06 08:06:00 +08:00
|
|
|
return LLDB_RECORD_RESULT(sb_section);
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
|
|
|
|
2012-12-04 10:22:16 +08:00
|
|
|
lldb::SBSymbolContextList SBModule::FindFunctions(const char *name,
|
2010-12-07 13:40:31 +08:00
|
|
|
uint32_t name_type_mask) {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD(lldb::SBSymbolContextList, SBModule, FindFunctions,
|
|
|
|
(const char *, uint32_t), name, name_type_mask);
|
|
|
|
|
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 09:44:54 +08:00
|
|
|
lldb::SBSymbolContextList sb_sc_list;
|
2012-02-23 03:41:02 +08:00
|
|
|
ModuleSP module_sp(GetSP());
|
|
|
|
if (name && module_sp) {
|
2013-07-02 03:45:50 +08:00
|
|
|
const bool symbols_ok = true;
|
2012-02-11 06:52:19 +08:00
|
|
|
const bool inlines_ok = true;
|
2018-10-26 04:45:40 +08:00
|
|
|
FunctionNameType type = static_cast<FunctionNameType>(name_type_mask);
|
[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 19:14:47 +08:00
|
|
|
module_sp->FindFunctions(ConstString(name), nullptr, type, symbols_ok,
|
2019-10-18 03:56:40 +08:00
|
|
|
inlines_ok, *sb_sc_list);
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
2019-03-06 08:06:00 +08:00
|
|
|
return LLDB_RECORD_RESULT(sb_sc_list);
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
|
|
|
|
2013-07-02 03:45:50 +08:00
|
|
|
SBValueList SBModule::FindGlobalVariables(SBTarget &target, const char *name,
|
2011-06-30 06:09:02 +08:00
|
|
|
uint32_t max_matches) {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD(lldb::SBValueList, SBModule, FindGlobalVariables,
|
|
|
|
(lldb::SBTarget &, const char *, uint32_t), target, name,
|
|
|
|
max_matches);
|
|
|
|
|
2011-06-30 06:09:02 +08:00
|
|
|
SBValueList sb_value_list;
|
Add =shlibs-added/=shlibs-removed notifications (MI)
Summary:
This patch adds =shlibs-added/=shlibs-removed notifications in lldb-mi. In more detail:
# Add Target::ModulesDidLoad/ModulesDidUnload notifications
# Improve Target::TargetEventData:
## Refactoring
## Move it back to include/lldb/Target/Target.h
## Add Target::{GetModuleListFromEvent,GetModuleList}; Add Target::m_module_list
# Add SBModule::{GetSymbolVendorMainFileSpec,GetObjectFileHeaderAddress}
# Add SBTarget::{EventIsTaretEvent,GetTargetFromEvent,GetNumModulesFromEvent,GetModuleAtIndexFromEvent}
All tests pass on OS X.
Reviewers: abidh, zturner, jingham, clayborg
Reviewed By: clayborg
Subscribers: jingham, zturner, lldb-commits, clayborg, abidh
Differential Revision: http://reviews.llvm.org/D8201
llvm-svn: 231858
2015-03-11 05:59:55 +08:00
|
|
|
ModuleSP module_sp(GetSP());
|
2013-07-02 03:45:50 +08:00
|
|
|
if (name && module_sp) {
|
|
|
|
VariableList variable_list;
|
2019-10-18 03:56:40 +08:00
|
|
|
module_sp->FindGlobalVariables(ConstString(name), nullptr, max_matches,
|
|
|
|
variable_list);
|
2019-11-25 22:03:46 +08:00
|
|
|
for (const VariableSP &var_sp : variable_list) {
|
|
|
|
lldb::ValueObjectSP valobj_sp;
|
|
|
|
TargetSP target_sp(target.GetSP());
|
|
|
|
valobj_sp = ValueObjectVariable::Create(target_sp.get(), var_sp);
|
|
|
|
if (valobj_sp)
|
|
|
|
sb_value_list.Append(SBValue(valobj_sp));
|
2010-12-07 13:40:31 +08:00
|
|
|
}
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
|
|
|
|
2019-03-06 08:06:00 +08:00
|
|
|
return LLDB_RECORD_RESULT(sb_value_list);
|
2010-12-07 13:40:31 +08:00
|
|
|
}
|
|
|
|
|
2013-07-02 03:45:50 +08:00
|
|
|
lldb::SBValue SBModule::FindFirstGlobalVariable(lldb::SBTarget &target,
|
2012-12-04 10:22:16 +08:00
|
|
|
const char *name) {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD(lldb::SBValue, SBModule, FindFirstGlobalVariable,
|
|
|
|
(lldb::SBTarget &, const char *), target, name);
|
|
|
|
|
2013-07-02 03:45:50 +08:00
|
|
|
SBValueList sb_value_list(FindGlobalVariables(target, name, 1));
|
2012-12-04 10:22:16 +08:00
|
|
|
if (sb_value_list.IsValid() && sb_value_list.GetSize() > 0)
|
2019-03-06 08:06:00 +08:00
|
|
|
return LLDB_RECORD_RESULT(sb_value_list.GetValueAtIndex(0));
|
|
|
|
return LLDB_RECORD_RESULT(SBValue());
|
2012-12-04 10:22:16 +08:00
|
|
|
}
|
|
|
|
|
2011-12-20 04:16:22 +08:00
|
|
|
lldb::SBType SBModule::FindFirstType(const char *name_cstr) {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD(lldb::SBType, SBModule, FindFirstType, (const char *),
|
|
|
|
name_cstr);
|
|
|
|
|
2011-08-04 06:57:10 +08:00
|
|
|
SBType sb_type;
|
Add =shlibs-added/=shlibs-removed notifications (MI)
Summary:
This patch adds =shlibs-added/=shlibs-removed notifications in lldb-mi. In more detail:
# Add Target::ModulesDidLoad/ModulesDidUnload notifications
# Improve Target::TargetEventData:
## Refactoring
## Move it back to include/lldb/Target/Target.h
## Add Target::{GetModuleListFromEvent,GetModuleList}; Add Target::m_module_list
# Add SBModule::{GetSymbolVendorMainFileSpec,GetObjectFileHeaderAddress}
# Add SBTarget::{EventIsTaretEvent,GetTargetFromEvent,GetNumModulesFromEvent,GetModuleAtIndexFromEvent}
All tests pass on OS X.
Reviewers: abidh, zturner, jingham, clayborg
Reviewed By: clayborg
Subscribers: jingham, zturner, lldb-commits, clayborg, abidh
Differential Revision: http://reviews.llvm.org/D8201
llvm-svn: 231858
2015-03-11 05:59:55 +08:00
|
|
|
ModuleSP module_sp(GetSP());
|
2012-02-23 03:41:02 +08:00
|
|
|
if (name_cstr && module_sp) {
|
2013-07-02 03:45:50 +08:00
|
|
|
SymbolContext sc;
|
2012-03-27 07:03:23 +08:00
|
|
|
const bool exact_match = false;
|
2011-08-04 06:57:10 +08:00
|
|
|
ConstString name(name_cstr);
|
2012-12-04 10:22:16 +08:00
|
|
|
|
2012-12-06 05:24:42 +08:00
|
|
|
sb_type = SBType(module_sp->FindFirstType(sc, name, exact_match));
|
2012-12-04 10:22:16 +08:00
|
|
|
|
2012-02-23 03:41:02 +08:00
|
|
|
if (!sb_type.IsValid()) {
|
2019-07-31 06:12:34 +08:00
|
|
|
auto type_system_or_err =
|
2013-07-02 03:45:50 +08:00
|
|
|
module_sp->GetTypeSystemForLanguage(eLanguageTypeC);
|
2019-07-31 06:12:34 +08:00
|
|
|
if (auto err = type_system_or_err.takeError()) {
|
|
|
|
llvm::consumeError(std::move(err));
|
|
|
|
return LLDB_RECORD_RESULT(SBType());
|
|
|
|
}
|
|
|
|
sb_type = SBType(type_system_or_err->GetBuiltinTypeByName(name));
|
2011-09-24 08:52:29 +08:00
|
|
|
}
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
2019-03-06 08:06:00 +08:00
|
|
|
return LLDB_RECORD_RESULT(sb_type);
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
|
|
|
|
2012-12-06 05:24:42 +08:00
|
|
|
lldb::SBType SBModule::GetBasicType(lldb::BasicType type) {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD(lldb::SBType, SBModule, GetBasicType, (lldb::BasicType),
|
|
|
|
type);
|
|
|
|
|
Add =shlibs-added/=shlibs-removed notifications (MI)
Summary:
This patch adds =shlibs-added/=shlibs-removed notifications in lldb-mi. In more detail:
# Add Target::ModulesDidLoad/ModulesDidUnload notifications
# Improve Target::TargetEventData:
## Refactoring
## Move it back to include/lldb/Target/Target.h
## Add Target::{GetModuleListFromEvent,GetModuleList}; Add Target::m_module_list
# Add SBModule::{GetSymbolVendorMainFileSpec,GetObjectFileHeaderAddress}
# Add SBTarget::{EventIsTaretEvent,GetTargetFromEvent,GetNumModulesFromEvent,GetModuleAtIndexFromEvent}
All tests pass on OS X.
Reviewers: abidh, zturner, jingham, clayborg
Reviewed By: clayborg
Subscribers: jingham, zturner, lldb-commits, clayborg, abidh
Differential Revision: http://reviews.llvm.org/D8201
llvm-svn: 231858
2015-03-11 05:59:55 +08:00
|
|
|
ModuleSP module_sp(GetSP());
|
2012-02-23 03:41:02 +08:00
|
|
|
if (module_sp) {
|
2019-07-31 06:12:34 +08:00
|
|
|
auto type_system_or_err =
|
TypeSystem is now a plugin interface and removed any "ClangASTContext &Class::GetClangASTContext()" functions.
This cleans up type systems to be more pluggable. Prior to this we had issues:
- Module, SymbolFile, and many others has "ClangASTContext &GetClangASTContext()" functions. All have been switched over to use "TypeSystem *GetTypeSystemForLanguage()"
- Cleaned up any places that were using the GetClangASTContext() functions to use TypeSystem
- Cleaned up Module so that it no longer has dedicated type system member variables:
lldb::ClangASTContextUP m_ast; ///< The Clang AST context for this module.
lldb::GoASTContextUP m_go_ast; ///< The Go AST context for this module.
Now we have a type system map:
typedef std::map<lldb::LanguageType, lldb::TypeSystemSP> TypeSystemMap;
TypeSystemMap m_type_system_map; ///< A map of any type systems associated with this module
- Many places in code were using ClangASTContext static functions to place with CompilerType objects and add modifiers (const, volatile, restrict) and to make typedefs, L and R value references and more. These have been made into CompilerType functions that are abstract:
class CompilerType
{
...
//----------------------------------------------------------------------
// Return a new CompilerType that is a L value reference to this type if
// this type is valid and the type system supports L value references,
// else return an invalid type.
//----------------------------------------------------------------------
CompilerType
GetLValueReferenceType () const;
//----------------------------------------------------------------------
// Return a new CompilerType that is a R value reference to this type if
// this type is valid and the type system supports R value references,
// else return an invalid type.
//----------------------------------------------------------------------
CompilerType
GetRValueReferenceType () const;
//----------------------------------------------------------------------
// Return a new CompilerType adds a const modifier to this type if
// this type is valid and the type system supports const modifiers,
// else return an invalid type.
//----------------------------------------------------------------------
CompilerType
AddConstModifier () const;
//----------------------------------------------------------------------
// Return a new CompilerType adds a volatile modifier to this type if
// this type is valid and the type system supports volatile modifiers,
// else return an invalid type.
//----------------------------------------------------------------------
CompilerType
AddVolatileModifier () const;
//----------------------------------------------------------------------
// Return a new CompilerType adds a restrict modifier to this type if
// this type is valid and the type system supports restrict modifiers,
// else return an invalid type.
//----------------------------------------------------------------------
CompilerType
AddRestrictModifier () const;
//----------------------------------------------------------------------
// Create a typedef to this type using "name" as the name of the typedef
// this type is valid and the type system supports typedefs, else return
// an invalid type.
//----------------------------------------------------------------------
CompilerType
CreateTypedef (const char *name, const CompilerDeclContext &decl_ctx) const;
};
Other changes include:
- Removed "CompilerType TypeSystem::GetIntTypeFromBitSize(...)" and CompilerType TypeSystem::GetFloatTypeFromBitSize(...) and replaced it with "CompilerType TypeSystem::GetBuiltinTypeForEncodingAndBitSize(lldb::Encoding encoding, size_t bit_size);"
- Fixed code in Type.h to not request the full type for a type for no good reason, just request the forward type and let the type expand as needed
llvm-svn: 247953
2015-09-18 06:23:34 +08:00
|
|
|
module_sp->GetTypeSystemForLanguage(eLanguageTypeC);
|
2019-07-31 06:12:34 +08:00
|
|
|
if (auto err = type_system_or_err.takeError()) {
|
|
|
|
llvm::consumeError(std::move(err));
|
|
|
|
} else {
|
|
|
|
return LLDB_RECORD_RESULT(
|
|
|
|
SBType(type_system_or_err->GetBasicTypeFromAST(type)));
|
|
|
|
}
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
2019-03-06 08:06:00 +08:00
|
|
|
return LLDB_RECORD_RESULT(SBType());
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
|
|
|
|
2012-12-04 10:22:16 +08:00
|
|
|
lldb::SBTypeList SBModule::FindTypes(const char *type) {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD(lldb::SBTypeList, SBModule, FindTypes, (const char *),
|
|
|
|
type);
|
|
|
|
|
2011-07-30 03:53:35 +08:00
|
|
|
SBTypeList retval;
|
2016-09-07 04:57:50 +08:00
|
|
|
|
Add =shlibs-added/=shlibs-removed notifications (MI)
Summary:
This patch adds =shlibs-added/=shlibs-removed notifications in lldb-mi. In more detail:
# Add Target::ModulesDidLoad/ModulesDidUnload notifications
# Improve Target::TargetEventData:
## Refactoring
## Move it back to include/lldb/Target/Target.h
## Add Target::{GetModuleListFromEvent,GetModuleList}; Add Target::m_module_list
# Add SBModule::{GetSymbolVendorMainFileSpec,GetObjectFileHeaderAddress}
# Add SBTarget::{EventIsTaretEvent,GetTargetFromEvent,GetNumModulesFromEvent,GetModuleAtIndexFromEvent}
All tests pass on OS X.
Reviewers: abidh, zturner, jingham, clayborg
Reviewed By: clayborg
Subscribers: jingham, zturner, lldb-commits, clayborg, abidh
Differential Revision: http://reviews.llvm.org/D8201
llvm-svn: 231858
2015-03-11 05:59:55 +08:00
|
|
|
ModuleSP module_sp(GetSP());
|
2012-02-23 03:41:02 +08:00
|
|
|
if (type && module_sp) {
|
2011-08-04 06:57:10 +08:00
|
|
|
TypeList type_list;
|
2012-03-27 07:03:23 +08:00
|
|
|
const bool exact_match = false;
|
2011-08-04 06:57:10 +08:00
|
|
|
ConstString name(type);
|
2016-02-11 05:28:13 +08:00
|
|
|
llvm::DenseSet<SymbolFile *> searched_symbol_files;
|
2019-10-01 23:40:41 +08:00
|
|
|
module_sp->FindTypes(name, exact_match, UINT32_MAX, searched_symbol_files,
|
|
|
|
type_list);
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2019-10-01 23:40:41 +08:00
|
|
|
if (type_list.Empty()) {
|
2019-07-31 06:12:34 +08:00
|
|
|
auto type_system_or_err =
|
TypeSystem is now a plugin interface and removed any "ClangASTContext &Class::GetClangASTContext()" functions.
This cleans up type systems to be more pluggable. Prior to this we had issues:
- Module, SymbolFile, and many others has "ClangASTContext &GetClangASTContext()" functions. All have been switched over to use "TypeSystem *GetTypeSystemForLanguage()"
- Cleaned up any places that were using the GetClangASTContext() functions to use TypeSystem
- Cleaned up Module so that it no longer has dedicated type system member variables:
lldb::ClangASTContextUP m_ast; ///< The Clang AST context for this module.
lldb::GoASTContextUP m_go_ast; ///< The Go AST context for this module.
Now we have a type system map:
typedef std::map<lldb::LanguageType, lldb::TypeSystemSP> TypeSystemMap;
TypeSystemMap m_type_system_map; ///< A map of any type systems associated with this module
- Many places in code were using ClangASTContext static functions to place with CompilerType objects and add modifiers (const, volatile, restrict) and to make typedefs, L and R value references and more. These have been made into CompilerType functions that are abstract:
class CompilerType
{
...
//----------------------------------------------------------------------
// Return a new CompilerType that is a L value reference to this type if
// this type is valid and the type system supports L value references,
// else return an invalid type.
//----------------------------------------------------------------------
CompilerType
GetLValueReferenceType () const;
//----------------------------------------------------------------------
// Return a new CompilerType that is a R value reference to this type if
// this type is valid and the type system supports R value references,
// else return an invalid type.
//----------------------------------------------------------------------
CompilerType
GetRValueReferenceType () const;
//----------------------------------------------------------------------
// Return a new CompilerType adds a const modifier to this type if
// this type is valid and the type system supports const modifiers,
// else return an invalid type.
//----------------------------------------------------------------------
CompilerType
AddConstModifier () const;
//----------------------------------------------------------------------
// Return a new CompilerType adds a volatile modifier to this type if
// this type is valid and the type system supports volatile modifiers,
// else return an invalid type.
//----------------------------------------------------------------------
CompilerType
AddVolatileModifier () const;
//----------------------------------------------------------------------
// Return a new CompilerType adds a restrict modifier to this type if
// this type is valid and the type system supports restrict modifiers,
// else return an invalid type.
//----------------------------------------------------------------------
CompilerType
AddRestrictModifier () const;
//----------------------------------------------------------------------
// Create a typedef to this type using "name" as the name of the typedef
// this type is valid and the type system supports typedefs, else return
// an invalid type.
//----------------------------------------------------------------------
CompilerType
CreateTypedef (const char *name, const CompilerDeclContext &decl_ctx) const;
};
Other changes include:
- Removed "CompilerType TypeSystem::GetIntTypeFromBitSize(...)" and CompilerType TypeSystem::GetFloatTypeFromBitSize(...) and replaced it with "CompilerType TypeSystem::GetBuiltinTypeForEncodingAndBitSize(lldb::Encoding encoding, size_t bit_size);"
- Fixed code in Type.h to not request the full type for a type for no good reason, just request the forward type and let the type expand as needed
llvm-svn: 247953
2015-09-18 06:23:34 +08:00
|
|
|
module_sp->GetTypeSystemForLanguage(eLanguageTypeC);
|
2019-07-31 06:12:34 +08:00
|
|
|
if (auto err = type_system_or_err.takeError()) {
|
|
|
|
llvm::consumeError(std::move(err));
|
|
|
|
} else {
|
|
|
|
CompilerType compiler_type =
|
|
|
|
type_system_or_err->GetBuiltinTypeByName(name);
|
TypeSystem is now a plugin interface and removed any "ClangASTContext &Class::GetClangASTContext()" functions.
This cleans up type systems to be more pluggable. Prior to this we had issues:
- Module, SymbolFile, and many others has "ClangASTContext &GetClangASTContext()" functions. All have been switched over to use "TypeSystem *GetTypeSystemForLanguage()"
- Cleaned up any places that were using the GetClangASTContext() functions to use TypeSystem
- Cleaned up Module so that it no longer has dedicated type system member variables:
lldb::ClangASTContextUP m_ast; ///< The Clang AST context for this module.
lldb::GoASTContextUP m_go_ast; ///< The Go AST context for this module.
Now we have a type system map:
typedef std::map<lldb::LanguageType, lldb::TypeSystemSP> TypeSystemMap;
TypeSystemMap m_type_system_map; ///< A map of any type systems associated with this module
- Many places in code were using ClangASTContext static functions to place with CompilerType objects and add modifiers (const, volatile, restrict) and to make typedefs, L and R value references and more. These have been made into CompilerType functions that are abstract:
class CompilerType
{
...
//----------------------------------------------------------------------
// Return a new CompilerType that is a L value reference to this type if
// this type is valid and the type system supports L value references,
// else return an invalid type.
//----------------------------------------------------------------------
CompilerType
GetLValueReferenceType () const;
//----------------------------------------------------------------------
// Return a new CompilerType that is a R value reference to this type if
// this type is valid and the type system supports R value references,
// else return an invalid type.
//----------------------------------------------------------------------
CompilerType
GetRValueReferenceType () const;
//----------------------------------------------------------------------
// Return a new CompilerType adds a const modifier to this type if
// this type is valid and the type system supports const modifiers,
// else return an invalid type.
//----------------------------------------------------------------------
CompilerType
AddConstModifier () const;
//----------------------------------------------------------------------
// Return a new CompilerType adds a volatile modifier to this type if
// this type is valid and the type system supports volatile modifiers,
// else return an invalid type.
//----------------------------------------------------------------------
CompilerType
AddVolatileModifier () const;
//----------------------------------------------------------------------
// Return a new CompilerType adds a restrict modifier to this type if
// this type is valid and the type system supports restrict modifiers,
// else return an invalid type.
//----------------------------------------------------------------------
CompilerType
AddRestrictModifier () const;
//----------------------------------------------------------------------
// Create a typedef to this type using "name" as the name of the typedef
// this type is valid and the type system supports typedefs, else return
// an invalid type.
//----------------------------------------------------------------------
CompilerType
CreateTypedef (const char *name, const CompilerDeclContext &decl_ctx) const;
};
Other changes include:
- Removed "CompilerType TypeSystem::GetIntTypeFromBitSize(...)" and CompilerType TypeSystem::GetFloatTypeFromBitSize(...) and replaced it with "CompilerType TypeSystem::GetBuiltinTypeForEncodingAndBitSize(lldb::Encoding encoding, size_t bit_size);"
- Fixed code in Type.h to not request the full type for a type for no good reason, just request the forward type and let the type expand as needed
llvm-svn: 247953
2015-09-18 06:23:34 +08:00
|
|
|
if (compiler_type)
|
|
|
|
retval.Append(SBType(compiler_type));
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
2019-10-01 23:40:41 +08:00
|
|
|
} else {
|
|
|
|
for (size_t idx = 0; idx < type_list.GetSize(); idx++) {
|
|
|
|
TypeSP type_sp(type_list.GetTypeAtIndex(idx));
|
|
|
|
if (type_sp)
|
|
|
|
retval.Append(SBType(type_sp));
|
|
|
|
}
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
|
|
|
}
|
2019-03-06 08:06:00 +08:00
|
|
|
return LLDB_RECORD_RESULT(retval);
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
2011-09-24 08:52:29 +08:00
|
|
|
|
2011-06-21 09:34:41 +08:00
|
|
|
lldb::SBType SBModule::GetTypeByID(lldb::user_id_t uid) {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD(lldb::SBType, SBModule, GetTypeByID, (lldb::user_id_t),
|
|
|
|
uid);
|
|
|
|
|
2012-02-23 03:41:02 +08:00
|
|
|
ModuleSP module_sp(GetSP());
|
|
|
|
if (module_sp) {
|
2019-08-06 17:12:42 +08:00
|
|
|
if (SymbolFile *symfile = module_sp->GetSymbolFile()) {
|
|
|
|
Type *type_ptr = symfile->ResolveTypeUID(uid);
|
2012-02-23 03:41:02 +08:00
|
|
|
if (type_ptr)
|
2019-03-06 08:06:00 +08:00
|
|
|
return LLDB_RECORD_RESULT(SBType(type_ptr->shared_from_this()));
|
2011-06-21 09:34:41 +08:00
|
|
|
}
|
2011-06-30 06:09:02 +08:00
|
|
|
}
|
2019-03-06 08:06:00 +08:00
|
|
|
return LLDB_RECORD_RESULT(SBType());
|
2012-12-06 05:24:42 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
lldb::SBTypeList SBModule::GetTypes(uint32_t type_mask) {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD(lldb::SBTypeList, SBModule, GetTypes, (uint32_t),
|
|
|
|
type_mask);
|
|
|
|
|
2012-12-06 05:24:42 +08:00
|
|
|
SBTypeList sb_type_list;
|
2011-07-30 03:53:35 +08:00
|
|
|
|
2014-01-24 05:38:34 +08:00
|
|
|
ModuleSP module_sp(GetSP());
|
2018-10-26 04:45:40 +08:00
|
|
|
if (!module_sp)
|
2019-03-06 08:06:00 +08:00
|
|
|
return LLDB_RECORD_RESULT(sb_type_list);
|
2019-08-06 17:12:42 +08:00
|
|
|
SymbolFile *symfile = module_sp->GetSymbolFile();
|
|
|
|
if (!symfile)
|
2019-03-06 08:06:00 +08:00
|
|
|
return LLDB_RECORD_RESULT(sb_type_list);
|
2018-10-26 04:45:40 +08:00
|
|
|
|
|
|
|
TypeClass type_class = static_cast<TypeClass>(type_mask);
|
|
|
|
TypeList type_list;
|
2019-08-06 17:12:42 +08:00
|
|
|
symfile->GetTypes(nullptr, type_class, type_list);
|
2019-02-13 14:25:41 +08:00
|
|
|
sb_type_list.m_opaque_up->Append(type_list);
|
2019-03-06 08:06:00 +08:00
|
|
|
return LLDB_RECORD_RESULT(sb_type_list);
|
2014-01-24 05:38:34 +08:00
|
|
|
}
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2013-06-19 06:51:05 +08:00
|
|
|
SBSection SBModule::FindSection(const char *sect_name) {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD(lldb::SBSection, SBModule, FindSection, (const char *),
|
|
|
|
sect_name);
|
|
|
|
|
2013-06-19 06:51:05 +08:00
|
|
|
SBSection sb_section;
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2013-06-19 06:51:05 +08:00
|
|
|
ModuleSP module_sp(GetSP());
|
|
|
|
if (sect_name && module_sp) {
|
|
|
|
// Give the symbol vendor a chance to add to the unified section list.
|
2019-08-06 17:12:42 +08:00
|
|
|
module_sp->GetSymbolFile();
|
2013-06-19 06:51:05 +08:00
|
|
|
SectionList *section_list = module_sp->GetSectionList();
|
|
|
|
if (section_list) {
|
2013-07-02 03:45:50 +08:00
|
|
|
ConstString const_sect_name(sect_name);
|
2013-06-19 06:51:05 +08:00
|
|
|
SectionSP section_sp(section_list->FindSectionByName(const_sect_name));
|
2013-07-02 03:45:50 +08:00
|
|
|
if (section_sp) {
|
2013-06-19 06:51:05 +08:00
|
|
|
sb_section.SetSP(section_sp);
|
|
|
|
}
|
|
|
|
}
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
2019-03-06 08:06:00 +08:00
|
|
|
return LLDB_RECORD_RESULT(sb_section);
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
|
|
|
|
2012-01-29 14:07:39 +08:00
|
|
|
lldb::ByteOrder SBModule::GetByteOrder() {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD_NO_ARGS(lldb::ByteOrder, SBModule, GetByteOrder);
|
|
|
|
|
2013-06-19 06:51:05 +08:00
|
|
|
ModuleSP module_sp(GetSP());
|
2012-12-06 05:24:42 +08:00
|
|
|
if (module_sp)
|
2012-02-23 03:41:02 +08:00
|
|
|
return module_sp->GetArchitecture().GetByteOrder();
|
2013-06-19 06:51:05 +08:00
|
|
|
return eByteOrderInvalid;
|
|
|
|
}
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2011-09-24 08:52:29 +08:00
|
|
|
const char *SBModule::GetTriple() {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD_NO_ARGS(const char *, SBModule, GetTriple);
|
|
|
|
|
2012-02-23 03:41:02 +08:00
|
|
|
ModuleSP module_sp(GetSP());
|
|
|
|
if (module_sp) {
|
2013-07-02 03:45:50 +08:00
|
|
|
std::string triple(module_sp->GetArchitecture().GetTriple().str());
|
2018-05-01 00:49:04 +08:00
|
|
|
// Unique the string so we don't run into ownership issues since the const
|
|
|
|
// strings put the string into the string pool once and the strings never
|
|
|
|
// comes out
|
2013-07-02 03:45:50 +08:00
|
|
|
ConstString const_triple(triple.c_str());
|
|
|
|
return const_triple.GetCString();
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
[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 19:14:47 +08:00
|
|
|
return nullptr;
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
|
|
|
|
2013-07-02 03:45:50 +08:00
|
|
|
uint32_t SBModule::GetAddressByteSize() {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD_NO_ARGS(uint32_t, SBModule, GetAddressByteSize);
|
|
|
|
|
2013-07-02 03:45:50 +08:00
|
|
|
ModuleSP module_sp(GetSP());
|
|
|
|
if (module_sp)
|
|
|
|
return module_sp->GetArchitecture().GetAddressByteSize();
|
2012-01-29 14:07:39 +08:00
|
|
|
return sizeof(void *);
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
|
|
|
|
2013-07-02 03:45:50 +08:00
|
|
|
uint32_t SBModule::GetVersion(uint32_t *versions, uint32_t num_versions) {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD(uint32_t, SBModule, GetVersion, (uint32_t *, uint32_t),
|
|
|
|
versions, num_versions);
|
|
|
|
|
2018-06-18 23:02:23 +08:00
|
|
|
llvm::VersionTuple version;
|
|
|
|
if (ModuleSP module_sp = GetSP())
|
|
|
|
version = module_sp->GetVersion();
|
|
|
|
uint32_t result = 0;
|
|
|
|
if (!version.empty())
|
|
|
|
++result;
|
|
|
|
if (version.getMinor())
|
|
|
|
++result;
|
|
|
|
if(version.getSubminor())
|
|
|
|
++result;
|
|
|
|
|
|
|
|
if (!versions)
|
|
|
|
return result;
|
|
|
|
|
|
|
|
if (num_versions > 0)
|
|
|
|
versions[0] = version.empty() ? UINT32_MAX : version.getMajor();
|
|
|
|
if (num_versions > 1)
|
|
|
|
versions[1] = version.getMinor().getValueOr(UINT32_MAX);
|
|
|
|
if (num_versions > 2)
|
|
|
|
versions[2] = version.getSubminor().getValueOr(UINT32_MAX);
|
|
|
|
for (uint32_t i = 3; i < num_versions; ++i)
|
|
|
|
versions[i] = UINT32_MAX;
|
|
|
|
return result;
|
2012-01-29 14:07:39 +08:00
|
|
|
}
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2012-01-29 14:07:39 +08:00
|
|
|
lldb::SBFileSpec SBModule::GetSymbolFileSpec() const {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD_CONST_NO_ARGS(lldb::SBFileSpec, SBModule,
|
|
|
|
GetSymbolFileSpec);
|
|
|
|
|
2013-11-21 05:07:01 +08:00
|
|
|
lldb::SBFileSpec sb_file_spec;
|
2012-02-23 03:41:02 +08:00
|
|
|
ModuleSP module_sp(GetSP());
|
|
|
|
if (module_sp) {
|
2019-08-06 17:12:42 +08:00
|
|
|
if (SymbolFile *symfile = module_sp->GetSymbolFile())
|
|
|
|
sb_file_spec.SetFileSpec(symfile->GetObjectFile()->GetFileSpec());
|
2012-01-29 14:07:39 +08:00
|
|
|
}
|
2019-03-06 08:06:00 +08:00
|
|
|
return LLDB_RECORD_RESULT(sb_file_spec);
|
2012-09-05 02:47:54 +08:00
|
|
|
}
|
2016-09-07 04:57:50 +08:00
|
|
|
|
Add =shlibs-added/=shlibs-removed notifications (MI)
Summary:
This patch adds =shlibs-added/=shlibs-removed notifications in lldb-mi. In more detail:
# Add Target::ModulesDidLoad/ModulesDidUnload notifications
# Improve Target::TargetEventData:
## Refactoring
## Move it back to include/lldb/Target/Target.h
## Add Target::{GetModuleListFromEvent,GetModuleList}; Add Target::m_module_list
# Add SBModule::{GetSymbolVendorMainFileSpec,GetObjectFileHeaderAddress}
# Add SBTarget::{EventIsTaretEvent,GetTargetFromEvent,GetNumModulesFromEvent,GetModuleAtIndexFromEvent}
All tests pass on OS X.
Reviewers: abidh, zturner, jingham, clayborg
Reviewed By: clayborg
Subscribers: jingham, zturner, lldb-commits, clayborg, abidh
Differential Revision: http://reviews.llvm.org/D8201
llvm-svn: 231858
2015-03-11 05:59:55 +08:00
|
|
|
lldb::SBAddress SBModule::GetObjectFileHeaderAddress() const {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD_CONST_NO_ARGS(lldb::SBAddress, SBModule,
|
|
|
|
GetObjectFileHeaderAddress);
|
|
|
|
|
Add =shlibs-added/=shlibs-removed notifications (MI)
Summary:
This patch adds =shlibs-added/=shlibs-removed notifications in lldb-mi. In more detail:
# Add Target::ModulesDidLoad/ModulesDidUnload notifications
# Improve Target::TargetEventData:
## Refactoring
## Move it back to include/lldb/Target/Target.h
## Add Target::{GetModuleListFromEvent,GetModuleList}; Add Target::m_module_list
# Add SBModule::{GetSymbolVendorMainFileSpec,GetObjectFileHeaderAddress}
# Add SBTarget::{EventIsTaretEvent,GetTargetFromEvent,GetNumModulesFromEvent,GetModuleAtIndexFromEvent}
All tests pass on OS X.
Reviewers: abidh, zturner, jingham, clayborg
Reviewed By: clayborg
Subscribers: jingham, zturner, lldb-commits, clayborg, abidh
Differential Revision: http://reviews.llvm.org/D8201
llvm-svn: 231858
2015-03-11 05:59:55 +08:00
|
|
|
lldb::SBAddress sb_addr;
|
|
|
|
ModuleSP module_sp(GetSP());
|
|
|
|
if (module_sp) {
|
|
|
|
ObjectFile *objfile_ptr = module_sp->GetObjectFile();
|
|
|
|
if (objfile_ptr)
|
2018-12-11 23:21:15 +08:00
|
|
|
sb_addr.ref() = objfile_ptr->GetBaseAddress();
|
Add =shlibs-added/=shlibs-removed notifications (MI)
Summary:
This patch adds =shlibs-added/=shlibs-removed notifications in lldb-mi. In more detail:
# Add Target::ModulesDidLoad/ModulesDidUnload notifications
# Improve Target::TargetEventData:
## Refactoring
## Move it back to include/lldb/Target/Target.h
## Add Target::{GetModuleListFromEvent,GetModuleList}; Add Target::m_module_list
# Add SBModule::{GetSymbolVendorMainFileSpec,GetObjectFileHeaderAddress}
# Add SBTarget::{EventIsTaretEvent,GetTargetFromEvent,GetNumModulesFromEvent,GetModuleAtIndexFromEvent}
All tests pass on OS X.
Reviewers: abidh, zturner, jingham, clayborg
Reviewed By: clayborg
Subscribers: jingham, zturner, lldb-commits, clayborg, abidh
Differential Revision: http://reviews.llvm.org/D8201
llvm-svn: 231858
2015-03-11 05:59:55 +08:00
|
|
|
}
|
2019-03-06 08:06:00 +08:00
|
|
|
return LLDB_RECORD_RESULT(sb_addr);
|
Add =shlibs-added/=shlibs-removed notifications (MI)
Summary:
This patch adds =shlibs-added/=shlibs-removed notifications in lldb-mi. In more detail:
# Add Target::ModulesDidLoad/ModulesDidUnload notifications
# Improve Target::TargetEventData:
## Refactoring
## Move it back to include/lldb/Target/Target.h
## Add Target::{GetModuleListFromEvent,GetModuleList}; Add Target::m_module_list
# Add SBModule::{GetSymbolVendorMainFileSpec,GetObjectFileHeaderAddress}
# Add SBTarget::{EventIsTaretEvent,GetTargetFromEvent,GetNumModulesFromEvent,GetModuleAtIndexFromEvent}
All tests pass on OS X.
Reviewers: abidh, zturner, jingham, clayborg
Reviewed By: clayborg
Subscribers: jingham, zturner, lldb-commits, clayborg, abidh
Differential Revision: http://reviews.llvm.org/D8201
llvm-svn: 231858
2015-03-11 05:59:55 +08:00
|
|
|
}
|
2018-11-30 17:45:52 +08:00
|
|
|
|
|
|
|
lldb::SBAddress SBModule::GetObjectFileEntryPointAddress() const {
|
2019-03-06 08:06:00 +08:00
|
|
|
LLDB_RECORD_METHOD_CONST_NO_ARGS(lldb::SBAddress, SBModule,
|
|
|
|
GetObjectFileEntryPointAddress);
|
|
|
|
|
2018-11-30 17:45:52 +08:00
|
|
|
lldb::SBAddress sb_addr;
|
|
|
|
ModuleSP module_sp(GetSP());
|
|
|
|
if (module_sp) {
|
|
|
|
ObjectFile *objfile_ptr = module_sp->GetObjectFile();
|
|
|
|
if (objfile_ptr)
|
|
|
|
sb_addr.ref() = objfile_ptr->GetEntryPointAddress();
|
|
|
|
}
|
2019-03-06 08:06:00 +08:00
|
|
|
return LLDB_RECORD_RESULT(sb_addr);
|
2018-11-30 17:45:52 +08:00
|
|
|
}
|
2019-03-20 01:13:13 +08:00
|
|
|
|
|
|
|
namespace lldb_private {
|
|
|
|
namespace repro {
|
|
|
|
|
|
|
|
template <>
|
|
|
|
void RegisterMethods<SBModule>(Registry &R) {
|
|
|
|
LLDB_REGISTER_CONSTRUCTOR(SBModule, ());
|
|
|
|
LLDB_REGISTER_CONSTRUCTOR(SBModule, (const lldb::SBModuleSpec &));
|
|
|
|
LLDB_REGISTER_CONSTRUCTOR(SBModule, (const lldb::SBModule &));
|
|
|
|
LLDB_REGISTER_CONSTRUCTOR(SBModule, (lldb::SBProcess &, lldb::addr_t));
|
|
|
|
LLDB_REGISTER_METHOD(const lldb::SBModule &,
|
|
|
|
SBModule, operator=,(const lldb::SBModule &));
|
|
|
|
LLDB_REGISTER_METHOD_CONST(bool, SBModule, IsValid, ());
|
|
|
|
LLDB_REGISTER_METHOD_CONST(bool, SBModule, operator bool, ());
|
|
|
|
LLDB_REGISTER_METHOD(void, SBModule, Clear, ());
|
|
|
|
LLDB_REGISTER_METHOD_CONST(lldb::SBFileSpec, SBModule, GetFileSpec, ());
|
|
|
|
LLDB_REGISTER_METHOD_CONST(lldb::SBFileSpec, SBModule, GetPlatformFileSpec,
|
|
|
|
());
|
|
|
|
LLDB_REGISTER_METHOD(bool, SBModule, SetPlatformFileSpec,
|
|
|
|
(const lldb::SBFileSpec &));
|
|
|
|
LLDB_REGISTER_METHOD(lldb::SBFileSpec, SBModule, GetRemoteInstallFileSpec,
|
|
|
|
());
|
|
|
|
LLDB_REGISTER_METHOD(bool, SBModule, SetRemoteInstallFileSpec,
|
|
|
|
(lldb::SBFileSpec &));
|
|
|
|
LLDB_REGISTER_METHOD_CONST(const char *, SBModule, GetUUIDString, ());
|
|
|
|
LLDB_REGISTER_METHOD_CONST(bool,
|
|
|
|
SBModule, operator==,(const lldb::SBModule &));
|
|
|
|
LLDB_REGISTER_METHOD_CONST(bool,
|
|
|
|
SBModule, operator!=,(const lldb::SBModule &));
|
|
|
|
LLDB_REGISTER_METHOD(lldb::SBAddress, SBModule, ResolveFileAddress,
|
|
|
|
(lldb::addr_t));
|
|
|
|
LLDB_REGISTER_METHOD(lldb::SBSymbolContext, SBModule,
|
|
|
|
ResolveSymbolContextForAddress,
|
|
|
|
(const lldb::SBAddress &, uint32_t));
|
|
|
|
LLDB_REGISTER_METHOD(bool, SBModule, GetDescription, (lldb::SBStream &));
|
|
|
|
LLDB_REGISTER_METHOD(uint32_t, SBModule, GetNumCompileUnits, ());
|
|
|
|
LLDB_REGISTER_METHOD(lldb::SBCompileUnit, SBModule, GetCompileUnitAtIndex,
|
|
|
|
(uint32_t));
|
|
|
|
LLDB_REGISTER_METHOD(lldb::SBSymbolContextList, SBModule, FindCompileUnits,
|
|
|
|
(const lldb::SBFileSpec &));
|
|
|
|
LLDB_REGISTER_METHOD(size_t, SBModule, GetNumSymbols, ());
|
|
|
|
LLDB_REGISTER_METHOD(lldb::SBSymbol, SBModule, GetSymbolAtIndex, (size_t));
|
|
|
|
LLDB_REGISTER_METHOD(lldb::SBSymbol, SBModule, FindSymbol,
|
|
|
|
(const char *, lldb::SymbolType));
|
|
|
|
LLDB_REGISTER_METHOD(lldb::SBSymbolContextList, SBModule, FindSymbols,
|
|
|
|
(const char *, lldb::SymbolType));
|
|
|
|
LLDB_REGISTER_METHOD(size_t, SBModule, GetNumSections, ());
|
|
|
|
LLDB_REGISTER_METHOD(lldb::SBSection, SBModule, GetSectionAtIndex,
|
|
|
|
(size_t));
|
|
|
|
LLDB_REGISTER_METHOD(lldb::SBSymbolContextList, SBModule, FindFunctions,
|
|
|
|
(const char *, uint32_t));
|
|
|
|
LLDB_REGISTER_METHOD(lldb::SBValueList, SBModule, FindGlobalVariables,
|
|
|
|
(lldb::SBTarget &, const char *, uint32_t));
|
|
|
|
LLDB_REGISTER_METHOD(lldb::SBValue, SBModule, FindFirstGlobalVariable,
|
|
|
|
(lldb::SBTarget &, const char *));
|
|
|
|
LLDB_REGISTER_METHOD(lldb::SBType, SBModule, FindFirstType, (const char *));
|
|
|
|
LLDB_REGISTER_METHOD(lldb::SBType, SBModule, GetBasicType,
|
|
|
|
(lldb::BasicType));
|
|
|
|
LLDB_REGISTER_METHOD(lldb::SBTypeList, SBModule, FindTypes, (const char *));
|
|
|
|
LLDB_REGISTER_METHOD(lldb::SBType, SBModule, GetTypeByID,
|
|
|
|
(lldb::user_id_t));
|
|
|
|
LLDB_REGISTER_METHOD(lldb::SBTypeList, SBModule, GetTypes, (uint32_t));
|
|
|
|
LLDB_REGISTER_METHOD(lldb::SBSection, SBModule, FindSection,
|
|
|
|
(const char *));
|
|
|
|
LLDB_REGISTER_METHOD(lldb::ByteOrder, SBModule, GetByteOrder, ());
|
|
|
|
LLDB_REGISTER_METHOD(const char *, SBModule, GetTriple, ());
|
|
|
|
LLDB_REGISTER_METHOD(uint32_t, SBModule, GetAddressByteSize, ());
|
|
|
|
LLDB_REGISTER_METHOD(uint32_t, SBModule, GetVersion,
|
|
|
|
(uint32_t *, uint32_t));
|
|
|
|
LLDB_REGISTER_METHOD_CONST(lldb::SBFileSpec, SBModule, GetSymbolFileSpec,
|
|
|
|
());
|
|
|
|
LLDB_REGISTER_METHOD_CONST(lldb::SBAddress, SBModule,
|
|
|
|
GetObjectFileHeaderAddress, ());
|
|
|
|
LLDB_REGISTER_METHOD_CONST(lldb::SBAddress, SBModule,
|
|
|
|
GetObjectFileEntryPointAddress, ());
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|