+Wed Oct 30 17:35:14 1996 Michael Meissner <meissner@tiktok.cygnus.com>
+
+ * interp.c (bfd.h) Don't include it here any more.
+ (text{,_start,_end}): Move here from simops.c and make extern.
+ (decode_pc): New function to return the PC as an address that the
+ debugger can use.
+ (dmem_addr): Print decoded PC in error message.
+ (pc_addr): Ditto.
+
+ * simops.c (bfd.h) Don't include it here any more.
+ (text{,_start,_end}): Move to simops.c.
+ (trace_input_func): Move decoding of PC, and looking up .text
+ start to decode_pc.
+
+ * d10v_sim.h (bfd.h): Include it here.
+ (text{,_start,_end}): Add external declarations.
+ (exec_bfd): Ditto.
+ (decode_pc): Ditto.
+
Tue Oct 29 12:13:52 1996 Martin M. Hunt <hunt@pizza.cygnus.com>
* interp.c (sim_size): Now allocates unified memory for imap segments
#include "ansidecl.h"
#include "callback.h"
#include "opcode/d10v.h"
+#include "bfd.h"
#define DEBUG_TRACE 0x00000001
#define DEBUG_VALUES 0x00000002
extern host_callback *d10v_callback;
extern uint16 OP[4];
extern struct simops Simops[];
+extern asection *text;
+extern bfd_vma text_start;
+extern bfd_vma text_end;
+extern bfd *exec_bfd;
#define PC (State.cregs[2])
#define PSW (State.cregs[0])
#define INC_ADDR(x,i) x = ((State.MD && x == MOD_E) ? MOD_S : (x)+(i))
extern uint8 *dmem_addr PARAMS ((uint32));
+extern bfd_vma decode_pc PARAMS ((void));
#define RB(x) (*(dmem_addr(x)))
#define SB(addr,data) ( RB(addr) = (data & 0xff))
#include <signal.h>
#include "sysdep.h"
-#include "bfd.h"
#include "remote-sim.h"
#include "d10v_sim.h"
uint16 OP[4];
+static int init_text_p = 0;
+asection *text;
+bfd_vma text_start;
+bfd_vma text_end;
+
static long hash PARAMS ((long insn, int format));
static struct hash_entry *lookup_hash PARAMS ((uint32 ins, int size));
static void get_operands PARAMS ((struct simops *s, uint32 ins));
}
}
+bfd_vma
+decode_pc ()
+{
+ asection *s;
+ if (!init_text_p)
+ {
+ init_text_p = 1;
+ for (s = exec_bfd->sections; s; s = s->next)
+ if (strcmp (bfd_get_section_name (exec_bfd, s), ".text") == 0)
+ {
+ text = s;
+ text_start = bfd_get_section_vma (exec_bfd, s);
+ text_end = text_start + bfd_section_size (exec_bfd, s);
+ break;
+ }
+ }
+
+ return (PC << 2) + text_start;
+}
+
static void
do_long (ins)
uint32 ins;
if (addr > 0xbfff)
{
if ( (addr & 0xfff0) != 0xff00)
- (*d10v_callback->printf_filtered) (d10v_callback, "Data address %x is in I/O space.\n",addr);
+ (*d10v_callback->printf_filtered) (d10v_callback, "Data address 0x%lx is in I/O space, pc = 0x%lx.\n",
+ (long)addr, (long)decode_pc ());
return State.dmem + addr;
}
seg = (DMAP & 0x3ff) >> 2;
if (State.umem[seg] == NULL)
{
- (*d10v_callback->printf_filtered) (d10v_callback, "ERROR: unified memory region %d unmapped\n", seg);
+ (*d10v_callback->printf_filtered) (d10v_callback, "ERROR: unified memory region %d unmapped, pc = 0x%lx\n",
+ seg, (long)decode_pc ());
exit(1);
}
return State.umem[seg] + (DMAP & 3) * 0x4000;
if (State.umem[imap & 0xff] == NULL)
{
- (*d10v_callback->printf_filtered) (d10v_callback, "ERROR: unified memory region %d unmapped\n", imap & 0xff);
+ (*d10v_callback->printf_filtered) (d10v_callback, "ERROR: unified memory region %d unmapped, pc = 0x%lx\n",
+ imap & 0xff, (long)PC);
State.exception = SIGILL;
return 0;
}
#include "d10v_sim.h"
#include "simops.h"
#include "sys/syscall.h"
-#include "bfd.h"
extern char *strrchr ();
#define trace_output(result) do { if (d10v_debug) trace_output_func (result); } while (0)
-static int init_text_p = 0;
-static asection *text;
-static bfd_vma text_start;
-static bfd_vma text_end;
-extern bfd *exec_bfd;
-
#ifndef SIZE_INSTRUCTION
#define SIZE_INSTRUCTION 8
#endif
char *p;
long tmp;
char *type;
- asection *s;
const char *filename;
const char *functionname;
unsigned int linenumber;
else
{
- if (!init_text_p)
- {
- init_text_p = 1;
- for (s = exec_bfd->sections; s; s = s->next)
- if (strcmp (bfd_get_section_name (exec_bfd, s), ".text") == 0)
- {
- text = s;
- text_start = bfd_get_section_vma (exec_bfd, s);
- text_end = text_start + bfd_section_size (exec_bfd, s);
- break;
- }
- }
-
buf[0] = '\0';
- byte_pc = (bfd_vma)PC << 2;
+ byte_pc = decode_pc ();
if (text && byte_pc >= text_start && byte_pc < text_end)
{
filename = (const char *)0;