Skip to content
Snippets Groups Projects
Commit 1bdad2e0 authored by Tristan Gingold's avatar Tristan Gingold
Browse files

solib-darwin: simplify code.

Use bfd_mach_o_get_base_address to extract load address.

gdb/
	* solib-darwin.c (darwin_solib_create_inferior_hook): Simplify
	code by using bfd_mach_o_get_base_address.
parent 4384b284
No related branches found
No related tags found
No related merge requests found
2014-04-18 Tristan Gingold <gingold@adacore.com>
* solib-darwin.c (darwin_solib_create_inferior_hook): Simplify
code by using bfd_mach_o_get_base_address.
2014-04-17 Ulrich Weigand <uweigand@de.ibm.com> 2014-04-17 Ulrich Weigand <uweigand@de.ibm.com>
* spu-tdep.c: Include "dwarf2-frame.h" and "ax.h". * spu-tdep.c: Include "dwarf2-frame.h" and "ax.h".
......
...@@ -524,26 +524,10 @@ darwin_solib_create_inferior_hook (int from_tty) ...@@ -524,26 +524,10 @@ darwin_solib_create_inferior_hook (int from_tty)
load_addr = darwin_read_exec_load_addr (info); load_addr = darwin_read_exec_load_addr (info);
if (load_addr != 0 && symfile_objfile != NULL) if (load_addr != 0 && symfile_objfile != NULL)
{ {
CORE_ADDR vmaddr = 0; CORE_ADDR vmaddr;
struct mach_o_data_struct *md = bfd_mach_o_get_data (exec_bfd);
unsigned int i, num;
/* Find the base address of the executable. */ /* Find the base address of the executable. */
for (i = 0; i < md->header.ncmds; i++) vmaddr = bfd_mach_o_get_base_address (exec_bfd);
{
struct bfd_mach_o_load_command *cmd = &md->commands[i];
if (cmd->type != BFD_MACH_O_LC_SEGMENT
&& cmd->type != BFD_MACH_O_LC_SEGMENT_64)
continue;
if (cmd->command.segment.fileoff == 0
&& cmd->command.segment.vmaddr != 0
&& cmd->command.segment.filesize != 0)
{
vmaddr = cmd->command.segment.vmaddr;
break;
}
}
/* Relocate. */ /* Relocate. */
if (vmaddr != load_addr) if (vmaddr != load_addr)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment