| 28 | |
| 29 | |
| 30 | DebugAdapter::DebugAdapter(BinaryView* data) |
| 31 | { |
| 32 | INIT_DEBUGGER_API_OBJECT(); |
| 33 | |
| 34 | // These are just a workaround to avoid holding a reference to the data. Note, when DebugAdapter is constructed, |
| 35 | // the binary view passed in is the one *before* rebasing. After the debugger launches the target and rebases the |
| 36 | // binary view, the un-rebased binary view is released by the core and the debugger becomes the only place where |
| 37 | // we hold a reference to it. |
| 38 | // Though, a better approach would be to add a function SetData() to the DebugAdapter class and update the binary |
| 39 | // view after the launch, similar to what we do for the DebuggerController. However, we will need to add new APIs |
| 40 | // to get the original image base of the binary view, because LLDB requires the breakpoint address be relative to |
| 41 | // the original image base, and it does not work with a rebased one. |
| 42 | m_entryPoint = data->GetEntryPoint(); |
| 43 | // For shared libraries which do not have a valid entry point, the GetEntryPoint will return 0x0 anyways. |
| 44 | // Here we check if there is actually a function at the entry point, to determine if the entry point is real. |
| 45 | m_hasEntryFunction = (data->GetAnalysisEntryPoint() != nullptr); |
| 46 | m_start = data->GetStart(); |
| 47 | if (data->GetDefaultArchitecture()) |
| 48 | m_defaultArchitecture = data->GetDefaultArchitecture()->GetName(); |
| 49 | |
| 50 | m_originalFileName = data->GetFile()->GetOriginalFilename(); |
| 51 | } |
| 52 | |
| 53 | |
| 54 | void DebugAdapter::PostDebuggerEvent(const DebuggerEvent& event) |