aboutsummaryrefslogtreecommitdiff
path: root/gdb/solib-darwin.c
diff options
context:
space:
mode:
authorTristan Gingold <tristan.gingold@adacore.com>2014-04-18 11:03:46 +0200
committerTristan Gingold <tristan.gingold@adacore.com>2014-04-18 11:03:46 +0200
commit1bdad2e0421a56e16c0f4623e6320e1225cbe5ee (patch)
tree95fabe7f4e9c683076656a1e6619aa90e202f02b /gdb/solib-darwin.c
parent4384b28422294779be111ac24fb34fb6bfe57b32 (diff)
downloadgdb-1bdad2e0421a56e16c0f4623e6320e1225cbe5ee.zip
gdb-1bdad2e0421a56e16c0f4623e6320e1225cbe5ee.tar.gz
gdb-1bdad2e0421a56e16c0f4623e6320e1225cbe5ee.tar.bz2
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.
Diffstat (limited to 'gdb/solib-darwin.c')
-rw-r--r--gdb/solib-darwin.c20
1 files changed, 2 insertions, 18 deletions
diff --git a/gdb/solib-darwin.c b/gdb/solib-darwin.c
index a9989ea..03b51d5 100644
--- a/gdb/solib-darwin.c
+++ b/gdb/solib-darwin.c
@@ -524,26 +524,10 @@ darwin_solib_create_inferior_hook (int from_tty)
load_addr = darwin_read_exec_load_addr (info);
if (load_addr != 0 && symfile_objfile != NULL)
{
- CORE_ADDR vmaddr = 0;
- struct mach_o_data_struct *md = bfd_mach_o_get_data (exec_bfd);
- unsigned int i, num;
+ CORE_ADDR vmaddr;
/* Find the base address of the executable. */
- for (i = 0; i < md->header.ncmds; i++)
- {
- 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;
- }
- }
+ vmaddr = bfd_mach_o_get_base_address (exec_bfd);
/* Relocate. */
if (vmaddr != load_addr)