diff options
author | Tristan Gingold <gingold@adacore.com> | 2015-11-23 11:45:05 +0100 |
---|---|---|
committer | Tristan Gingold <gingold@adacore.com> | 2015-11-23 14:52:12 +0100 |
commit | ad2073b0b48e23028ca9b4d348970690d4501933 (patch) | |
tree | a0e1d02709dd1144ef9fb83d3f2cce13c6218abe /gdb/darwin-nat.c | |
parent | 3eb831e0ca5aa3035845fc039c58c6340fd51c31 (diff) | |
download | gdb-ad2073b0b48e23028ca9b4d348970690d4501933.zip gdb-ad2073b0b48e23028ca9b4d348970690d4501933.tar.gz gdb-ad2073b0b48e23028ca9b4d348970690d4501933.tar.bz2 |
solib-darwin: support PIE for spawned processes.
solib-darwin is now able to read the load address of the executable
before any inferior execution.
Diffstat (limited to 'gdb/darwin-nat.c')
-rw-r--r-- | gdb/darwin-nat.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/gdb/darwin-nat.c b/gdb/darwin-nat.c index 7ad6b22..cb2b08e 100644 --- a/gdb/darwin-nat.c +++ b/gdb/darwin-nat.c @@ -1965,7 +1965,7 @@ darwin_read_write_inferior (task_t task, CORE_ADDR addr, } /* Read LENGTH bytes at offset ADDR of task_dyld_info for TASK, and copy them - to RDADDR. + to RDADDR (in big endian). Return 0 on failure; number of bytes read / written otherwise. */ #ifdef TASK_DYLD_INFO_COUNT @@ -1979,17 +1979,17 @@ darwin_read_dyld_info (task_t task, CORE_ADDR addr, gdb_byte *rdaddr, int sz = TASK_DYLD_INFO_COUNT * sizeof (natural_t); kern_return_t kret; - if (addr >= sz) + if (addr != 0 || length > sizeof (mach_vm_address_t)) return TARGET_XFER_EOF; - kret = task_info (task, TASK_DYLD_INFO, (task_info_t) &task_dyld_info, &count); + kret = task_info (task, TASK_DYLD_INFO, + (task_info_t) &task_dyld_info, &count); MACH_CHECK_ERROR (kret); if (kret != KERN_SUCCESS) return TARGET_XFER_E_IO; - /* Truncate. */ - if (addr + length > sz) - length = sz - addr; - memcpy (rdaddr, (char *)&task_dyld_info + addr, length); + + store_unsigned_integer (rdaddr, length, BFD_ENDIAN_BIG, + task_dyld_info.all_image_info_addr); *xfered_len = (ULONGEST) length; return TARGET_XFER_OK; } |