[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 15:23:27 +08:00
|
|
|
//===-- SymbolFileSymtab.cpp ----------------------------------------------===//
|
2010-06-09 00:52:24 +08:00
|
|
|
//
|
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 "SymbolFileSymtab.h"
|
2019-02-12 07:13:08 +08:00
|
|
|
|
2010-06-09 00:52:24 +08:00
|
|
|
#include "lldb/Core/Module.h"
|
|
|
|
#include "lldb/Core/PluginManager.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/CompileUnit.h"
|
|
|
|
#include "lldb/Symbol/Function.h"
|
2010-06-09 00:52:24 +08:00
|
|
|
#include "lldb/Symbol/ObjectFile.h"
|
|
|
|
#include "lldb/Symbol/Symbol.h"
|
|
|
|
#include "lldb/Symbol/SymbolContext.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"
|
|
|
|
#include "lldb/Symbol/TypeList.h"
|
2017-02-03 05:39:50 +08:00
|
|
|
#include "lldb/Utility/RegularExpression.h"
|
2017-06-29 22:32:17 +08:00
|
|
|
#include "lldb/Utility/Timer.h"
|
2010-06-09 00:52:24 +08:00
|
|
|
|
2019-02-12 07:13:08 +08:00
|
|
|
#include <memory>
|
|
|
|
|
2010-06-09 00:52:24 +08:00
|
|
|
using namespace lldb;
|
|
|
|
using namespace lldb_private;
|
|
|
|
|
2020-02-08 06:58:18 +08:00
|
|
|
LLDB_PLUGIN(SymbolFileSymtab);
|
|
|
|
|
2019-11-16 02:13:16 +08:00
|
|
|
char SymbolFileSymtab::ID;
|
|
|
|
|
2010-06-09 00:52:24 +08:00
|
|
|
void SymbolFileSymtab::Initialize() {
|
|
|
|
PluginManager::RegisterPlugin(GetPluginNameStatic(),
|
|
|
|
GetPluginDescriptionStatic(), CreateInstance);
|
|
|
|
}
|
|
|
|
|
|
|
|
void SymbolFileSymtab::Terminate() {
|
|
|
|
PluginManager::UnregisterPlugin(CreateInstance);
|
|
|
|
}
|
|
|
|
|
|
|
|
lldb_private::ConstString SymbolFileSymtab::GetPluginNameStatic() {
|
2013-05-11 05:47:16 +08:00
|
|
|
static ConstString g_name("symtab");
|
|
|
|
return g_name;
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
const char *SymbolFileSymtab::GetPluginDescriptionStatic() {
|
|
|
|
return "Reads debug symbols from an object file's symbol table.";
|
|
|
|
}
|
|
|
|
|
2019-07-31 16:25:25 +08:00
|
|
|
SymbolFile *SymbolFileSymtab::CreateInstance(ObjectFileSP objfile_sp) {
|
|
|
|
return new SymbolFileSymtab(std::move(objfile_sp));
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
|
|
|
|
2019-10-01 23:40:41 +08:00
|
|
|
void SymbolFileSymtab::GetTypes(SymbolContextScope *sc_scope,
|
|
|
|
TypeClass type_mask,
|
|
|
|
lldb_private::TypeList &type_list) {}
|
2013-06-19 06:51:05 +08:00
|
|
|
|
2019-07-31 16:25:25 +08:00
|
|
|
SymbolFileSymtab::SymbolFileSymtab(ObjectFileSP objfile_sp)
|
|
|
|
: SymbolFile(std::move(objfile_sp)), m_source_indexes(), m_func_indexes(),
|
2011-12-04 04:02:42 +08:00
|
|
|
m_code_indexes(), m_objc_class_name_to_index() {}
|
2010-06-09 00:52:24 +08:00
|
|
|
|
2011-12-04 04:02:42 +08:00
|
|
|
SymbolFileSymtab::~SymbolFileSymtab() {}
|
2011-06-19 12:02:02 +08:00
|
|
|
|
2011-12-03 12:38:43 +08:00
|
|
|
uint32_t SymbolFileSymtab::CalculateAbilities() {
|
2010-06-09 00:52:24 +08:00
|
|
|
uint32_t abilities = 0;
|
2019-07-31 16:25:25 +08:00
|
|
|
if (m_objfile_sp) {
|
|
|
|
const Symtab *symtab = m_objfile_sp->GetSymtab();
|
2011-06-19 12:02:02 +08:00
|
|
|
if (symtab) {
|
2018-05-01 00:49:04 +08:00
|
|
|
// The snippet of code below will get the indexes the module symbol table
|
|
|
|
// entries that are code, data, or function related (debug info), sort
|
|
|
|
// them by value (address) and dump the sorted symbols.
|
2011-12-04 04:02:42 +08:00
|
|
|
if (symtab->AppendSymbolIndexesWithType(eSymbolTypeSourceFile,
|
|
|
|
m_source_indexes)) {
|
2011-06-19 12:02:02 +08:00
|
|
|
abilities |= CompileUnits;
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
|
|
|
|
2011-12-04 04:02:42 +08:00
|
|
|
if (symtab->AppendSymbolIndexesWithType(
|
|
|
|
eSymbolTypeCode, Symtab::eDebugYes, Symtab::eVisibilityAny,
|
2011-06-19 12:02:02 +08:00
|
|
|
m_func_indexes)) {
|
|
|
|
symtab->SortSymbolIndexesByValue(m_func_indexes, true);
|
2015-07-30 20:38:18 +08:00
|
|
|
abilities |= Functions;
|
2011-06-19 12:02:02 +08:00
|
|
|
}
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2011-12-04 04:02:42 +08:00
|
|
|
if (symtab->AppendSymbolIndexesWithType(eSymbolTypeCode, Symtab::eDebugNo,
|
|
|
|
Symtab::eVisibilityAny,
|
|
|
|
m_code_indexes)) {
|
2011-06-19 12:02:02 +08:00
|
|
|
symtab->SortSymbolIndexesByValue(m_code_indexes, true);
|
|
|
|
abilities |= Functions;
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
|
|
|
|
2011-12-04 04:02:42 +08:00
|
|
|
if (symtab->AppendSymbolIndexesWithType(eSymbolTypeData,
|
|
|
|
m_data_indexes)) {
|
2011-06-19 12:02:02 +08:00
|
|
|
symtab->SortSymbolIndexesByValue(m_data_indexes, true);
|
|
|
|
abilities |= GlobalVariables;
|
|
|
|
}
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2011-12-04 04:02:42 +08:00
|
|
|
lldb_private::Symtab::IndexCollection objc_class_indexes;
|
|
|
|
if (symtab->AppendSymbolIndexesWithType(eSymbolTypeObjCClass,
|
|
|
|
objc_class_indexes)) {
|
|
|
|
symtab->AppendSymbolNamesToMap(objc_class_indexes, true, true,
|
|
|
|
m_objc_class_name_to_index);
|
|
|
|
m_objc_class_name_to_index.Sort();
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
|
|
|
}
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
2010-06-09 00:52:24 +08:00
|
|
|
return abilities;
|
|
|
|
}
|
|
|
|
|
2019-07-23 17:24:02 +08:00
|
|
|
uint32_t SymbolFileSymtab::CalculateNumCompileUnits() {
|
2018-05-01 00:49:04 +08:00
|
|
|
// If we don't have any source file symbols we will just have one compile
|
|
|
|
// unit for the entire object file
|
2010-06-09 00:52:24 +08:00
|
|
|
if (m_source_indexes.empty())
|
2011-09-21 09:17:13 +08:00
|
|
|
return 0;
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2014-07-09 02:05:41 +08:00
|
|
|
// If we have any source file symbols we will logically organize the object
|
2018-05-01 00:49:04 +08:00
|
|
|
// symbols using these.
|
2010-06-09 00:52:24 +08:00
|
|
|
return m_source_indexes.size();
|
|
|
|
}
|
|
|
|
|
|
|
|
CompUnitSP SymbolFileSymtab::ParseCompileUnitAtIndex(uint32_t idx) {
|
|
|
|
CompUnitSP cu_sp;
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2018-05-01 00:49:04 +08:00
|
|
|
// If we don't have any source file symbols we will just have one compile
|
|
|
|
// unit for the entire object file
|
2012-04-27 00:53:42 +08:00
|
|
|
if (idx < m_source_indexes.size()) {
|
2013-07-10 09:23:25 +08:00
|
|
|
const Symbol *cu_symbol =
|
2019-07-31 16:25:25 +08:00
|
|
|
m_objfile_sp->GetSymtab()->SymbolAtIndex(m_source_indexes[idx]);
|
2010-06-09 00:52:24 +08:00
|
|
|
if (cu_symbol)
|
2019-07-31 16:25:25 +08:00
|
|
|
cu_sp = std::make_shared<CompileUnit>(m_objfile_sp->GetModule(), nullptr,
|
|
|
|
cu_symbol->GetName().AsCString(), 0,
|
2019-02-12 07:13:08 +08:00
|
|
|
eLanguageTypeUnknown, eLazyBoolNo);
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
|
|
|
return cu_sp;
|
|
|
|
}
|
|
|
|
|
2019-01-12 02:03:20 +08:00
|
|
|
lldb::LanguageType SymbolFileSymtab::ParseLanguage(CompileUnit &comp_unit) {
|
<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
|
|
|
return eLanguageTypeUnknown;
|
|
|
|
}
|
|
|
|
|
2019-01-12 02:03:20 +08:00
|
|
|
size_t SymbolFileSymtab::ParseFunctions(CompileUnit &comp_unit) {
|
2019-07-30 16:20:05 +08:00
|
|
|
std::lock_guard<std::recursive_mutex> guard(GetModuleMutex());
|
2010-06-09 00:52:24 +08:00
|
|
|
size_t num_added = 0;
|
|
|
|
// We must at least have a valid compile unit
|
2019-07-31 16:25:25 +08:00
|
|
|
const Symtab *symtab = m_objfile_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
|
|
|
const Symbol *curr_symbol = nullptr;
|
|
|
|
const Symbol *next_symbol = nullptr;
|
2019-07-31 16:25:25 +08:00
|
|
|
// const char *prefix = m_objfile_sp->SymbolPrefix();
|
2010-06-09 00:52:24 +08:00
|
|
|
// if (prefix == NULL)
|
|
|
|
// prefix == "";
|
2016-09-07 04:57:50 +08:00
|
|
|
//
|
2010-06-09 00:52:24 +08:00
|
|
|
// const uint32_t prefix_len = strlen(prefix);
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2018-05-01 00:49:04 +08:00
|
|
|
// If we don't have any source file symbols we will just have one compile
|
|
|
|
// unit for the entire object file
|
2010-06-09 00:52:24 +08:00
|
|
|
if (m_source_indexes.empty()) {
|
2018-05-01 00:49:04 +08:00
|
|
|
// The only time we will have a user ID of zero is when we don't have and
|
|
|
|
// source file symbols and we declare one compile unit for the entire
|
|
|
|
// object file
|
2010-06-09 00:52:24 +08:00
|
|
|
if (!m_func_indexes.empty()) {
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
<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
|
|
|
|
2010-06-09 00:52:24 +08:00
|
|
|
if (!m_code_indexes.empty()) {
|
|
|
|
// StreamFile s(stdout);
|
2013-07-10 09:23:25 +08:00
|
|
|
// symtab->Dump(&s, m_code_indexes);
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2010-06-09 00:52:24 +08:00
|
|
|
uint32_t idx = 0; // Index into the indexes
|
|
|
|
const uint32_t num_indexes = m_code_indexes.size();
|
|
|
|
for (idx = 0; idx < num_indexes; ++idx) {
|
|
|
|
uint32_t symbol_idx = m_code_indexes[idx];
|
|
|
|
curr_symbol = symtab->SymbolAtIndex(symbol_idx);
|
|
|
|
if (curr_symbol) {
|
|
|
|
// Union of all ranges in the function DIE (if the function is
|
|
|
|
// discontiguous)
|
2012-03-08 05:03:09 +08:00
|
|
|
AddressRange func_range(curr_symbol->GetAddress(), 0);
|
2010-06-09 00:52:24 +08:00
|
|
|
if (func_range.GetBaseAddress().IsSectionOffset()) {
|
|
|
|
uint32_t symbol_size = curr_symbol->GetByteSize();
|
|
|
|
if (symbol_size != 0 && !curr_symbol->GetSizeIsSibling())
|
|
|
|
func_range.SetByteSize(symbol_size);
|
|
|
|
else if (idx + 1 < num_indexes) {
|
|
|
|
next_symbol = symtab->SymbolAtIndex(m_code_indexes[idx + 1]);
|
|
|
|
if (next_symbol) {
|
2015-06-26 05:46:34 +08:00
|
|
|
func_range.SetByteSize(
|
|
|
|
next_symbol->GetAddressRef().GetOffset() -
|
2010-06-09 00:52:24 +08:00
|
|
|
curr_symbol->GetAddressRef().GetOffset());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
FunctionSP func_sp(
|
2019-01-12 02:03:20 +08:00
|
|
|
new Function(&comp_unit,
|
2010-06-09 00:52:24 +08:00
|
|
|
symbol_idx, // UserID is the DIE offset
|
|
|
|
LLDB_INVALID_UID, // We don't have any type info
|
|
|
|
// for this function
|
|
|
|
curr_symbol->GetMangled(), // Linker/mangled name
|
[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
|
|
|
nullptr, // no return type for a code symbol...
|
2010-06-09 00:52:24 +08:00
|
|
|
func_range)); // first address range
|
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
|
|
|
if (func_sp.get() != nullptr) {
|
2019-01-12 02:03:20 +08:00
|
|
|
comp_unit.AddFunction(func_sp);
|
2010-06-09 00:52:24 +08:00
|
|
|
++num_added;
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
|
|
|
}
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
// We assume we
|
|
|
|
}
|
|
|
|
return num_added;
|
|
|
|
}
|
|
|
|
|
2019-01-12 02:03:20 +08:00
|
|
|
size_t SymbolFileSymtab::ParseTypes(CompileUnit &comp_unit) { return 0; }
|
|
|
|
|
|
|
|
bool SymbolFileSymtab::ParseLineTable(CompileUnit &comp_unit) { return false; }
|
2010-06-09 00:52:24 +08:00
|
|
|
|
2019-01-12 02:03:20 +08:00
|
|
|
bool SymbolFileSymtab::ParseDebugMacros(CompileUnit &comp_unit) {
|
2015-12-16 08:22:08 +08:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2019-01-12 02:03:20 +08:00
|
|
|
bool SymbolFileSymtab::ParseSupportFiles(CompileUnit &comp_unit,
|
|
|
|
FileSpecList &support_files) {
|
2010-06-09 00:52:24 +08:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2015-04-21 00:31:29 +08:00
|
|
|
bool SymbolFileSymtab::ParseImportedModules(
|
2019-02-14 02:10:41 +08:00
|
|
|
const SymbolContext &sc, std::vector<SourceModule> &imported_modules) {
|
2015-04-21 00:31:29 +08:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2019-01-15 06:40:41 +08:00
|
|
|
size_t SymbolFileSymtab::ParseBlocksRecursive(Function &func) { return 0; }
|
2010-06-09 00:52:24 +08:00
|
|
|
|
|
|
|
size_t SymbolFileSymtab::ParseVariablesForContext(const SymbolContext &sc) {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
Type *SymbolFileSymtab::ResolveTypeUID(lldb::user_id_t type_uid) {
|
[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
|
|
|
}
|
|
|
|
|
2018-11-06 04:49:07 +08:00
|
|
|
llvm::Optional<SymbolFile::ArrayInfo>
|
|
|
|
SymbolFileSymtab::GetDynamicArrayInfoForUID(
|
|
|
|
lldb::user_id_t type_uid, const lldb_private::ExecutionContext *exe_ctx) {
|
|
|
|
return llvm::None;
|
|
|
|
}
|
|
|
|
|
2010-06-09 00:52:24 +08:00
|
|
|
bool SymbolFileSymtab::CompleteType(lldb_private::CompilerType &compiler_type) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2015-09-24 11:54:50 +08:00
|
|
|
uint32_t SymbolFileSymtab::ResolveSymbolContext(const Address &so_addr,
|
2018-10-26 04:45:19 +08:00
|
|
|
SymbolContextItem resolve_scope,
|
2015-09-24 11:54:50 +08:00
|
|
|
SymbolContext &sc) {
|
2019-07-30 16:20:05 +08:00
|
|
|
std::lock_guard<std::recursive_mutex> guard(GetModuleMutex());
|
2019-07-31 16:25:25 +08:00
|
|
|
if (m_objfile_sp->GetSymtab() == nullptr)
|
2013-07-12 06:46:58 +08:00
|
|
|
return 0;
|
2010-06-09 00:52:24 +08:00
|
|
|
|
|
|
|
uint32_t resolved_flags = 0;
|
|
|
|
if (resolve_scope & eSymbolContextSymbol) {
|
2019-07-31 16:25:25 +08:00
|
|
|
sc.symbol = m_objfile_sp->GetSymtab()->FindSymbolContainingFileAddress(
|
2013-07-10 09:23:25 +08:00
|
|
|
so_addr.GetFileAddress());
|
2010-06-09 00:52:24 +08:00
|
|
|
if (sc.symbol)
|
|
|
|
resolved_flags |= eSymbolContextSymbol;
|
|
|
|
}
|
|
|
|
return resolved_flags;
|
|
|
|
}
|
|
|
|
|
|
|
|
// PluginInterface protocol
|
|
|
|
lldb_private::ConstString SymbolFileSymtab::GetPluginName() {
|
|
|
|
return GetPluginNameStatic();
|
|
|
|
}
|
|
|
|
|
|
|
|
uint32_t SymbolFileSymtab::GetPluginVersion() { return 1; }
|