Added optional calls to lldb_private::Process for getting memory region info

from a process and hooked it up to the new packet that was recently added
to our GDB remote executable named debugserver. Now Process has the following
new calls:

virtual Error
Process::GetMemoryRegionInfo (lldb::addr_t load_addr, MemoryRegionInfo &range_info);

virtual uint32_t
GetLoadAddressPermissions (lldb::addr_t load_addr);

Only the first one needs to be implemented by subclasses that can add this
support.

Cleaned up the way the new packet was implemented in debugserver to be more
useful as an API inside debugserver. Also found an error where finding a region
for an address actually will pick up the next region that follows the address
in the query so we also need ot make sure that the address we requested the
region for falls into the region that gets returned.

llvm-svn: 144976
This commit is contained in:
Greg Clayton
2011-11-18 07:03:08 +00:00
parent 7ba18027e9
commit 46fb558df1
17 changed files with 291 additions and 55 deletions

View File

@@ -208,14 +208,19 @@ MachTask::WriteMemory (nub_addr_t addr, nub_size_t size, const void *buf)
// MachTask::MemoryRegionInfo
//----------------------------------------------------------------------
int
MachTask::MemoryRegionInfo (nub_addr_t addr, char *outbuf, nub_size_t outbufsize)
MachTask::GetMemoryRegionInfo (nub_addr_t addr, DNBRegionInfo *region_info)
{
task_t task = TaskPort();
if (task == TASK_NULL)
return -1;
int ret = m_vm_memory.MemoryRegionInfo(task, addr, outbuf, outbufsize);
DNBLogThreadedIf(LOG_MEMORY, "MachTask::MemoryRegionInfo ( addr = 0x%8.8llx ) => %d", (uint64_t)addr, ret);
int ret = m_vm_memory.GetMemoryRegionInfo(task, addr, region_info);
DNBLogThreadedIf(LOG_MEMORY, "MachTask::MemoryRegionInfo ( addr = 0x%8.8llx ) => %i (start = 0x%8.8llx, size = 0x%8.8llx, permissions = %u)",
(uint64_t)addr,
ret,
(uint64_t)region_info->addr,
(uint64_t)region_info->size,
region_info->permissions);
return ret;
}