* gdbtypes.c (lookup_pointer_type): initialize the TYPE_LENGTH of

a ptype to reflect the setting of TARGET_PTR_BIT.  Set the
	TYPE_FLAGS of a ptype to TYPE_FLAG_UNSIGNED.
	* tm-h8300.h, h8300-tdep.c, remote-hms.c: personal checkpoint
	* printcmd.c (print_address): if ADDR_BITS_REMOVE is defined, use
	it before printing out the hex shape of an address.
This commit is contained in:
Steve Chamberlain 1992-03-03 07:05:23 +00:00
parent bff1c97a66
commit 96743d3c30
5 changed files with 119 additions and 77 deletions

View File

@ -1,3 +1,12 @@
Mon Mar 2 23:00:12 1992 Steve Chamberlain (sac@thepub.cygnus.com)
* gdbtypes.c (lookup_pointer_type): initialize the TYPE_LENGTH of
a ptype to reflect the setting of TARGET_PTR_BIT. Set the
TYPE_FLAGS of a ptype to TYPE_FLAG_UNSIGNED.
* tm-h8300.h, h8300-tdep.c, remote-hms.c: personal checkpoint
* printcmd.c (print_address): if ADDR_BITS_REMOVE is defined, use
it before printing out the hex shape of an address.
Sun Mar 1 17:41:09 1992 Per Bothner (bothner@cygnus.com)
* rs6000-xdep.c (frame_initial_stack_address): Move

View File

@ -80,12 +80,13 @@ lookup_pointer_type (type)
TYPE_POINTER_TYPE (type) = ptype;
/* We assume the machine has only one representation for pointers! */
/* FIXME: This confuses host<->target data representations, and is a
poor assumption besides. */
TYPE_LENGTH (ptype) = sizeof (char *);
TYPE_LENGTH (ptype) = TARGET_PTR_BIT / TARGET_CHAR_BIT;
TYPE_CODE (ptype) = TYPE_CODE_PTR;
/* pointers are unsigned */
TYPE_FLAGS(ptype) |= TYPE_FLAG_UNSIGNED;
}
return (ptype);
}

View File

@ -55,17 +55,17 @@ CORE_ADDR start_pc;
/* Skip past all push insns */
short int w;
w = read_memory_integer(start_pc, 2);
w = read_memory_short(start_pc);
while (IS_PUSH(w))
{
start_pc+=2;
w = read_memory_integer(start_pc, 2);
w = read_memory_short(start_pc);
}
/* Skip past a move to FP */
if (IS_MOVE_FP(w)) {
start_pc +=2 ;
w = read_memory_integer(start_pc, 2);
w = read_memory_short(start_pc);
}
return start_pc;
@ -287,7 +287,7 @@ examine_prologue (ip, limit, after_prolog_fp, fsr, fi)
/* Locals are always reffed based from the fp */
fi->locals_pointer = after_prolog_fp ;
/* The PC is at a known place */
fi->from_pc = read_memory_integer(after_prolog_fp + reg_save_depth-2 , 2);
fi->from_pc = read_memory_short(after_prolog_fp + reg_save_depth-2 );
/* Rememeber any others too */
@ -307,7 +307,7 @@ examine_prologue (ip, limit, after_prolog_fp, fsr, fi)
}
if (have_fp)
/* We keep the old FP in the SP spot */
fsr->regs[SP_REGNUM] = read_memory_integer(fsr->regs[6],2);
fsr->regs[SP_REGNUM] = (read_memory_short(fsr->regs[6])) ;
else
fsr->regs[SP_REGNUM] = after_prolog_fp + reg_save_depth;
@ -384,7 +384,7 @@ void h8300_pop_frame()
{
if(fsr.regs[regnum])
{
write_register(regnum, read_memory_integer (fsr.regs[regnum], 2));
write_register(regnum, read_memory_short (fsr.regs[regnum]));
}
flush_cached_frames();

View File

@ -510,14 +510,29 @@ int fromtty;
{
if (s->flags & SEC_LOAD)
{
char *buffer = xmalloc(s->_raw_size);
bfd_get_section_contents(abfd, s, buffer, 0, s->_raw_size);
int i;
hms_write_inferior_memory(s->vma, buffer, s->_raw_size);
#define DELTA 2048
char *buffer = xmalloc(DELTA);
printf_filtered("%s: %4x .. %4x ",s->name, s->vma, s->vma + s->_raw_size);
for (i = 0; i < s->_raw_size; i+= DELTA)
{
int delta = DELTA;
if (delta > s->_raw_size - i)
delta = s->_raw_size - i ;
bfd_get_section_contents(abfd, s, buffer, i, delta);
hms_write_inferior_memory(s->vma + i, buffer, delta);
printf_filtered("*");
fflush(stdout);
}
printf_filtered( "\n");
free(buffer);
}
s = s->next;
}
DEXIT("hms_load()");
}
@ -545,16 +560,19 @@ hms_create_inferior (execfile, args, env)
if (OPEN(hms_desc))
{
char buffer[100];
hms_kill(NULL,NULL);
hms_clear_breakpoints();
init_wait_for_inferior ();
/* Clear the input because what the hms sends back is different
* depending on whether it was running or not.
*/
/*sprintf(buffer,"g %x", entry_pt);
hms_write_cr(buffer);
*/
hms_write_cr("");
hms_write_cr("r");
expect_prompt();
@ -680,6 +698,7 @@ set_rate()
#endif
ioctl (hms_desc, TIOCSETP, &sg);
}
static void
@ -690,14 +709,13 @@ get_baudrate_right()
while (!is_baudrate_right())
{
which_rate++;
if (baudtab[which_rate].rate == -1)
{
which_rate = 0;
}
else
{
which_rate++;
}
baudrate = baudtab[which_rate].rate;
printf_filtered("Board not responding, trying %d baud\n",baudrate);
@ -860,9 +878,8 @@ hms_resume (step, sig)
if (step)
{
hms_write_cr("s");
hms_write("\003",1);
expect_prompt();
expect("Step>");
/* Force the next hms_wait to return a trap. Not doing anything
about I/O from the target means that the user has to type
"continue" to see any. FIXME, this should be fixed. */
@ -871,7 +888,7 @@ hms_resume (step, sig)
else
{
hms_write_cr("g");
expect("g\r");
expect("g");
}
DEXIT("hms_resume()");
}
@ -888,7 +905,7 @@ hms_wait (status)
of the string cannot recur in the string, or we will not
find some cases of the string in the input. */
static char bpt[] = "At breakpoint:\r";
static char bpt[] = "At breakpoint:";
/* It would be tempting to look for "\n[__exit + 0x8]\n"
but that requires loading symbols with "yc i" and even if
we did do that we don't know that the file has symbols. */
@ -920,46 +937,56 @@ hms_wait (status)
timeout = 0; /* Don't time out -- user program is running. */
immediate_quit = 1; /* Helps ability to QUIT */
while (1) {
QUIT; /* Let user quit and leave process running */
ch_handled = 0;
ch = readchar ();
if (ch == *bp) {
bp++;
if (*bp == '\0')
break;
ch_handled = 1;
while (1)
{
QUIT; /* Let user quit and leave process running */
ch_handled = 0;
ch = readchar ();
if (ch == *bp)
{
bp++;
if (*bp == '\0')
break;
ch_handled = 1;
*swallowed_p++ = ch;
} else
bp = bpt;
if (ch == *ep || *ep == '?') {
ep++;
if (*ep == '\0')
break;
if (!ch_handled)
*swallowed_p++ = ch;
ch_handled = 1;
} else
ep = exitmsg;
if (!ch_handled) {
char *p;
/* Print out any characters which have been swallowed. */
for (p = swallowed; p < swallowed_p; ++p)
putc (*p, stdout);
swallowed_p = swallowed;
if ((ch != '\r' && ch != '\n') || swallowed_cr>10)
{
putc (ch, stdout);
swallowed_cr = 10;
}
swallowed_cr ++;
}
*swallowed_p++ = ch;
}
else
{
bp = bpt;
}
if (ch == *ep || *ep == '?')
{
ep++;
if (*ep == '\0')
break;
if (!ch_handled)
*swallowed_p++ = ch;
ch_handled = 1;
}
else
{
ep = exitmsg;
}
if (!ch_handled) {
char *p;
/* Print out any characters which have been swallowed. */
for (p = swallowed; p < swallowed_p; ++p)
putc (*p, stdout);
swallowed_p = swallowed;
if ((ch != '\r' && ch != '\n') || swallowed_cr>10)
{
putc (ch, stdout);
swallowed_cr = 10;
}
swallowed_cr ++;
}
}
if (*bp== '\0')
{
WSETSTOP ((*status), SIGTRAP);
@ -1044,11 +1071,11 @@ char *a;
{
int i;
write(hms_desc,a,l);
if (!quiet)
for (i = 0; i < l ; i++)
{
printf("%c", a[i]);
}
if (!quiet)
for (i = 0; i < l ; i++)
{
printf("%c", a[i]);
}
}
hms_write_cr(s)
@ -1081,8 +1108,6 @@ hms_fetch_registers ()
linebuf[REGREPLY_SIZE] = 0;
gottok = 0;
if (linebuf[0] == 'r' &&
linebuf[1] == '\r' &&
linebuf[2] == '\n' &&
linebuf[3] == 'P' &&
linebuf[4] == 'C' &&
linebuf[5] == '=' &&
@ -1359,7 +1384,7 @@ hms_read_inferior_memory(memaddr, myaddr, len)
if (memaddr & 0xf) abort();
if (len != 16) abort();
sprintf(buffer, "m %4x %4x", start, end);
sprintf(buffer, "m %4x %4x", start & 0xffff, end & 0xffff);
hms_write_cr(buffer);
/* drop the echo and newline*/
for (i = 0; i < 13; i++)
@ -1410,7 +1435,7 @@ hms_read_inferior_memory(memaddr, myaddr, len)
hms_write("\003",1);
hms_write_cr(" ");
expect_prompt();
@ -1620,9 +1645,13 @@ char *s;
}
}
static hms_speed(s)
static
hms_speed(s)
char *s;
{
check_open();
if (s)
{
char buffer[100];
@ -1637,10 +1666,7 @@ char *s;
which++;
}
printf_filtered("Checking target is in sync\n");
get_baudrate_right();
baudrate = newrate;
@ -1648,7 +1674,7 @@ char *s;
baudrate);
sprintf(buffer, "tm %d. N 8 1", baudrate);
hms_write(buffer);
hms_write_cr(buffer);
}
}

View File

@ -44,11 +44,12 @@ extern void init_extra_frame_info ();
#define IEEE_FLOAT
/* Define the bit, byte, and word ordering of the machine. */
#define TARGET_BYTE_ORDER BIG_ENDIAN
#undef TARGET_INT_BIT
#define TARGET_INT_BIT 16
#undef TARGET_PTR_BIT
#define TARGET_PTR_BIT 16
/* Offset from address of function to start of its code.
@ -304,3 +305,8 @@ UNSIGNED_SHORT(read_memory_integer (read_register (SP_REGNUM), 2))
#define NAMES_HAVE_UNDERSCORE
typedef unsigned short INSN_WORD;
#define ADDR_BITS_REMOVE(addr) ((addr) & 0xffff)
#define ADDR_BITS_SET(addr) (((addr)))
#define read_memory_short(x) (read_memory_integer(x,2) & 0xffff)