diff options
author | Christophe Lyon <christophe.lyon@linaro.org> | 2019-07-11 16:54:41 +0200 |
---|---|---|
committer | Christophe Lyon <christophe.lyon@linaro.org> | 2019-07-11 16:54:41 +0200 |
commit | 68b4faa22a21ef0bd103f1dce50bb4a263559395 (patch) | |
tree | aa9edd74014f72d99e478210c95ec82cf9af1540 | |
parent | 548c794021c606a2aae2cb9c44e2b0ac338a75d6 (diff) | |
download | gdb-users/clyon/arm-fdpic-wip-gdb-8.2.zip gdb-users/clyon/arm-fdpic-wip-gdb-8.2.tar.gz gdb-users/clyon/arm-fdpic-wip-gdb-8.2.tar.bz2 |
FDPIC WIPusers/clyon/arm-fdpic-wip-gdb-8.2
-rw-r--r-- | gdb/arm-linux-tdep.c | 8 | ||||
-rw-r--r-- | gdb/arm-tdep.c | 7 | ||||
-rw-r--r-- | gdb/gdbserver/configure.srv | 2 | ||||
-rw-r--r-- | gdb/gdbserver/fork-child.c | 9 | ||||
-rw-r--r-- | gdb/gdbserver/linux-arm-low.c | 2 | ||||
-rw-r--r-- | gdb/gdbserver/linux-low.c | 34 | ||||
-rw-r--r-- | gdb/gdbserver/remote-utils.c | 6 | ||||
-rw-r--r-- | gdb/gdbserver/server.c | 9 | ||||
-rw-r--r-- | gdb/gnulib/import/getcwd.c | 8 | ||||
-rw-r--r-- | gdb/nat/fork-inferior.c | 1 | ||||
-rw-r--r-- | gdb/nat/linux-ptrace.h | 5 | ||||
-rw-r--r-- | gdb/remote.c | 14 | ||||
-rw-r--r-- | gdb/solib-fdpic.c | 74 | ||||
-rw-r--r-- | gdb/solib-frv.c | 8 | ||||
-rw-r--r-- | gdb/top.c | 2 |
15 files changed, 168 insertions, 21 deletions
diff --git a/gdb/arm-linux-tdep.c b/gdb/arm-linux-tdep.c index a571e8b..a2e05dc 100644 --- a/gdb/arm-linux-tdep.c +++ b/gdb/arm-linux-tdep.c @@ -1778,12 +1778,14 @@ arm_linux_init_abi (struct gdbarch_info info, } tdep->jb_elt_size = ARM_LINUX_JB_ELEMENT_SIZE; +#if 0 if (tdep->is_fdpic) { set_solib_ops (gdbarch, &fdpic_so_ops); } else { +#endif set_solib_svr4_fetch_link_map_offsets (gdbarch, svr4_ilp32_fetch_link_map_offsets); - } + // } /* Single stepping. */ set_gdbarch_software_single_step (gdbarch, arm_linux_software_single_step); @@ -1793,13 +1795,15 @@ arm_linux_init_abi (struct gdbarch_info info, set_gdbarch_skip_solib_resolver (gdbarch, glibc_skip_solib_resolver); /* Enable TLS support. */ +#if 0 if (tdep->is_fdpic) { set_gdbarch_fetch_tls_load_module_address (gdbarch, fdpic_fetch_objfile_link_map); } else { +#endif set_gdbarch_fetch_tls_load_module_address (gdbarch, svr4_fetch_objfile_link_map); - } + // } tramp_frame_prepend_unwinder (gdbarch, &arm_linux_sigreturn_tramp_frame); diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c index 157f926..540b612 100644 --- a/gdb/arm-tdep.c +++ b/gdb/arm-tdep.c @@ -8925,6 +8925,7 @@ arm_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) enum arm_float_model fp_model = arm_fp_model; struct tdesc_arch_data *tdesc_data = NULL; int i, is_m = 0; + int is_fdpic = 0; int vfp_register_count = 0, have_vfp_pseudos = 0, have_neon_pseudos = 0; int have_wmmx_registers = 0; int have_neon = 0; @@ -8957,10 +8958,13 @@ arm_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) anyway, so assume APCS. */ arm_abi = ARM_ABI_APCS; } - else if (ei_osabi == ELFOSABI_NONE || ei_osabi == ELFOSABI_GNU) + else if (ei_osabi == ELFOSABI_NONE || ei_osabi == ELFOSABI_GNU || ei_osabi == ELFOSABI_ARM_FDPIC) { int eabi_ver = EF_ARM_EABI_VERSION (e_flags); + if (ei_osabi == ELFOSABI_ARM_FDPIC) + is_fdpic = 1; + switch (eabi_ver) { case EF_ARM_EABI_UNKNOWN: @@ -9296,6 +9300,7 @@ arm_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) tdep->arm_abi = arm_abi; tdep->fp_model = fp_model; tdep->is_m = is_m; + tdep->is_fdpic = is_fdpic; tdep->have_fpa_registers = have_fpa_registers; tdep->have_wmmx_registers = have_wmmx_registers; gdb_assert (vfp_register_count == 0 diff --git a/gdb/gdbserver/configure.srv b/gdb/gdbserver/configure.srv index d19d22b..7c8820e 100644 --- a/gdb/gdbserver/configure.srv +++ b/gdb/gdbserver/configure.srv @@ -62,7 +62,7 @@ case "${target}" in ipa_obj="${ipa_obj} linux-aarch64-tdesc-ipa.o" ipa_obj="${ipa_obj} arch/aarch64-ipa.o" ;; - arm*-*-linux*) srv_regobj="reg-arm.o arm-with-iwmmxt.o" + arm*-*-linux*|arm*-*uclinuxfdpiceabi) srv_regobj="reg-arm.o arm-with-iwmmxt.o" srv_regobj="${srv_regobj} arm-with-vfpv2.o" srv_regobj="${srv_regobj} arm-with-vfpv3.o" srv_regobj="${srv_regobj} arm-with-neon.o" diff --git a/gdb/gdbserver/fork-child.c b/gdb/gdbserver/fork-child.c index 0dfd69d..19ce2e3 100644 --- a/gdb/gdbserver/fork-child.c +++ b/gdb/gdbserver/fork-child.c @@ -94,6 +94,8 @@ gdb_flush_out_err () /* See server.h. */ +void my_read_loadmap(const char*); +void my_hack_loadmap(const char*); void post_fork_inferior (int pid, const char *program) { @@ -107,12 +109,19 @@ post_fork_inferior (int pid, const char *program) atexit (restore_old_foreground_pgrp); #endif + fprintf(stderr, "GDBSERVER: %s before startup_inferior %s PID %d\n", __FUNCTION__, program, pid); + my_read_loadmap(__FUNCTION__); + my_hack_loadmap(__FUNCTION__); startup_inferior (pid, START_INFERIOR_TRAPS_EXPECTED, &cs.last_status, &cs.last_ptid); + fprintf(stderr, "GDBSERVER: %s after startup_inferior\n", __FUNCTION__); + my_read_loadmap(__FUNCTION__); current_thread->last_resume_kind = resume_stop; current_thread->last_status = cs.last_status; signal_pid = pid; target_post_create_inferior (); + fprintf(stderr, "GDBSERVER: %s after post_create_inferior\n", __FUNCTION__); + my_read_loadmap(__FUNCTION__); fprintf (stderr, "Process %s created; pid = %d\n", program, pid); fflush (stderr); } diff --git a/gdb/gdbserver/linux-arm-low.c b/gdb/gdbserver/linux-arm-low.c index 6c2dcea..68646f1 100644 --- a/gdb/gdbserver/linux-arm-low.c +++ b/gdb/gdbserver/linux-arm-low.c @@ -120,11 +120,13 @@ struct arch_lwp_info }; /* These are in <asm/elf.h> in current kernels. */ +#ifndef __FDPIC__ #define HWCAP_VFP 64 #define HWCAP_IWMMXT 512 #define HWCAP_NEON 4096 #define HWCAP_VFPv3 8192 #define HWCAP_VFPv3D16 16384 +#endif #ifdef HAVE_SYS_REG_H #include <sys/reg.h> diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c index 701f3e8..0dc6729 100644 --- a/gdb/gdbserver/linux-low.c +++ b/gdb/gdbserver/linux-low.c @@ -995,6 +995,7 @@ linux_ptrace_fun () PROGRAM is the name of the program to be started, and PROGRAM_ARGS are its arguments. */ +void my_read_loadmap(const char* fnname); static int linux_create_inferior (const char *program, const std::vector<char *> &program_args) @@ -1004,6 +1005,8 @@ linux_create_inferior (const char *program, int pid; ptid_t ptid; + fprintf(stderr, "GDBSERVER: %s before fork_inferior\n", __FUNCTION__); + my_read_loadmap(__FUNCTION__); { maybe_disable_address_space_randomization restore_personality (cs.disable_randomization); @@ -1015,6 +1018,8 @@ linux_create_inferior (const char *program, NULL, NULL, NULL, NULL); } + fprintf(stderr, "GDBSERVER: %s after fork_inferior\n", __FUNCTION__); + my_read_loadmap(__FUNCTION__); linux_add_process (pid, 0); ptid = ptid_t (pid, pid, 0); @@ -6517,6 +6522,30 @@ struct target_loadmap # define LINUX_LOADMAP_INTERP PTRACE_GETFDPIC_INTERP # endif +void my_read_loadmap(const char* fnname) +{ +#if 0 + struct target_loadmap *data = (struct target_loadmap *)0x7dffff38; +#ifdef __FDPIC__ + fprintf(stderr, "GDBSERVER: %s from %s data forced %p version %d, nsegs=%d\n", __FUNCTION__, fnname, data, data->version, data->nsegs); +#else + fprintf(stderr, "GDBSERVER: %s from %s data forced %p, version/nsegs disabled\n", __FUNCTION__, fnname, data); +#endif +#endif +} +void my_hack_loadmap(const char* fnname) +{ +#if 0 + struct target_loadmap *data = (struct target_loadmap *)0x7dffff38; +#ifdef __FDPIC__ + data->version = 1; + data->nsegs = 1; + fprintf(stderr, "GDBSERVER: %s from %s data forced %p version %d, nsegs=%d\n", __FUNCTION__, fnname, data, data->version, data->nsegs); +#else + fprintf(stderr, "GDBSERVER: %s from %s data forced %p disabled\n", __FUNCTION__, fnname, data); +#endif +#endif +} static int linux_read_loadmap (const char *annex, CORE_ADDR offset, unsigned char *myaddr, unsigned int len) @@ -6533,20 +6562,25 @@ linux_read_loadmap (const char *annex, CORE_ADDR offset, else return -1; + fprintf(stderr, "GDBSERVER: %s before ptrace %s\n", __FUNCTION__, annex); if (ptrace (LINUX_LOADMAP, pid, addr, &data) != 0) return -1; + fprintf(stderr, "GDBSERVER: %s ptrace OK data %p\n", __FUNCTION__, data); if (data == NULL) return -1; + fprintf(stderr, "GDBSERVER: %s data OK, data %p version %d, nsegs=%d\n", __FUNCTION__, data, data->version, data->nsegs); actual_length = sizeof (struct target_loadmap) + sizeof (struct target_loadseg) * data->nsegs; if (offset < 0 || offset > actual_length) return -1; + fprintf(stderr, "GDBSERVER: %s actual_length %d\n", __FUNCTION__, actual_length); copy_length = actual_length - offset < len ? actual_length - offset : len; memcpy (myaddr, (char *) data + offset, copy_length); + fprintf(stderr, "GDBSERVER: %s copy_length=%d\n", __FUNCTION__, copy_length); return copy_length; } #else diff --git a/gdb/gdbserver/remote-utils.c b/gdb/gdbserver/remote-utils.c index 9199a9c..f3f5e61 100644 --- a/gdb/gdbserver/remote-utils.c +++ b/gdb/gdbserver/remote-utils.c @@ -221,6 +221,7 @@ handle_accept_event (int err, gdb_client_data client_data) threads' status ('?'). */ target_async (0); + // fprintf(stderr, "GDBSERVER: %s returns 0\n", __FUNCTION__); return 0; } @@ -325,6 +326,7 @@ remote_prepare (const char *name) cs.transport_is_reliable = 1; } +void my_read_loadmap(const char*); /* Open a connection to a remote debugger. NAME is the filename used for communication. */ @@ -334,6 +336,7 @@ remote_open (const char *name) const char *port_str; port_str = strchr (name, ':'); + fprintf(stderr, "GDBSERVER: %s name |%s| port_str %s\n", __FUNCTION__, name, port_str); #ifdef USE_WIN32API if (port_str == NULL) error ("Only HOST:PORT is supported on this platform."); @@ -413,12 +416,14 @@ remote_open (const char *name) gai_strerror (r)); else fprintf (stderr, _("Listening on port %s\n"), listen_port); + my_read_loadmap(__FUNCTION__); fflush (stderr); /* Register the event loop handler. */ add_file_handler (listen_desc, handle_accept_event, NULL); } + // fprintf(stderr, "GDBSERVER: %s returns\n", __FUNCTION__); } void @@ -957,6 +962,7 @@ process_remaining (void *context) else res = 0; + // fprintf(stderr, "GDBSERVER: %s returns %d\n", __FUNCTION__, res); return res; } diff --git a/gdb/gdbserver/server.c b/gdb/gdbserver/server.c index 4ec3548..91cbef4 100644 --- a/gdb/gdbserver/server.c +++ b/gdb/gdbserver/server.c @@ -2057,6 +2057,7 @@ handle_qxfer (char *own_buf, int packet_len, int *new_packet_len_p) *new_packet_len_p = write_qxfer_response (own_buf, data, n, 0); free (data); + // fprintf(stderr, "GDBSERVER: %s packet size n %d\n", __FUNCTION__, n); return 1; } else if (strcmp (rw, "write") == 0) @@ -3577,7 +3578,9 @@ captured_main (int argc, char *argv[]) const char *selftest_filter = NULL; #endif + // printf("GDBSERVER HELLO\n"); current_directory = getcwd (NULL, 0); + // printf("GDBSERVER HELLO2 CWD=%s\n", current_directory); client_state &cs = get_client_state (); if (current_directory == NULL) @@ -3588,6 +3591,7 @@ captured_main (int argc, char *argv[]) while (*next_arg != NULL && **next_arg == '-') { + fprintf(stderr, "GDBSERVER: %s next_arg %s\n", __FUNCTION__, *next_arg); if (strcmp (*next_arg, "--version") == 0) { gdbserver_version (); @@ -3725,6 +3729,7 @@ captured_main (int argc, char *argv[]) if (port == NULL) { port = *next_arg; + fprintf(stderr, "GDBSERVER: %s port %s\n", __FUNCTION__, port); next_arg++; } if ((port == NULL || (!attach && !multi_mode && *next_arg == NULL)) @@ -3746,6 +3751,7 @@ captured_main (int argc, char *argv[]) start_inferior. */ if (port != NULL) remote_prepare (port); + fprintf(stderr, "GDBSERVER: %s port after remote_prepare %s\n", __FUNCTION__, port); bad_attach = 0; pid = 0; @@ -3805,6 +3811,7 @@ captured_main (int argc, char *argv[]) program_args.push_back (xstrdup (next_arg[i])); program_args.push_back (NULL); + fprintf(stderr, "GDBSERVER: %s port before create_inferior %s\n", __FUNCTION__, port); /* Wait till we are at first instruction in program. */ create_inferior (program_path.get (), program_args); @@ -3841,6 +3848,7 @@ captured_main (int argc, char *argv[]) if (!was_running && !multi_mode) error ("No program to debug"); + fprintf(stderr, "GDBSERVER: %s port before remote_open %s\n", __FUNCTION__, port); while (1) { cs.noack_mode = 0; @@ -4378,6 +4386,7 @@ process_serial_event (void) if (exit_requested) return -1; + // fprintf(stderr, "GDBSERVER: %s returns 0\n", __FUNCTION__); return 0; } diff --git a/gdb/gnulib/import/getcwd.c b/gdb/gnulib/import/getcwd.c index e1265fd..0c4775b 100644 --- a/gdb/gnulib/import/getcwd.c +++ b/gdb/gnulib/import/getcwd.c @@ -66,6 +66,7 @@ #endif #include "pathmax.h" +#include <stdio.h> /* In this file, PATH_MAX only serves as a threshold for choosing among two algorithms. */ @@ -212,6 +213,8 @@ __getcwd (char *buf, size_t size) rootdev = st.st_dev; rootino = st.st_ino; + // printf("TOTO GDB: thisdev %d thisino %d\n", thisdev, thisino); + // printf("TOTO GDB: rootdev %d rootino %d\n", rootdev, rootino); while (!(thisdev == rootdev && thisino == rootino)) { struct dirent *d; @@ -223,6 +226,7 @@ __getcwd (char *buf, size_t size) size_t namlen; bool use_d_ino = true; + // printf("TOTO GDB: going up\n"); /* Look at the parent directory. */ #if HAVE_OPENAT_SUPPORT fd = openat (fd, "..", O_RDONLY); @@ -249,6 +253,7 @@ __getcwd (char *buf, size_t size) dotdev = st.st_dev; dotino = st.st_ino; mount_point = dotdev != thisdev; + // printf("TOTO GDB: mount_point: %d dotdev %d dotino %d\n", mount_point, dotdev, dotino); /* Search for the last directory. */ #if HAVE_OPENAT_SUPPORT @@ -267,6 +272,7 @@ __getcwd (char *buf, size_t size) /* Clear errno to distinguish EOF from error if readdir returns NULL. */ __set_errno (0); + // printf("TOTO GDB before readdir\n"); d = __readdir (dirstream); /* When we've iterated through all directory entries without finding @@ -278,11 +284,13 @@ __getcwd (char *buf, size_t size) via lstat. */ if (d == NULL && errno == 0 && use_d_ino) { + // printf("TOTO GDB weird: d=%p errno=%d\n", d, errno); use_d_ino = false; rewinddir (dirstream); d = __readdir (dirstream); } + // printf("TOTO GDB: d=%p errno=%d name %s\n", d, errno, d != NULL ? d->d_name : "null"); if (d == NULL) { if (errno == 0) diff --git a/gdb/nat/fork-inferior.c b/gdb/nat/fork-inferior.c index f1032b4..eb53137 100644 --- a/gdb/nat/fork-inferior.c +++ b/gdb/nat/fork-inferior.c @@ -28,6 +28,7 @@ #include "signals-state-save-restore.h" #include "gdb_tilde_expand.h" #include <vector> +#include "nat/linux-ptrace.h" extern char **environ; diff --git a/gdb/nat/linux-ptrace.h b/gdb/nat/linux-ptrace.h index 98b44a8..25d2701 100644 --- a/gdb/nat/linux-ptrace.h +++ b/gdb/nat/linux-ptrace.h @@ -24,7 +24,7 @@ struct buffer; #include "gdb_wait.h" #ifdef __UCLIBC__ -#if !(defined(__UCLIBC_HAS_MMU__) || defined(__ARCH_HAS_MMU__)) +#if !(defined(__UCLIBC_HAS_MMU__) || defined(__ARCH_USE_MMU__)) /* PTRACE_TEXT_ADDR and friends. */ #include <asm/ptrace.h> #define HAS_NOMMU @@ -83,7 +83,8 @@ struct buffer; #define PTRACE_O_EXITKILL 0x00100000 #endif -#if (defined __bfin__ || defined __frv__ || defined __sh__) \ +#if (defined __bfin__ || defined __frv__ || defined __sh__ \ + || defined __arm__ ) \ && !defined PTRACE_GETFDPIC #define PTRACE_GETFDPIC 31 #define PTRACE_GETFDPIC_EXEC 0 diff --git a/gdb/remote.c b/gdb/remote.c index 90b5dab..eb40720 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -1920,6 +1920,9 @@ packet_ok (const char *buf, struct packet_config *config) { enum packet_result result; + fprintf (stderr, + "GDB: %s Packet %s (%s)\n", __FUNCTION__, + config->name, config->title); if (config->detect != AUTO_BOOLEAN_TRUE && config->support == PACKET_DISABLE) internal_error (__FILE__, __LINE__, @@ -4570,6 +4573,7 @@ remote_target::start_remote (int from_tty, int extended_p) { const char v_mustreplyempty[] = "vMustReplyEmpty"; + fprintf(stderr, "GDB: %s 'v' must-reply-empty\n", __FUNCTION__); putpkt (v_mustreplyempty); getpkt (&rs->buf, &rs->buf_size, 0); if (strcmp (rs->buf, "OK") == 0) @@ -5374,6 +5378,8 @@ remote_target::remote_query_supported () } for (i = 0; i < ARRAY_SIZE (remote_protocol_features); i++) + { + // fprintf(stderr, "GDB: %s comparing %s with %s\n", __FUNCTION__, remote_protocol_features[i].name, p); if (strcmp (remote_protocol_features[i].name, p) == 0) { const struct protocol_feature *feature; @@ -5383,6 +5389,7 @@ remote_target::remote_query_supported () feature->func (this, feature, is_supported, value); break; } + } } /* If we increased the packet size, make sure to increase the global @@ -10798,6 +10805,10 @@ remote_target::remote_read_qxfer (const char *object_name, struct remote_state *rs = get_remote_state (); LONGEST i, n, packet_len; + if (!strcmp(object_name, "fdpic")) { + if (packet_config_support (packet) == PACKET_DISABLE) + fprintf(stderr, "GDB: %s DISABLED\n", __FUNCTION__); + } if (packet_config_support (packet) == PACKET_DISABLE) return TARGET_XFER_E_IO; @@ -10837,6 +10848,9 @@ remote_target::remote_read_qxfer (const char *object_name, if (packet_len < 0 || packet_ok (rs->buf, packet) != PACKET_OK) return TARGET_XFER_E_IO; + if (!strcmp(object_name, "fdpic")) { + fprintf(stderr, "GDB: %s apres getpkt fdpic packet_len %ld\n", __FUNCTION__, packet_len); + } if (rs->buf[0] != 'l' && rs->buf[0] != 'm') error (_("Unknown remote qXfer reply: %s"), rs->buf); diff --git a/gdb/solib-fdpic.c b/gdb/solib-fdpic.c index de530ce..1d8fbc2 100644 --- a/gdb/solib-fdpic.c +++ b/gdb/solib-fdpic.c @@ -89,6 +89,33 @@ struct int_elf32_fdpic_loadmap { struct int_elf32_fdpic_loadseg segs[1 /* nsegs, actually */]; }; +/* CLYON */ +static void +fdpic_print_loadmap (struct int_elf32_fdpic_loadmap *map) +{ + int i; + + if (map == NULL) + printf_filtered ("(null)\n"); + else if (map->version != 0) + printf_filtered (_("Unsupported map version: %d\n"), map->version); + else + { + printf_filtered ("version %d\n", map->version); + + for (i = 0; i < map->nsegs; i++) + printf_filtered ("%s:%s -> %s:%s\n", + print_core_address (target_gdbarch (), + map->segs[i].p_vaddr), + print_core_address (target_gdbarch (), + map->segs[i].p_vaddr + + map->segs[i].p_memsz), + print_core_address (target_gdbarch (), map->segs[i].addr), + print_core_address (target_gdbarch (), map->segs[i].addr + + map->segs[i].p_memsz)); + } +} + /* Given address LDMADDR, fetch and decode the loadmap at that address. Return NULL if there is a problem reading the target memory or if there doesn't appear to be a loadmap at the given address. The @@ -175,6 +202,7 @@ fetch_loadmap (CORE_ADDR ldmaddr) } xfree (ext_ldmbuf); + fdpic_print_loadmap (int_ldmbuf); return int_ldmbuf; } @@ -776,19 +804,43 @@ fdpic_fdpic_loadmap_addresses (struct gdbarch *gdbarch, CORE_ADDR *interp_addr, else { #endif +#if 0 + if (exec_addr != NULL) + *exec_addr = 0xfffde6b8; + if (interp_addr != NULL) + *interp_addr = 0xfffde69c; + return 0; +#endif +#if 1 enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch ()); - gdb::optional<gdb::byte_vector> buf - = target_read_alloc (current_top_target (), TARGET_OBJECT_FDPIC, "exec"); - /* CHECK BUF CF solib-dsbt.c */ - if (exec_addr != NULL) - *exec_addr = extract_unsigned_integer (buf->data (), 4 /*FIXME*/, byte_order); + gdb::optional<gdb::byte_vector> buf + = target_read_alloc (current_top_target (), TARGET_OBJECT_FDPIC, "exec"); + /* CHECK BUF CF solib-dsbt.c */ + + if (!buf || buf->empty ()) + { + // info->exec_loadmap = NULL; + error (_("Error reading FDPIC exec loadmap")); + } + + if (exec_addr != NULL) + *exec_addr = extract_unsigned_integer (buf->data (), 4 /*FIXME*/, byte_order); + + fprintf(stderr, "GDB: %s got exec_addr: %lx\n", __FUNCTION__, *exec_addr); - buf = target_read_alloc (current_top_target (), TARGET_OBJECT_FDPIC, "interp"); - if (interp_addr != NULL) - *interp_addr = extract_unsigned_integer (buf->data (), 4 /*FIXME*/, byte_order); + buf = target_read_alloc (current_top_target (), TARGET_OBJECT_FDPIC, "interp"); + if (!buf || buf->empty ()) + { + // info->exec_loadmap = NULL; + error (_("Error reading FDPIC interp loadmap")); + } + if (interp_addr != NULL) + *interp_addr = extract_unsigned_integer (buf->data (), 4 /*FIXME*/, byte_order); + fprintf(stderr, "GDB: %s got interp_addr: %lx\n", __FUNCTION__, *interp_addr); - return 0; /* FIXME */ + return 0; /* FIXME */ +#endif #if 0 struct regcache *regcache = get_current_regcache (); @@ -796,14 +848,14 @@ fdpic_fdpic_loadmap_addresses (struct gdbarch *gdbarch, CORE_ADDR *interp_addr, { ULONGEST val; regcache_cooked_read_unsigned (regcache, - fdpic_loadmap_interp_regnum, &val); + 9/*FIXME fdpic_loadmap_interp_regnum*/, &val); *interp_addr = val; } if (exec_addr != NULL) { ULONGEST val; regcache_cooked_read_unsigned (regcache, - fdpic_loadmap_exec_regnum, &val); + 9/*fdpic_loadmap_exec_regnum*/, &val); *exec_addr = val; } return 0; diff --git a/gdb/solib-frv.c b/gdb/solib-frv.c index 6ebc6d4..67aa53d 100644 --- a/gdb/solib-frv.c +++ b/gdb/solib-frv.c @@ -22,13 +22,15 @@ #include "gdbcore.h" #include "solib.h" #include "solist.h" -#include "frv-tdep.h" +//#include "frv-tdep.h" /* For frv_fdpic_loadmap_addresses() */ +int frv_fdpic_loadmap_addresses (struct gdbarch *gdbarch, + CORE_ADDR *interp_addr, CORE_ADDR *exec_addr); #include "objfiles.h" #include "symtab.h" #include "language.h" #include "command.h" #include "gdbcmd.h" -#include "elf/frv.h" +//#include "elf/frv.h" /* Used in find_canonical_descriptor_in_load_object() */ #include "gdb_bfd.h" /* Flag which indicates whether internal debug messages should be printed. */ @@ -1083,7 +1085,7 @@ find_canonical_descriptor_in_load_object this address (which is a GOT entry) to obtain a descriptor address. */ if ((name == 0 || strcmp (name, (*rel->sym_ptr_ptr)->name) == 0) - && rel->howto->type == R_FRV_FUNCDESC) + /*&& rel->howto->type == R_FRV_FUNCDESC*/) { gdb_byte buf [FRV_PTR_SIZE]; @@ -168,7 +168,7 @@ int remote_timeout = 2; /* Non-zero tells remote* modules to output debugging info. */ -int remote_debug = 0; +int remote_debug = 0/*1*/; /* Sbrk location on entry to main. Used for statistics only. */ #ifdef HAVE_USEFUL_SBRK |