mirror of
https://github.com/bminor/binutils-gdb.git
synced 2025-11-30 12:45:43 +00:00
Compare commits
2 Commits
gdb-13.2-r
...
users/clyo
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
68b4faa22a | ||
|
|
548c794021 |
@@ -768,6 +768,7 @@ ALL_TARGET_OBS = \
|
|||||||
solib-aix.o \
|
solib-aix.o \
|
||||||
solib-darwin.o \
|
solib-darwin.o \
|
||||||
solib-dsbt.o \
|
solib-dsbt.o \
|
||||||
|
solib-fdpic.o \
|
||||||
solib-frv.o \
|
solib-frv.o \
|
||||||
solib-spu.o \
|
solib-spu.o \
|
||||||
solib-svr4.o \
|
solib-svr4.o \
|
||||||
|
|||||||
@@ -25,6 +25,7 @@
|
|||||||
#include "frame.h"
|
#include "frame.h"
|
||||||
#include "regcache.h"
|
#include "regcache.h"
|
||||||
#include "solib-svr4.h"
|
#include "solib-svr4.h"
|
||||||
|
#include "solib.h"
|
||||||
#include "osabi.h"
|
#include "osabi.h"
|
||||||
#include "regset.h"
|
#include "regset.h"
|
||||||
#include "trad-frame.h"
|
#include "trad-frame.h"
|
||||||
@@ -1777,8 +1778,14 @@ arm_linux_init_abi (struct gdbarch_info info,
|
|||||||
}
|
}
|
||||||
tdep->jb_elt_size = ARM_LINUX_JB_ELEMENT_SIZE;
|
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
|
set_solib_svr4_fetch_link_map_offsets
|
||||||
(gdbarch, svr4_ilp32_fetch_link_map_offsets);
|
(gdbarch, svr4_ilp32_fetch_link_map_offsets);
|
||||||
|
// }
|
||||||
|
|
||||||
/* Single stepping. */
|
/* Single stepping. */
|
||||||
set_gdbarch_software_single_step (gdbarch, arm_linux_software_single_step);
|
set_gdbarch_software_single_step (gdbarch, arm_linux_software_single_step);
|
||||||
@@ -1788,8 +1795,15 @@ arm_linux_init_abi (struct gdbarch_info info,
|
|||||||
set_gdbarch_skip_solib_resolver (gdbarch, glibc_skip_solib_resolver);
|
set_gdbarch_skip_solib_resolver (gdbarch, glibc_skip_solib_resolver);
|
||||||
|
|
||||||
/* Enable TLS support. */
|
/* 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,
|
set_gdbarch_fetch_tls_load_module_address (gdbarch,
|
||||||
svr4_fetch_objfile_link_map);
|
svr4_fetch_objfile_link_map);
|
||||||
|
// }
|
||||||
|
|
||||||
tramp_frame_prepend_unwinder (gdbarch,
|
tramp_frame_prepend_unwinder (gdbarch,
|
||||||
&arm_linux_sigreturn_tramp_frame);
|
&arm_linux_sigreturn_tramp_frame);
|
||||||
|
|||||||
@@ -8925,6 +8925,7 @@ arm_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
|
|||||||
enum arm_float_model fp_model = arm_fp_model;
|
enum arm_float_model fp_model = arm_fp_model;
|
||||||
struct tdesc_arch_data *tdesc_data = NULL;
|
struct tdesc_arch_data *tdesc_data = NULL;
|
||||||
int i, is_m = 0;
|
int i, is_m = 0;
|
||||||
|
int is_fdpic = 0;
|
||||||
int vfp_register_count = 0, have_vfp_pseudos = 0, have_neon_pseudos = 0;
|
int vfp_register_count = 0, have_vfp_pseudos = 0, have_neon_pseudos = 0;
|
||||||
int have_wmmx_registers = 0;
|
int have_wmmx_registers = 0;
|
||||||
int have_neon = 0;
|
int have_neon = 0;
|
||||||
@@ -8957,10 +8958,13 @@ arm_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
|
|||||||
anyway, so assume APCS. */
|
anyway, so assume APCS. */
|
||||||
arm_abi = ARM_ABI_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);
|
int eabi_ver = EF_ARM_EABI_VERSION (e_flags);
|
||||||
|
|
||||||
|
if (ei_osabi == ELFOSABI_ARM_FDPIC)
|
||||||
|
is_fdpic = 1;
|
||||||
|
|
||||||
switch (eabi_ver)
|
switch (eabi_ver)
|
||||||
{
|
{
|
||||||
case EF_ARM_EABI_UNKNOWN:
|
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->arm_abi = arm_abi;
|
||||||
tdep->fp_model = fp_model;
|
tdep->fp_model = fp_model;
|
||||||
tdep->is_m = is_m;
|
tdep->is_m = is_m;
|
||||||
|
tdep->is_fdpic = is_fdpic;
|
||||||
tdep->have_fpa_registers = have_fpa_registers;
|
tdep->have_fpa_registers = have_fpa_registers;
|
||||||
tdep->have_wmmx_registers = have_wmmx_registers;
|
tdep->have_wmmx_registers = have_wmmx_registers;
|
||||||
gdb_assert (vfp_register_count == 0
|
gdb_assert (vfp_register_count == 0
|
||||||
|
|||||||
@@ -113,6 +113,7 @@ struct gdbarch_tdep
|
|||||||
int have_neon; /* Do we have a NEON unit? */
|
int have_neon; /* Do we have a NEON unit? */
|
||||||
|
|
||||||
int is_m; /* Does the target follow the "M" profile. */
|
int is_m; /* Does the target follow the "M" profile. */
|
||||||
|
int is_fdpic; /* Is the loaded binary a fdpic one. */
|
||||||
CORE_ADDR lowest_pc; /* Lowest address at which instructions
|
CORE_ADDR lowest_pc; /* Lowest address at which instructions
|
||||||
will appear. */
|
will appear. */
|
||||||
|
|
||||||
@@ -297,4 +298,9 @@ extern struct target_desc *tdesc_arm_with_vfpv2;
|
|||||||
extern struct target_desc *tdesc_arm_with_vfpv3;
|
extern struct target_desc *tdesc_arm_with_vfpv3;
|
||||||
extern struct target_desc *tdesc_arm_with_neon;
|
extern struct target_desc *tdesc_arm_with_neon;
|
||||||
|
|
||||||
|
/* FDPIC structure and API. */
|
||||||
|
extern struct target_so_ops fdpic_so_ops;
|
||||||
|
extern CORE_ADDR fdpic_fetch_objfile_link_map (struct objfile *objfile);
|
||||||
|
extern CORE_ADDR fdpic_find_global_pointer (CORE_ADDR addr);
|
||||||
|
|
||||||
#endif /* arm-tdep.h */
|
#endif /* arm-tdep.h */
|
||||||
|
|||||||
@@ -166,6 +166,12 @@ arm*-*-linux*)
|
|||||||
solib-svr4.o symfile-mem.o linux-tdep.o linux-record.o"
|
solib-svr4.o symfile-mem.o linux-tdep.o linux-record.o"
|
||||||
build_gdbserver=yes
|
build_gdbserver=yes
|
||||||
;;
|
;;
|
||||||
|
arm*-*-uclinuxfdpiceabi)
|
||||||
|
# Target: ARM based machine running GNU/Linux
|
||||||
|
gdb_target_obs="arch/arm-linux.o arm-linux-tdep.o glibc-tdep.o \
|
||||||
|
solib-svr4.o solib-fdpic.o symfile-mem.o linux-tdep.o linux-record.o"
|
||||||
|
# NO YET build_gdbserver=yes
|
||||||
|
;;
|
||||||
arm*-*-freebsd*)
|
arm*-*-freebsd*)
|
||||||
# Target: FreeBSD/arm
|
# Target: FreeBSD/arm
|
||||||
gdb_target_obs="arm-fbsd-tdep.o"
|
gdb_target_obs="arm-fbsd-tdep.o"
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ case "${target}" in
|
|||||||
ipa_obj="${ipa_obj} linux-aarch64-tdesc-ipa.o"
|
ipa_obj="${ipa_obj} linux-aarch64-tdesc-ipa.o"
|
||||||
ipa_obj="${ipa_obj} arch/aarch64-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-vfpv2.o"
|
||||||
srv_regobj="${srv_regobj} arm-with-vfpv3.o"
|
srv_regobj="${srv_regobj} arm-with-vfpv3.o"
|
||||||
srv_regobj="${srv_regobj} arm-with-neon.o"
|
srv_regobj="${srv_regobj} arm-with-neon.o"
|
||||||
|
|||||||
@@ -94,6 +94,8 @@ gdb_flush_out_err ()
|
|||||||
|
|
||||||
/* See server.h. */
|
/* See server.h. */
|
||||||
|
|
||||||
|
void my_read_loadmap(const char*);
|
||||||
|
void my_hack_loadmap(const char*);
|
||||||
void
|
void
|
||||||
post_fork_inferior (int pid, const char *program)
|
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);
|
atexit (restore_old_foreground_pgrp);
|
||||||
#endif
|
#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,
|
startup_inferior (pid, START_INFERIOR_TRAPS_EXPECTED,
|
||||||
&cs.last_status, &cs.last_ptid);
|
&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_resume_kind = resume_stop;
|
||||||
current_thread->last_status = cs.last_status;
|
current_thread->last_status = cs.last_status;
|
||||||
signal_pid = pid;
|
signal_pid = pid;
|
||||||
target_post_create_inferior ();
|
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);
|
fprintf (stderr, "Process %s created; pid = %d\n", program, pid);
|
||||||
fflush (stderr);
|
fflush (stderr);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -120,11 +120,13 @@ struct arch_lwp_info
|
|||||||
};
|
};
|
||||||
|
|
||||||
/* These are in <asm/elf.h> in current kernels. */
|
/* These are in <asm/elf.h> in current kernels. */
|
||||||
|
#ifndef __FDPIC__
|
||||||
#define HWCAP_VFP 64
|
#define HWCAP_VFP 64
|
||||||
#define HWCAP_IWMMXT 512
|
#define HWCAP_IWMMXT 512
|
||||||
#define HWCAP_NEON 4096
|
#define HWCAP_NEON 4096
|
||||||
#define HWCAP_VFPv3 8192
|
#define HWCAP_VFPv3 8192
|
||||||
#define HWCAP_VFPv3D16 16384
|
#define HWCAP_VFPv3D16 16384
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_SYS_REG_H
|
#ifdef HAVE_SYS_REG_H
|
||||||
#include <sys/reg.h>
|
#include <sys/reg.h>
|
||||||
|
|||||||
@@ -995,6 +995,7 @@ linux_ptrace_fun ()
|
|||||||
PROGRAM is the name of the program to be started, and PROGRAM_ARGS
|
PROGRAM is the name of the program to be started, and PROGRAM_ARGS
|
||||||
are its arguments. */
|
are its arguments. */
|
||||||
|
|
||||||
|
void my_read_loadmap(const char* fnname);
|
||||||
static int
|
static int
|
||||||
linux_create_inferior (const char *program,
|
linux_create_inferior (const char *program,
|
||||||
const std::vector<char *> &program_args)
|
const std::vector<char *> &program_args)
|
||||||
@@ -1004,6 +1005,8 @@ linux_create_inferior (const char *program,
|
|||||||
int pid;
|
int pid;
|
||||||
ptid_t ptid;
|
ptid_t ptid;
|
||||||
|
|
||||||
|
fprintf(stderr, "GDBSERVER: %s before fork_inferior\n", __FUNCTION__);
|
||||||
|
my_read_loadmap(__FUNCTION__);
|
||||||
{
|
{
|
||||||
maybe_disable_address_space_randomization restore_personality
|
maybe_disable_address_space_randomization restore_personality
|
||||||
(cs.disable_randomization);
|
(cs.disable_randomization);
|
||||||
@@ -1015,6 +1018,8 @@ linux_create_inferior (const char *program,
|
|||||||
NULL, NULL, NULL, NULL);
|
NULL, NULL, NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fprintf(stderr, "GDBSERVER: %s after fork_inferior\n", __FUNCTION__);
|
||||||
|
my_read_loadmap(__FUNCTION__);
|
||||||
linux_add_process (pid, 0);
|
linux_add_process (pid, 0);
|
||||||
|
|
||||||
ptid = ptid_t (pid, pid, 0);
|
ptid = ptid_t (pid, pid, 0);
|
||||||
@@ -6517,6 +6522,30 @@ struct target_loadmap
|
|||||||
# define LINUX_LOADMAP_INTERP PTRACE_GETFDPIC_INTERP
|
# define LINUX_LOADMAP_INTERP PTRACE_GETFDPIC_INTERP
|
||||||
# endif
|
# 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
|
static int
|
||||||
linux_read_loadmap (const char *annex, CORE_ADDR offset,
|
linux_read_loadmap (const char *annex, CORE_ADDR offset,
|
||||||
unsigned char *myaddr, unsigned int len)
|
unsigned char *myaddr, unsigned int len)
|
||||||
@@ -6533,20 +6562,25 @@ linux_read_loadmap (const char *annex, CORE_ADDR offset,
|
|||||||
else
|
else
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
fprintf(stderr, "GDBSERVER: %s before ptrace %s\n", __FUNCTION__, annex);
|
||||||
if (ptrace (LINUX_LOADMAP, pid, addr, &data) != 0)
|
if (ptrace (LINUX_LOADMAP, pid, addr, &data) != 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
fprintf(stderr, "GDBSERVER: %s ptrace OK data %p\n", __FUNCTION__, data);
|
||||||
if (data == NULL)
|
if (data == NULL)
|
||||||
return -1;
|
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)
|
actual_length = sizeof (struct target_loadmap)
|
||||||
+ sizeof (struct target_loadseg) * data->nsegs;
|
+ sizeof (struct target_loadseg) * data->nsegs;
|
||||||
|
|
||||||
if (offset < 0 || offset > actual_length)
|
if (offset < 0 || offset > actual_length)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
fprintf(stderr, "GDBSERVER: %s actual_length %d\n", __FUNCTION__, actual_length);
|
||||||
copy_length = actual_length - offset < len ? actual_length - offset : len;
|
copy_length = actual_length - offset < len ? actual_length - offset : len;
|
||||||
memcpy (myaddr, (char *) data + offset, copy_length);
|
memcpy (myaddr, (char *) data + offset, copy_length);
|
||||||
|
fprintf(stderr, "GDBSERVER: %s copy_length=%d\n", __FUNCTION__, copy_length);
|
||||||
return copy_length;
|
return copy_length;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
|||||||
@@ -221,6 +221,7 @@ handle_accept_event (int err, gdb_client_data client_data)
|
|||||||
threads' status ('?'). */
|
threads' status ('?'). */
|
||||||
target_async (0);
|
target_async (0);
|
||||||
|
|
||||||
|
// fprintf(stderr, "GDBSERVER: %s returns 0\n", __FUNCTION__);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -325,6 +326,7 @@ remote_prepare (const char *name)
|
|||||||
cs.transport_is_reliable = 1;
|
cs.transport_is_reliable = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void my_read_loadmap(const char*);
|
||||||
/* Open a connection to a remote debugger.
|
/* Open a connection to a remote debugger.
|
||||||
NAME is the filename used for communication. */
|
NAME is the filename used for communication. */
|
||||||
|
|
||||||
@@ -334,6 +336,7 @@ remote_open (const char *name)
|
|||||||
const char *port_str;
|
const char *port_str;
|
||||||
|
|
||||||
port_str = strchr (name, ':');
|
port_str = strchr (name, ':');
|
||||||
|
fprintf(stderr, "GDBSERVER: %s name |%s| port_str %s\n", __FUNCTION__, name, port_str);
|
||||||
#ifdef USE_WIN32API
|
#ifdef USE_WIN32API
|
||||||
if (port_str == NULL)
|
if (port_str == NULL)
|
||||||
error ("Only HOST:PORT is supported on this platform.");
|
error ("Only HOST:PORT is supported on this platform.");
|
||||||
@@ -413,12 +416,14 @@ remote_open (const char *name)
|
|||||||
gai_strerror (r));
|
gai_strerror (r));
|
||||||
else
|
else
|
||||||
fprintf (stderr, _("Listening on port %s\n"), listen_port);
|
fprintf (stderr, _("Listening on port %s\n"), listen_port);
|
||||||
|
my_read_loadmap(__FUNCTION__);
|
||||||
|
|
||||||
fflush (stderr);
|
fflush (stderr);
|
||||||
|
|
||||||
/* Register the event loop handler. */
|
/* Register the event loop handler. */
|
||||||
add_file_handler (listen_desc, handle_accept_event, NULL);
|
add_file_handler (listen_desc, handle_accept_event, NULL);
|
||||||
}
|
}
|
||||||
|
// fprintf(stderr, "GDBSERVER: %s returns\n", __FUNCTION__);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -957,6 +962,7 @@ process_remaining (void *context)
|
|||||||
else
|
else
|
||||||
res = 0;
|
res = 0;
|
||||||
|
|
||||||
|
// fprintf(stderr, "GDBSERVER: %s returns %d\n", __FUNCTION__, res);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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);
|
*new_packet_len_p = write_qxfer_response (own_buf, data, n, 0);
|
||||||
|
|
||||||
free (data);
|
free (data);
|
||||||
|
// fprintf(stderr, "GDBSERVER: %s packet size n %d\n", __FUNCTION__, n);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
else if (strcmp (rw, "write") == 0)
|
else if (strcmp (rw, "write") == 0)
|
||||||
@@ -3577,7 +3578,9 @@ captured_main (int argc, char *argv[])
|
|||||||
const char *selftest_filter = NULL;
|
const char *selftest_filter = NULL;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// printf("GDBSERVER HELLO\n");
|
||||||
current_directory = getcwd (NULL, 0);
|
current_directory = getcwd (NULL, 0);
|
||||||
|
// printf("GDBSERVER HELLO2 CWD=%s\n", current_directory);
|
||||||
client_state &cs = get_client_state ();
|
client_state &cs = get_client_state ();
|
||||||
|
|
||||||
if (current_directory == NULL)
|
if (current_directory == NULL)
|
||||||
@@ -3588,6 +3591,7 @@ captured_main (int argc, char *argv[])
|
|||||||
|
|
||||||
while (*next_arg != NULL && **next_arg == '-')
|
while (*next_arg != NULL && **next_arg == '-')
|
||||||
{
|
{
|
||||||
|
fprintf(stderr, "GDBSERVER: %s next_arg %s\n", __FUNCTION__, *next_arg);
|
||||||
if (strcmp (*next_arg, "--version") == 0)
|
if (strcmp (*next_arg, "--version") == 0)
|
||||||
{
|
{
|
||||||
gdbserver_version ();
|
gdbserver_version ();
|
||||||
@@ -3725,6 +3729,7 @@ captured_main (int argc, char *argv[])
|
|||||||
if (port == NULL)
|
if (port == NULL)
|
||||||
{
|
{
|
||||||
port = *next_arg;
|
port = *next_arg;
|
||||||
|
fprintf(stderr, "GDBSERVER: %s port %s\n", __FUNCTION__, port);
|
||||||
next_arg++;
|
next_arg++;
|
||||||
}
|
}
|
||||||
if ((port == NULL || (!attach && !multi_mode && *next_arg == NULL))
|
if ((port == NULL || (!attach && !multi_mode && *next_arg == NULL))
|
||||||
@@ -3746,6 +3751,7 @@ captured_main (int argc, char *argv[])
|
|||||||
start_inferior. */
|
start_inferior. */
|
||||||
if (port != NULL)
|
if (port != NULL)
|
||||||
remote_prepare (port);
|
remote_prepare (port);
|
||||||
|
fprintf(stderr, "GDBSERVER: %s port after remote_prepare %s\n", __FUNCTION__, port);
|
||||||
|
|
||||||
bad_attach = 0;
|
bad_attach = 0;
|
||||||
pid = 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 (xstrdup (next_arg[i]));
|
||||||
program_args.push_back (NULL);
|
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. */
|
/* Wait till we are at first instruction in program. */
|
||||||
create_inferior (program_path.get (), program_args);
|
create_inferior (program_path.get (), program_args);
|
||||||
|
|
||||||
@@ -3841,6 +3848,7 @@ captured_main (int argc, char *argv[])
|
|||||||
if (!was_running && !multi_mode)
|
if (!was_running && !multi_mode)
|
||||||
error ("No program to debug");
|
error ("No program to debug");
|
||||||
|
|
||||||
|
fprintf(stderr, "GDBSERVER: %s port before remote_open %s\n", __FUNCTION__, port);
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
cs.noack_mode = 0;
|
cs.noack_mode = 0;
|
||||||
@@ -4378,6 +4386,7 @@ process_serial_event (void)
|
|||||||
if (exit_requested)
|
if (exit_requested)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
// fprintf(stderr, "GDBSERVER: %s returns 0\n", __FUNCTION__);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -66,6 +66,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "pathmax.h"
|
#include "pathmax.h"
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
/* In this file, PATH_MAX only serves as a threshold for choosing among two
|
/* In this file, PATH_MAX only serves as a threshold for choosing among two
|
||||||
algorithms. */
|
algorithms. */
|
||||||
@@ -212,6 +213,8 @@ __getcwd (char *buf, size_t size)
|
|||||||
rootdev = st.st_dev;
|
rootdev = st.st_dev;
|
||||||
rootino = st.st_ino;
|
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))
|
while (!(thisdev == rootdev && thisino == rootino))
|
||||||
{
|
{
|
||||||
struct dirent *d;
|
struct dirent *d;
|
||||||
@@ -223,6 +226,7 @@ __getcwd (char *buf, size_t size)
|
|||||||
size_t namlen;
|
size_t namlen;
|
||||||
bool use_d_ino = true;
|
bool use_d_ino = true;
|
||||||
|
|
||||||
|
// printf("TOTO GDB: going up\n");
|
||||||
/* Look at the parent directory. */
|
/* Look at the parent directory. */
|
||||||
#if HAVE_OPENAT_SUPPORT
|
#if HAVE_OPENAT_SUPPORT
|
||||||
fd = openat (fd, "..", O_RDONLY);
|
fd = openat (fd, "..", O_RDONLY);
|
||||||
@@ -249,6 +253,7 @@ __getcwd (char *buf, size_t size)
|
|||||||
dotdev = st.st_dev;
|
dotdev = st.st_dev;
|
||||||
dotino = st.st_ino;
|
dotino = st.st_ino;
|
||||||
mount_point = dotdev != thisdev;
|
mount_point = dotdev != thisdev;
|
||||||
|
// printf("TOTO GDB: mount_point: %d dotdev %d dotino %d\n", mount_point, dotdev, dotino);
|
||||||
|
|
||||||
/* Search for the last directory. */
|
/* Search for the last directory. */
|
||||||
#if HAVE_OPENAT_SUPPORT
|
#if HAVE_OPENAT_SUPPORT
|
||||||
@@ -267,6 +272,7 @@ __getcwd (char *buf, size_t size)
|
|||||||
/* Clear errno to distinguish EOF from error if readdir returns
|
/* Clear errno to distinguish EOF from error if readdir returns
|
||||||
NULL. */
|
NULL. */
|
||||||
__set_errno (0);
|
__set_errno (0);
|
||||||
|
// printf("TOTO GDB before readdir\n");
|
||||||
d = __readdir (dirstream);
|
d = __readdir (dirstream);
|
||||||
|
|
||||||
/* When we've iterated through all directory entries without finding
|
/* When we've iterated through all directory entries without finding
|
||||||
@@ -278,11 +284,13 @@ __getcwd (char *buf, size_t size)
|
|||||||
via lstat. */
|
via lstat. */
|
||||||
if (d == NULL && errno == 0 && use_d_ino)
|
if (d == NULL && errno == 0 && use_d_ino)
|
||||||
{
|
{
|
||||||
|
// printf("TOTO GDB weird: d=%p errno=%d\n", d, errno);
|
||||||
use_d_ino = false;
|
use_d_ino = false;
|
||||||
rewinddir (dirstream);
|
rewinddir (dirstream);
|
||||||
d = __readdir (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 (d == NULL)
|
||||||
{
|
{
|
||||||
if (errno == 0)
|
if (errno == 0)
|
||||||
|
|||||||
@@ -28,6 +28,7 @@
|
|||||||
#include "signals-state-save-restore.h"
|
#include "signals-state-save-restore.h"
|
||||||
#include "gdb_tilde_expand.h"
|
#include "gdb_tilde_expand.h"
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
#include "nat/linux-ptrace.h"
|
||||||
|
|
||||||
extern char **environ;
|
extern char **environ;
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ struct buffer;
|
|||||||
#include "gdb_wait.h"
|
#include "gdb_wait.h"
|
||||||
|
|
||||||
#ifdef __UCLIBC__
|
#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. */
|
/* PTRACE_TEXT_ADDR and friends. */
|
||||||
#include <asm/ptrace.h>
|
#include <asm/ptrace.h>
|
||||||
#define HAS_NOMMU
|
#define HAS_NOMMU
|
||||||
@@ -83,7 +83,8 @@ struct buffer;
|
|||||||
#define PTRACE_O_EXITKILL 0x00100000
|
#define PTRACE_O_EXITKILL 0x00100000
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if (defined __bfin__ || defined __frv__ || defined __sh__) \
|
#if (defined __bfin__ || defined __frv__ || defined __sh__ \
|
||||||
|
|| defined __arm__ ) \
|
||||||
&& !defined PTRACE_GETFDPIC
|
&& !defined PTRACE_GETFDPIC
|
||||||
#define PTRACE_GETFDPIC 31
|
#define PTRACE_GETFDPIC 31
|
||||||
#define PTRACE_GETFDPIC_EXEC 0
|
#define PTRACE_GETFDPIC_EXEC 0
|
||||||
|
|||||||
14
gdb/remote.c
14
gdb/remote.c
@@ -1920,6 +1920,9 @@ packet_ok (const char *buf, struct packet_config *config)
|
|||||||
{
|
{
|
||||||
enum packet_result result;
|
enum packet_result result;
|
||||||
|
|
||||||
|
fprintf (stderr,
|
||||||
|
"GDB: %s Packet %s (%s)\n", __FUNCTION__,
|
||||||
|
config->name, config->title);
|
||||||
if (config->detect != AUTO_BOOLEAN_TRUE
|
if (config->detect != AUTO_BOOLEAN_TRUE
|
||||||
&& config->support == PACKET_DISABLE)
|
&& config->support == PACKET_DISABLE)
|
||||||
internal_error (__FILE__, __LINE__,
|
internal_error (__FILE__, __LINE__,
|
||||||
@@ -4570,6 +4573,7 @@ remote_target::start_remote (int from_tty, int extended_p)
|
|||||||
{
|
{
|
||||||
const char v_mustreplyempty[] = "vMustReplyEmpty";
|
const char v_mustreplyempty[] = "vMustReplyEmpty";
|
||||||
|
|
||||||
|
fprintf(stderr, "GDB: %s 'v' must-reply-empty\n", __FUNCTION__);
|
||||||
putpkt (v_mustreplyempty);
|
putpkt (v_mustreplyempty);
|
||||||
getpkt (&rs->buf, &rs->buf_size, 0);
|
getpkt (&rs->buf, &rs->buf_size, 0);
|
||||||
if (strcmp (rs->buf, "OK") == 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++)
|
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)
|
if (strcmp (remote_protocol_features[i].name, p) == 0)
|
||||||
{
|
{
|
||||||
const struct protocol_feature *feature;
|
const struct protocol_feature *feature;
|
||||||
@@ -5383,6 +5389,7 @@ remote_target::remote_query_supported ()
|
|||||||
feature->func (this, feature, is_supported, value);
|
feature->func (this, feature, is_supported, value);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If we increased the packet size, make sure to increase the global
|
/* 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 ();
|
struct remote_state *rs = get_remote_state ();
|
||||||
LONGEST i, n, packet_len;
|
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)
|
if (packet_config_support (packet) == PACKET_DISABLE)
|
||||||
return TARGET_XFER_E_IO;
|
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)
|
if (packet_len < 0 || packet_ok (rs->buf, packet) != PACKET_OK)
|
||||||
return TARGET_XFER_E_IO;
|
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')
|
if (rs->buf[0] != 'l' && rs->buf[0] != 'm')
|
||||||
error (_("Unknown remote qXfer reply: %s"), rs->buf);
|
error (_("Unknown remote qXfer reply: %s"), rs->buf);
|
||||||
|
|
||||||
|
|||||||
1339
gdb/solib-fdpic.c
Normal file
1339
gdb/solib-fdpic.c
Normal file
File diff suppressed because it is too large
Load Diff
@@ -22,13 +22,15 @@
|
|||||||
#include "gdbcore.h"
|
#include "gdbcore.h"
|
||||||
#include "solib.h"
|
#include "solib.h"
|
||||||
#include "solist.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 "objfiles.h"
|
||||||
#include "symtab.h"
|
#include "symtab.h"
|
||||||
#include "language.h"
|
#include "language.h"
|
||||||
#include "command.h"
|
#include "command.h"
|
||||||
#include "gdbcmd.h"
|
#include "gdbcmd.h"
|
||||||
#include "elf/frv.h"
|
//#include "elf/frv.h" /* Used in find_canonical_descriptor_in_load_object() */
|
||||||
#include "gdb_bfd.h"
|
#include "gdb_bfd.h"
|
||||||
|
|
||||||
/* Flag which indicates whether internal debug messages should be printed. */
|
/* 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
|
this address (which is a GOT entry) to obtain a descriptor
|
||||||
address. */
|
address. */
|
||||||
if ((name == 0 || strcmp (name, (*rel->sym_ptr_ptr)->name) == 0)
|
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];
|
gdb_byte buf [FRV_PTR_SIZE];
|
||||||
|
|
||||||
|
|||||||
@@ -168,7 +168,7 @@ int remote_timeout = 2;
|
|||||||
|
|
||||||
/* Non-zero tells remote* modules to output debugging info. */
|
/* 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. */
|
/* Sbrk location on entry to main. Used for statistics only. */
|
||||||
#ifdef HAVE_USEFUL_SBRK
|
#ifdef HAVE_USEFUL_SBRK
|
||||||
|
|||||||
Reference in New Issue
Block a user