LLDB  mainline
JITLoaderGDB.cpp
Go to the documentation of this file.
1 //===-- JITLoaderGDB.cpp --------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #include "JITLoaderGDB.h"
12 #include "lldb/Core/Module.h"
13 #include "lldb/Core/ModuleSpec.h"
15 #include "lldb/Core/Section.h"
17 #include "lldb/Symbol/ObjectFile.h"
18 #include "lldb/Symbol/Symbol.h"
21 #include "lldb/Target/Process.h"
23 #include "lldb/Target/Target.h"
26 #include "lldb/Utility/Log.h"
28 #include "llvm/Support/MathExtras.h"
29 
30 #include <memory>
31 
32 using namespace lldb;
33 using namespace lldb_private;
34 
36 
37 // Debug Interface Structures
39 
40 template <typename ptr_t> struct jit_code_entry {
41  ptr_t next_entry; // pointer
42  ptr_t prev_entry; // pointer
43  ptr_t symfile_addr; // pointer
44  uint64_t symfile_size;
45 };
46 
47 template <typename ptr_t> struct jit_descriptor {
49  uint32_t action_flag; // Values are jit_action_t
50  ptr_t relevant_entry; // pointer
51  ptr_t first_entry; // pointer
52 };
53 
54 namespace {
55 
56 enum EnableJITLoaderGDB {
57  eEnableJITLoaderGDBDefault,
58  eEnableJITLoaderGDBOn,
59  eEnableJITLoaderGDBOff,
60 };
61 
62 static constexpr OptionEnumValueElement g_enable_jit_loader_gdb_enumerators[] =
63  {
64  {
65  eEnableJITLoaderGDBDefault,
66  "default",
67  "Enable JIT compilation interface for all platforms except macOS",
68  },
69  {
70  eEnableJITLoaderGDBOn,
71  "on",
72  "Enable JIT compilation interface",
73  },
74  {
75  eEnableJITLoaderGDBOff,
76  "off",
77  "Disable JIT compilation interface",
78  },
79 };
80 
81 #define LLDB_PROPERTIES_jitloadergdb
82 #include "JITLoaderGDBProperties.inc"
83 
84 enum {
85 #define LLDB_PROPERTIES_jitloadergdb
86 #include "JITLoaderGDBPropertiesEnum.inc"
87  ePropertyEnableJITBreakpoint
88 };
89 
90 class PluginProperties : public Properties {
91 public:
92  static ConstString GetSettingName() {
94  }
95 
96  PluginProperties() {
97  m_collection_sp = std::make_shared<OptionValueProperties>(GetSettingName());
98  m_collection_sp->Initialize(g_jitloadergdb_properties);
99  }
100 
101  EnableJITLoaderGDB GetEnable() const {
102  return (EnableJITLoaderGDB)m_collection_sp->GetPropertyAtIndexAsEnumeration(
103  nullptr, ePropertyEnable,
104  g_jitloadergdb_properties[ePropertyEnable].default_uint_value);
105  }
106 };
107 
108 static PluginProperties &GetGlobalPluginProperties() {
109  static PluginProperties g_settings;
110  return g_settings;
111 }
112 
113 template <typename ptr_t>
114 bool ReadJITEntry(const addr_t from_addr, Process *process,
115  jit_code_entry<ptr_t> *entry) {
116  lldbassert(from_addr % sizeof(ptr_t) == 0);
117 
118  ArchSpec::Core core = process->GetTarget().GetArchitecture().GetCore();
119  bool i386_target = ArchSpec::kCore_x86_32_first <= core &&
120  core <= ArchSpec::kCore_x86_32_last;
121  uint8_t uint64_align_bytes = i386_target ? 4 : 8;
122  const size_t data_byte_size =
123  llvm::alignTo(sizeof(ptr_t) * 3, uint64_align_bytes) + sizeof(uint64_t);
124 
125  Status error;
126  DataBufferHeap data(data_byte_size, 0);
127  size_t bytes_read = process->ReadMemory(from_addr, data.GetBytes(),
128  data.GetByteSize(), error);
129  if (bytes_read != data_byte_size || !error.Success())
130  return false;
131 
132  DataExtractor extractor(data.GetBytes(), data.GetByteSize(),
133  process->GetByteOrder(), sizeof(ptr_t));
134  lldb::offset_t offset = 0;
135  entry->next_entry = extractor.GetAddress(&offset);
136  entry->prev_entry = extractor.GetAddress(&offset);
137  entry->symfile_addr = extractor.GetAddress(&offset);
138  offset = llvm::alignTo(offset, uint64_align_bytes);
139  entry->symfile_size = extractor.GetU64(&offset);
140 
141  return true;
142 }
143 
144 } // anonymous namespace end
145 
147  : JITLoader(process), m_jit_objects(),
148  m_jit_break_id(LLDB_INVALID_BREAK_ID),
149  m_jit_descriptor_addr(LLDB_INVALID_ADDRESS) {}
150 
154 }
155 
157  if (!PluginManager::GetSettingForJITLoaderPlugin(
158  debugger, PluginProperties::GetSettingName())) {
159  const bool is_global_setting = true;
160  PluginManager::CreateSettingForJITLoaderPlugin(
161  debugger, GetGlobalPluginProperties().GetValueProperties(),
162  ConstString("Properties for the JIT LoaderGDB plug-in."),
163  is_global_setting);
164  }
165 }
166 
168  Target &target = m_process->GetTarget();
169  ModuleList &module_list = target.GetImages();
170  SetJITBreakpoint(module_list);
171 }
172 
174  Target &target = m_process->GetTarget();
175  ModuleList &module_list = target.GetImages();
176  SetJITBreakpoint(module_list);
177 }
178 
181  SetJITBreakpoint(module_list);
182 }
183 
184 // Setup the JIT Breakpoint
186  if (DidSetJITBreakpoint())
187  return;
188 
190  LLDB_LOGF(log, "JITLoaderGDB::%s looking for JIT register hook",
191  __FUNCTION__);
192 
193  addr_t jit_addr = GetSymbolAddress(
194  module_list, ConstString("__jit_debug_register_code"), eSymbolTypeAny);
195  if (jit_addr == LLDB_INVALID_ADDRESS)
196  return;
197 
199  module_list, ConstString("__jit_debug_descriptor"), eSymbolTypeData);
201  LLDB_LOGF(log, "JITLoaderGDB::%s failed to find JIT descriptor address",
202  __FUNCTION__);
203  return;
204  }
205 
206  LLDB_LOGF(log, "JITLoaderGDB::%s setting JIT breakpoint", __FUNCTION__);
207 
208  Breakpoint *bp =
209  m_process->GetTarget().CreateBreakpoint(jit_addr, true, false).get();
210  bp->SetCallback(JITDebugBreakpointHit, this, true);
211  bp->SetBreakpointKind("jit-debug-register");
212  m_jit_break_id = bp->GetID();
213 
214  ReadJITDescriptor(true);
215 }
216 
218  StoppointCallbackContext *context,
219  user_id_t break_id,
220  user_id_t break_loc_id) {
222  LLDB_LOGF(log, "JITLoaderGDB::%s hit JIT breakpoint", __FUNCTION__);
223  JITLoaderGDB *instance = static_cast<JITLoaderGDB *>(baton);
224  return instance->ReadJITDescriptor(false);
225 }
226 
227 static void updateSectionLoadAddress(const SectionList &section_list,
228  Target &target, uint64_t symbolfile_addr,
229  uint64_t symbolfile_size,
230  uint64_t &vmaddrheuristic,
231  uint64_t &min_addr, uint64_t &max_addr) {
232  const uint32_t num_sections = section_list.GetSize();
233  for (uint32_t i = 0; i < num_sections; ++i) {
234  SectionSP section_sp(section_list.GetSectionAtIndex(i));
235  if (section_sp) {
236  if (section_sp->IsFake()) {
237  uint64_t lower = (uint64_t)-1;
238  uint64_t upper = 0;
239  updateSectionLoadAddress(section_sp->GetChildren(), target,
240  symbolfile_addr, symbolfile_size,
241  vmaddrheuristic, lower, upper);
242  if (lower < min_addr)
243  min_addr = lower;
244  if (upper > max_addr)
245  max_addr = upper;
246  const lldb::addr_t slide_amount = lower - section_sp->GetFileAddress();
247  section_sp->Slide(slide_amount, false);
248  section_sp->GetChildren().Slide(-slide_amount, false);
249  section_sp->SetByteSize(upper - lower);
250  } else {
251  vmaddrheuristic += 2 << section_sp->GetLog2Align();
252  uint64_t lower;
253  if (section_sp->GetFileAddress() > vmaddrheuristic)
254  lower = section_sp->GetFileAddress();
255  else {
256  lower = symbolfile_addr + section_sp->GetFileOffset();
257  section_sp->SetFileAddress(symbolfile_addr +
258  section_sp->GetFileOffset());
259  }
260  target.SetSectionLoadAddress(section_sp, lower, true);
261  uint64_t upper = lower + section_sp->GetByteSize();
262  if (lower < min_addr)
263  min_addr = lower;
264  if (upper > max_addr)
265  max_addr = upper;
266  // This is an upper bound, but a good enough heuristic
267  vmaddrheuristic += section_sp->GetByteSize();
268  }
269  }
270  }
271 }
272 
273 bool JITLoaderGDB::ReadJITDescriptor(bool all_entries) {
275  return ReadJITDescriptorImpl<uint64_t>(all_entries);
276  else
277  return ReadJITDescriptorImpl<uint32_t>(all_entries);
278 }
279 
280 template <typename ptr_t>
281 bool JITLoaderGDB::ReadJITDescriptorImpl(bool all_entries) {
283  return false;
284 
286  Target &target = m_process->GetTarget();
287  ModuleList &module_list = target.GetImages();
288 
289  jit_descriptor<ptr_t> jit_desc;
290  const size_t jit_desc_size = sizeof(jit_desc);
291  Status error;
292  size_t bytes_read = m_process->ReadMemory(m_jit_descriptor_addr, &jit_desc,
293  jit_desc_size, error);
294  if (bytes_read != jit_desc_size || !error.Success()) {
295  LLDB_LOGF(log, "JITLoaderGDB::%s failed to read JIT descriptor",
296  __FUNCTION__);
297  return false;
298  }
299 
300  jit_actions_t jit_action = (jit_actions_t)jit_desc.action_flag;
301  addr_t jit_relevant_entry = (addr_t)jit_desc.relevant_entry;
302  if (all_entries) {
303  jit_action = JIT_REGISTER_FN;
304  jit_relevant_entry = (addr_t)jit_desc.first_entry;
305  }
306 
307  while (jit_relevant_entry != 0) {
308  jit_code_entry<ptr_t> jit_entry;
309  if (!ReadJITEntry(jit_relevant_entry, m_process, &jit_entry)) {
310  LLDB_LOGF(log, "JITLoaderGDB::%s failed to read JIT entry at 0x%" PRIx64,
311  __FUNCTION__, jit_relevant_entry);
312  return false;
313  }
314 
315  const addr_t &symbolfile_addr = (addr_t)jit_entry.symfile_addr;
316  const size_t &symbolfile_size = (size_t)jit_entry.symfile_size;
317  ModuleSP module_sp;
318 
319  if (jit_action == JIT_REGISTER_FN) {
320  LLDB_LOGF(log,
321  "JITLoaderGDB::%s registering JIT entry at 0x%" PRIx64
322  " (%" PRIu64 " bytes)",
323  __FUNCTION__, symbolfile_addr, (uint64_t)symbolfile_size);
324 
325  char jit_name[64];
326  snprintf(jit_name, 64, "JIT(0x%" PRIx64 ")", symbolfile_addr);
327  module_sp = m_process->ReadModuleFromMemory(
328  FileSpec(jit_name), symbolfile_addr, symbolfile_size);
329 
330  if (module_sp && module_sp->GetObjectFile()) {
331  // Object formats (like ELF) have no representation for a JIT type.
332  // We will get it wrong, if we deduce it from the header.
333  module_sp->GetObjectFile()->SetType(ObjectFile::eTypeJIT);
334 
335  // load the symbol table right away
336  module_sp->GetObjectFile()->GetSymtab();
337 
338  m_jit_objects.insert(std::make_pair(symbolfile_addr, module_sp));
339  if (auto image_object_file =
340  llvm::dyn_cast<ObjectFileMachO>(module_sp->GetObjectFile())) {
341  const SectionList *section_list = image_object_file->GetSectionList();
342  if (section_list) {
343  uint64_t vmaddrheuristic = 0;
344  uint64_t lower = (uint64_t)-1;
345  uint64_t upper = 0;
346  updateSectionLoadAddress(*section_list, target, symbolfile_addr,
347  symbolfile_size, vmaddrheuristic, lower,
348  upper);
349  }
350  } else {
351  bool changed = false;
352  module_sp->SetLoadAddress(target, 0, true, changed);
353  }
354 
355  module_list.AppendIfNeeded(module_sp);
356 
357  ModuleList module_list;
358  module_list.Append(module_sp);
359  target.ModulesDidLoad(module_list);
360  } else {
361  LLDB_LOGF(log,
362  "JITLoaderGDB::%s failed to load module for "
363  "JIT entry at 0x%" PRIx64,
364  __FUNCTION__, symbolfile_addr);
365  }
366  } else if (jit_action == JIT_UNREGISTER_FN) {
367  LLDB_LOGF(log, "JITLoaderGDB::%s unregistering JIT entry at 0x%" PRIx64,
368  __FUNCTION__, symbolfile_addr);
369 
370  JITObjectMap::iterator it = m_jit_objects.find(symbolfile_addr);
371  if (it != m_jit_objects.end()) {
372  module_sp = it->second;
373  ObjectFile *image_object_file = module_sp->GetObjectFile();
374  if (image_object_file) {
375  const SectionList *section_list = image_object_file->GetSectionList();
376  if (section_list) {
377  const uint32_t num_sections = section_list->GetSize();
378  for (uint32_t i = 0; i < num_sections; ++i) {
379  SectionSP section_sp(section_list->GetSectionAtIndex(i));
380  if (section_sp) {
381  target.GetSectionLoadList().SetSectionUnloaded(section_sp);
382  }
383  }
384  }
385  }
386  module_list.Remove(module_sp);
387  m_jit_objects.erase(it);
388  }
389  } else if (jit_action == JIT_NOACTION) {
390  // Nothing to do
391  } else {
392  assert(false && "Unknown jit action");
393  }
394 
395  if (all_entries)
396  jit_relevant_entry = (addr_t)jit_entry.next_entry;
397  else
398  jit_relevant_entry = 0;
399  }
400 
401  return false; // Continue Running.
402 }
403 
404 // PluginInterface protocol
406  static ConstString g_name("gdb");
407  return g_name;
408 }
409 
410 JITLoaderSP JITLoaderGDB::CreateInstance(Process *process, bool force) {
411  JITLoaderSP jit_loader_sp;
412  bool enable;
413  switch (GetGlobalPluginProperties().GetEnable()) {
414  case EnableJITLoaderGDB::eEnableJITLoaderGDBOn:
415  enable = true;
416  break;
417  case EnableJITLoaderGDB::eEnableJITLoaderGDBOff:
418  enable = false;
419  break;
420  case EnableJITLoaderGDB::eEnableJITLoaderGDBDefault:
421  ArchSpec arch(process->GetTarget().GetArchitecture());
422  enable = arch.GetTriple().getVendor() != llvm::Triple::Apple;
423  break;
424  }
425  if (enable)
426  jit_loader_sp = std::make_shared<JITLoaderGDB>(process);
427  return jit_loader_sp;
428 }
429 
431  return "JIT loader plug-in that watches for JIT events using the GDB "
432  "interface.";
433 }
434 
436  return GetPluginNameStatic();
437 }
438 
440  PluginManager::RegisterPlugin(GetPluginNameStatic(),
443 }
444 
446  PluginManager::UnregisterPlugin(CreateInstance);
447 }
448 
451 }
452 
454  ConstString name,
455  SymbolType symbol_type) const {
456  SymbolContextList target_symbols;
457  Target &target = m_process->GetTarget();
458 
459  module_list.FindSymbolsWithNameAndType(name, symbol_type, target_symbols);
460  if (target_symbols.IsEmpty())
461  return LLDB_INVALID_ADDRESS;
462 
463  SymbolContext sym_ctx;
464  target_symbols.GetContextAtIndex(0, sym_ctx);
465 
466  const Address jit_descriptor_addr = sym_ctx.symbol->GetAddress();
467  if (!jit_descriptor_addr.IsValid())
468  return LLDB_INVALID_ADDRESS;
469 
470  const addr_t jit_addr = jit_descriptor_addr.GetLoadAddress(&target);
471  return jit_addr;
472 }
JITLoaderGDB::~JITLoaderGDB
~JITLoaderGDB() override
Definition: JITLoaderGDB.cpp:151
jit_code_entry::symfile_size
uint64_t symfile_size
Definition: JITLoaderGDB.cpp:44
LLDB_BREAK_ID_IS_VALID
#define LLDB_BREAK_ID_IS_VALID(bid)
Definition: lldb-defines.h:51
JITLoaderGDB.h
lldb_private::ArchSpec
Definition: ArchSpec.h:33
lldb_private::StoppointCallbackContext
General Outline: When we hit a breakpoint we need to package up whatever information is needed to eva...
Definition: StoppointCallbackContext.h:26
lldb_private::Stoppoint::GetID
lldb::break_id_t GetID() const
Definition: Stoppoint.cpp:22
lldb_private::Address::IsValid
bool IsValid() const
Check if the object state is valid.
Definition: Address.h:336
lldb_private::Process::ReadMemory
virtual size_t ReadMemory(lldb::addr_t vm_addr, void *buf, size_t size, Status &error)
Read of memory from a process.
Definition: Process.cpp:1914
ModuleSpec.h
JITLoaderGDB::Terminate
static void Terminate()
Definition: JITLoaderGDB.cpp:445
lldb_private::Breakpoint::SetBreakpointKind
void SetBreakpointKind(const char *kind)
Set the "kind" description for a breakpoint.
Definition: Breakpoint.h:442
lldb_private::ArchSpec::GetCore
Core GetCore() const
Definition: ArchSpec.h:423
lldb_private::SectionList::GetSize
size_t GetSize() const
Definition: Section.h:74
jit_code_entry
Definition: JITLoaderGDB.cpp:40
lldb_private::Process::ReadModuleFromMemory
lldb::ModuleSP ReadModuleFromMemory(const FileSpec &file_spec, lldb::addr_t header_addr, size_t size_to_read=512)
Definition: Process.cpp:2388
LLDB_LOGF
#define LLDB_LOGF(log,...)
Definition: Log.h:249
LIBLLDB_LOG_JIT_LOADER
#define LIBLLDB_LOG_JIT_LOADER
Definition: Logging.h:41
lldb_private::Process
Definition: Process.h:340
Module.h
lldb_private::Process::GetTarget
Target & GetTarget()
Get the target object pointer for this module.
Definition: Process.h:1212
lldb_private::JITLoader::m_process
Process * m_process
Definition: JITLoader.h:63
lldb::eSymbolTypeData
@ eSymbolTypeData
Definition: lldb-enumerations.h:618
lldb_private::SymbolContextList
Definition: SymbolContext.h:379
lldb_private::SymbolContextList::GetContextAtIndex
bool GetContextAtIndex(size_t idx, SymbolContext &sc) const
Get accessor for a symbol context at index idx.
Definition: SymbolContext.cpp:1262
SectionLoadList.h
lldb_private::SectionList
Definition: Section.h:34
lldb::offset_t
uint64_t offset_t
Definition: lldb-types.h:87
lldb_private::Process::IsAlive
virtual bool IsAlive()
Check if a process is still alive.
Definition: Process.cpp:1085
JITLoaderGDB::CreateInstance
static lldb::JITLoaderSP CreateInstance(lldb_private::Process *process, bool force)
Definition: JITLoaderGDB.cpp:410
updateSectionLoadAddress
static void updateSectionLoadAddress(const SectionList &section_list, Target &target, uint64_t symbolfile_addr, uint64_t symbolfile_size, uint64_t &vmaddrheuristic, uint64_t &min_addr, uint64_t &max_addr)
Definition: JITLoaderGDB.cpp:227
lldb_private::Target::CreateBreakpoint
lldb::BreakpointSP CreateBreakpoint(const FileSpecList *containingModules, const FileSpec &file, uint32_t line_no, uint32_t column, lldb::addr_t offset, LazyBool check_inlines, LazyBool skip_prologue, bool internal, bool request_hardware, LazyBool move_to_nearest_code)
Definition: Target.cpp:331
lldb_private::ArchSpec::GetTriple
llvm::Triple & GetTriple()
Architecture triple accessor.
Definition: ArchSpec.h:444
lldb::addr_t
uint64_t addr_t
Definition: lldb-types.h:83
JITLoaderGDB::GetPluginDescriptionStatic
static const char * GetPluginDescriptionStatic()
Definition: JITLoaderGDB.cpp:430
lldb_private::SymbolContext
Definition: SymbolContext.h:33
lldb_private::Target
Definition: Target.h:450
Section.h
JITLoaderGDB::DebuggerInitialize
static void DebuggerInitialize(lldb_private::Debugger &debugger)
Definition: JITLoaderGDB.cpp:156
lldb_private::Target::GetImages
const ModuleList & GetImages() const
Get accessor for the images for this process.
Definition: Target.h:924
Process.h
JITLoaderGDB::DidSetJITBreakpoint
bool DidSetJITBreakpoint() const
Definition: JITLoaderGDB.cpp:449
lldb_private::ArchSpec::Core
Core
Definition: ArchSpec.h:101
lldb_private::ModuleList::FindSymbolsWithNameAndType
void FindSymbolsWithNameAndType(ConstString name, lldb::SymbolType symbol_type, SymbolContextList &sc_list) const
Definition: ModuleList.cpp:462
Target.h
lldb_private::Properties
Definition: UserSettingsController.h:33
JIT_UNREGISTER_FN
@ JIT_UNREGISTER_FN
Definition: JITLoaderGDB.cpp:38
lldb_private::FileSpec
Definition: FileSpec.h:56
error
static llvm::raw_ostream & error(Stream &strm)
Definition: CommandReturnObject.cpp:17
lldb::eSymbolTypeAny
@ eSymbolTypeAny
Definition: lldb-enumerations.h:613
lldb_private::SymbolContext::symbol
Symbol * symbol
The Symbol for a given query.
Definition: SymbolContext.h:323
lldb_private::ObjectFile::GetSectionList
virtual SectionList * GetSectionList(bool update_module_section_list=true)
Gets the section list for the currently selected architecture (and object for archives).
Definition: ObjectFile.cpp:583
JITLoaderGDB::JITDebugBreakpointHit
static bool JITDebugBreakpointHit(void *baton, lldb_private::StoppointCallbackContext *context, lldb::user_id_t break_id, lldb::user_id_t break_loc_id)
Definition: JITLoaderGDB.cpp:217
LLDBAssert.h
lldb_private::ModuleList::Remove
bool Remove(const lldb::ModuleSP &module_sp, bool notify=true)
Remove a module from the module list.
lldb_private::DataExtractor
Definition: DataExtractor.h:48
lldb_private::ModuleList
Definition: ModuleList.h:72
Log.h
lldb_private::ModuleList::AppendIfNeeded
bool AppendIfNeeded(const lldb::ModuleSP &module_sp, bool notify=true)
Append a module to the module list, if it is not already there.
lldb_private::Target::SetSectionLoadAddress
bool SetSectionLoadAddress(const lldb::SectionSP &section, lldb::addr_t load_addr, bool warn_multiple=false)
Definition: Target.cpp:2824
JITLoaderGDB::GetPluginNameStatic
static lldb_private::ConstString GetPluginNameStatic()
Definition: JITLoaderGDB.cpp:405
JITLoaderGDB::Initialize
static void Initialize()
Definition: JITLoaderGDB.cpp:439
StreamString.h
JITLoaderGDB::m_jit_objects
JITObjectMap m_jit_objects
Definition: JITLoaderGDB.h:72
lldb_private::ConstString
Definition: ConstString.h:40
jit_code_entry::prev_entry
ptr_t prev_entry
Definition: JITLoaderGDB.cpp:42
JITLoaderGDB::ReadJITDescriptorImpl
bool ReadJITDescriptorImpl(bool all_entries)
Definition: JITLoaderGDB.cpp:281
lldb_private::SectionList::GetSectionAtIndex
lldb::SectionSP GetSectionAtIndex(size_t idx) const
Definition: Section.cpp:476
JIT_NOACTION
@ JIT_NOACTION
Definition: JITLoaderGDB.cpp:38
jit_descriptor::relevant_entry
ptr_t relevant_entry
Definition: JITLoaderGDB.cpp:50
lldb_private::Debugger
Definition: Debugger.h:70
JITLoaderGDB::m_jit_break_id
lldb::user_id_t m_jit_break_id
Definition: JITLoaderGDB.h:74
jit_descriptor::version
uint32_t version
Definition: JITLoaderGDB.cpp:48
JITLoaderGDB::DidLaunch
void DidLaunch() override
Called after launching a process.
Definition: JITLoaderGDB.cpp:173
lldb::SymbolType
SymbolType
Symbol types.
Definition: lldb-enumerations.h:612
OptionValueProperties.h
lldb_private::ArchSpec::GetAddressByteSize
uint32_t GetAddressByteSize() const
Returns the size in bytes of an address of the current architecture.
Definition: ArchSpec.cpp:683
ObjectFile.h
LLDB_INVALID_BREAK_ID
#define LLDB_INVALID_BREAK_ID
Definition: lldb-defines.h:49
JITLoaderGDB::ModulesDidLoad
void ModulesDidLoad(lldb_private::ModuleList &module_list) override
Called after a new shared object has been loaded so that it can be probed for JIT entry point hooks.
Definition: JITLoaderGDB.cpp:179
Symbol.h
lldbassert
#define lldbassert(x)
Definition: LLDBAssert.h:15
jit_actions_t
jit_actions_t
Definition: JITLoaderGDB.cpp:38
lldb_private::Target::GetArchitecture
const ArchSpec & GetArchitecture() const
Definition: Target.h:966
lldb_private::Status
Definition: Status.h:44
uint32_t
lldb_private::JITLoader
Definition: JITLoader.h:27
JITLoaderGDB::ReadJITDescriptor
bool ReadJITDescriptor(bool all_entries)
Definition: JITLoaderGDB.cpp:273
lldb_private::Address
Definition: Address.h:59
lldb_private::Target::ModulesDidLoad
void ModulesDidLoad(ModuleList &module_list)
Definition: Target.cpp:1613
lldb_private::Breakpoint::SetCallback
void SetCallback(BreakpointHitCallback callback, void *baton, bool is_synchronous=false)
Set the callback action invoked when the breakpoint is hit.
Definition: Breakpoint.cpp:412
lldb_private::Address::GetLoadAddress
lldb::addr_t GetLoadAddress(Target *target) const
Get the load address.
Definition: Address.cpp:310
PluginManager.h
lldb_private::Target::RemoveBreakpointByID
bool RemoveBreakpointByID(lldb::break_id_t break_id)
Definition: Target.cpp:934
lldb_private::Target::GetSectionLoadList
SectionLoadList & GetSectionLoadList()
Definition: Target.h:1039
LLDB_INVALID_ADDRESS
#define LLDB_INVALID_ADDRESS
Definition: lldb-defines.h:86
JITLoaderGDB
Definition: JITLoaderGDB.h:17
JITLoaderGDB::GetSymbolAddress
lldb::addr_t GetSymbolAddress(lldb_private::ModuleList &module_list, lldb_private::ConstString name, lldb::SymbolType symbol_type) const
Definition: JITLoaderGDB.cpp:453
lldb_private::SymbolContextList::IsEmpty
bool IsEmpty() const
Definition: SymbolContext.cpp:1280
lldb_private::SectionLoadList::SetSectionUnloaded
bool SetSectionUnloaded(const lldb::SectionSP &section_sp, lldb::addr_t load_addr)
Definition: SectionLoadList.cpp:172
lldb::user_id_t
uint64_t user_id_t
Definition: lldb-types.h:84
SymbolContext.h
ObjectFileMachO.h
jit_code_entry::next_entry
ptr_t next_entry
Definition: JITLoaderGDB.cpp:41
jit_descriptor::first_entry
ptr_t first_entry
Definition: JITLoaderGDB.cpp:51
lldb_private
A class that represents a running process on the host machine.
Definition: SBCommandInterpreterRunOptions.h:16
JITLoaderGDB::GetPluginName
lldb_private::ConstString GetPluginName() override
Definition: JITLoaderGDB.cpp:435
Breakpoint.h
JITLoaderGDB::JITLoaderGDB
JITLoaderGDB(lldb_private::Process *process)
Definition: JITLoaderGDB.cpp:146
JITLoaderGDB::DidAttach
void DidAttach() override
Called after attaching a process.
Definition: JITLoaderGDB.cpp:167
JIT_REGISTER_FN
@ JIT_REGISTER_FN
Definition: JITLoaderGDB.cpp:38
lldb_private::Process::GetByteOrder
lldb::ByteOrder GetByteOrder() const
Definition: Process.cpp:3336
LLDB_PLUGIN_DEFINE
#define LLDB_PLUGIN_DEFINE(PluginName)
Definition: PluginManager.h:31
lldb_private::Log
Definition: Log.h:49
lldb_private::GetLogIfAnyCategoriesSet
Log * GetLogIfAnyCategoriesSet(uint32_t mask)
Definition: Logging.cpp:62
SymbolVendor.h
lldb_private::DataBufferHeap
Definition: DataBufferHeap.h:30
jit_descriptor
Definition: JITLoaderGDB.cpp:47
JITLoaderGDB::SetJITBreakpoint
void SetJITBreakpoint(lldb_private::ModuleList &module_list)
Definition: JITLoaderGDB.cpp:185
lldb
Definition: SBAddress.h:15
lldb_private::ObjectFile
Definition: ObjectFile.h:58
jit_descriptor::action_flag
uint32_t action_flag
Definition: JITLoaderGDB.cpp:49
lldb_private::ModuleList::Append
void Append(const lldb::ModuleSP &module_sp, bool notify=true)
Append a module to the module list.
DataBufferHeap.h
lldb_private::Breakpoint
General Outline: A breakpoint has four main parts, a filter, a resolver, the list of breakpoint locat...
Definition: Breakpoint.h:79
jit_code_entry::symfile_addr
ptr_t symfile_addr
Definition: JITLoaderGDB.cpp:43
JITLoaderGDB::m_jit_descriptor_addr
lldb::addr_t m_jit_descriptor_addr
Definition: JITLoaderGDB.h:75
lldb_private::Symbol::GetAddress
Address GetAddress() const
Definition: Symbol.h:73