mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2024-12-09 04:21:49 +08:00
2003-10-24 Andrew Cagney <cagney@redhat.com>
* target.c: Include "gdbcore.h". (get_target_memory, get_target_memory_unsigned): New functions. * target.h (get_target_memory, get_target_memory_unsigned): Declare. * ppc-linux-tdep.c (ppc64_linux_convert_from_func_ptr_addr): Use get_target_memory_unsigned. * Makefile.in (target.o): Update dependencies.
This commit is contained in:
parent
ae7dc4d82b
commit
b6591e8b14
@ -1,3 +1,12 @@
|
||||
2003-10-24 Andrew Cagney <cagney@redhat.com>
|
||||
|
||||
* target.c: Include "gdbcore.h".
|
||||
(get_target_memory, get_target_memory_unsigned): New functions.
|
||||
* target.h (get_target_memory, get_target_memory_unsigned): Declare.
|
||||
* ppc-linux-tdep.c (ppc64_linux_convert_from_func_ptr_addr):
|
||||
Use get_target_memory_unsigned.
|
||||
* Makefile.in (target.o): Update dependencies.
|
||||
|
||||
2003-10-24 Andrew Cagney <cagney@redhat.com>
|
||||
|
||||
* osabi.c (gdbarch_init_osabi): Fix typos, and "fortunatly"[sic].
|
||||
|
@ -2367,7 +2367,8 @@ symtab.o: symtab.c $(defs_h) $(symtab_h) $(gdbtypes_h) $(gdbcore_h) \
|
||||
$(block_h) $(dictionary_h) $(gdb_string_h) $(gdb_stat_h) $(cp_abi_h)
|
||||
target.o: target.c $(defs_h) $(gdb_string_h) $(target_h) $(gdbcmd_h) \
|
||||
$(symtab_h) $(inferior_h) $(bfd_h) $(symfile_h) $(objfiles_h) \
|
||||
$(gdb_wait_h) $(dcache_h) $(regcache_h) $(gdb_assert_h)
|
||||
$(gdb_wait_h) $(dcache_h) $(regcache_h) $(gdb_assert_h) \
|
||||
$(gdbcore_h)
|
||||
thread.o: thread.c $(defs_h) $(symtab_h) $(frame_h) $(inferior_h) \
|
||||
$(environ_h) $(value_h) $(target_h) $(gdbthread_h) $(command_h) \
|
||||
$(gdbcmd_h) $(regcache_h) $(gdb_h) $(gdb_string_h) $(ui_out_h)
|
||||
|
@ -936,13 +936,11 @@ ppc64_linux_convert_from_func_ptr_addr (struct gdbarch *gdbarch,
|
||||
CORE_ADDR addr,
|
||||
struct target_ops *targ)
|
||||
{
|
||||
struct obj_section *s;
|
||||
|
||||
s = find_pc_section (addr);
|
||||
struct section_table *s = target_section_by_addr (targ, addr);
|
||||
|
||||
/* Check if ADDR points to a function descriptor. */
|
||||
if (s && strcmp (s->the_bfd_section->name, ".opd") == 0)
|
||||
return read_memory_unsigned_integer (addr, 8);
|
||||
return get_target_memory_unsigned (targ, addr, 8);
|
||||
|
||||
return addr;
|
||||
}
|
||||
|
23
gdb/target.c
23
gdb/target.c
@ -37,6 +37,7 @@
|
||||
#include <signal.h>
|
||||
#include "regcache.h"
|
||||
#include "gdb_assert.h"
|
||||
#include "gdbcore.h"
|
||||
|
||||
static void target_info (char *, int);
|
||||
|
||||
@ -1214,6 +1215,28 @@ target_write (struct target_ops *ops,
|
||||
return len;
|
||||
}
|
||||
|
||||
/* Memory transfer methods. */
|
||||
|
||||
void
|
||||
get_target_memory (struct target_ops *ops, CORE_ADDR addr, void *buf,
|
||||
LONGEST len)
|
||||
{
|
||||
if (target_read (ops, TARGET_OBJECT_MEMORY, NULL, buf, addr, len)
|
||||
!= len)
|
||||
memory_error (EIO, addr);
|
||||
}
|
||||
|
||||
ULONGEST
|
||||
get_target_memory_unsigned (struct target_ops *ops,
|
||||
CORE_ADDR addr, int len)
|
||||
{
|
||||
char buf[sizeof (ULONGEST)];
|
||||
|
||||
gdb_assert (len <= sizeof (buf));
|
||||
get_target_memory (ops, addr, buf, len);
|
||||
return extract_unsigned_integer (buf, len);
|
||||
}
|
||||
|
||||
static void
|
||||
target_info (char *args, int from_tty)
|
||||
{
|
||||
|
12
gdb/target.h
12
gdb/target.h
@ -248,6 +248,18 @@ extern LONGEST target_write (struct target_ops *ops,
|
||||
enum target_object object,
|
||||
const char *annex, const void *buf,
|
||||
ULONGEST offset, LONGEST len);
|
||||
|
||||
/* Wrappers to target read/write that perform memory transfers. They
|
||||
throw an error if the memory transfer fails.
|
||||
|
||||
NOTE: cagney/2003-10-23: The naming schema is lifted from
|
||||
"frame.h". The parameter order is lifted from get_frame_memory,
|
||||
which in turn lifted it from read_memory. */
|
||||
|
||||
extern void get_target_memory (struct target_ops *ops, CORE_ADDR addr,
|
||||
void *buf, LONGEST len);
|
||||
extern ULONGEST get_target_memory_unsigned (struct target_ops *ops,
|
||||
CORE_ADDR addr, int len);
|
||||
|
||||
|
||||
/* If certain kinds of activity happen, target_wait should perform
|
||||
|
Loading…
Reference in New Issue
Block a user