[debugserver] Clear memory allocations after exec

After an exec, the inferior is a new process and none of these memory
regions are still allocated. Clear them out.

Differential Revision: https://reviews.llvm.org/D140253
This commit is contained in:
Alex Langford 2022-12-16 16:19:40 -08:00
parent b4ad387ec5
commit 58def623ca
3 changed files with 9 additions and 0 deletions

View File

@ -2285,6 +2285,7 @@ task_t MachProcess::ExceptionMessageBundleComplete() {
m_thread_list.Clear();
m_activities.Clear();
m_breakpoints.DisableAll();
m_task.ClearAllocations();
}
if (m_sent_interrupt_signo != 0) {

View File

@ -61,6 +61,7 @@ public:
nub_addr_t AllocateMemory(nub_size_t size, uint32_t permissions);
nub_bool_t DeallocateMemory(nub_addr_t addr);
void ClearAllocations();
mach_port_t ExceptionPort() const;
bool ExceptionPortIsValid() const;

View File

@ -999,6 +999,13 @@ nub_bool_t MachTask::DeallocateMemory(nub_addr_t addr) {
return false;
}
//----------------------------------------------------------------------
// MachTask::ClearAllocations
//----------------------------------------------------------------------
void MachTask::ClearAllocations() {
m_allocations.clear();
}
void MachTask::TaskPortChanged(task_t task)
{
m_task = task;