* 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) Sun Mar 1 17:41:09 1992 Per Bothner (bothner@cygnus.com)
* rs6000-xdep.c (frame_initial_stack_address): Move * rs6000-xdep.c (frame_initial_stack_address): Move

View File

@ -80,12 +80,13 @@ lookup_pointer_type (type)
TYPE_POINTER_TYPE (type) = ptype; TYPE_POINTER_TYPE (type) = ptype;
/* We assume the machine has only one representation for pointers! */ /* 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; TYPE_CODE (ptype) = TYPE_CODE_PTR;
/* pointers are unsigned */
TYPE_FLAGS(ptype) |= TYPE_FLAG_UNSIGNED;
} }
return (ptype); return (ptype);
} }

View File

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

View File

@ -510,15 +510,30 @@ int fromtty;
{ {
if (s->flags & SEC_LOAD) if (s->flags & SEC_LOAD)
{ {
char *buffer = xmalloc(s->_raw_size); int i;
bfd_get_section_contents(abfd, s, buffer, 0, s->_raw_size);
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); free(buffer);
} }
s = s->next; s = s->next;
} }
DEXIT("hms_load()"); DEXIT("hms_load()");
} }
@ -545,15 +560,18 @@ hms_create_inferior (execfile, args, env)
if (OPEN(hms_desc)) if (OPEN(hms_desc))
{ {
char buffer[100];
hms_kill(NULL,NULL); hms_kill(NULL,NULL);
hms_clear_breakpoints(); hms_clear_breakpoints();
init_wait_for_inferior (); init_wait_for_inferior ();
/* Clear the input because what the hms sends back is different /* Clear the input because what the hms sends back is different
* depending on whether it was running or not. * depending on whether it was running or not.
*/ */
/*sprintf(buffer,"g %x", entry_pt);
hms_write_cr("r"); hms_write_cr(buffer);
*/
hms_write_cr("");
expect_prompt(); expect_prompt();
@ -680,6 +698,7 @@ set_rate()
#endif #endif
ioctl (hms_desc, TIOCSETP, &sg); ioctl (hms_desc, TIOCSETP, &sg);
} }
static void static void
@ -690,14 +709,13 @@ get_baudrate_right()
while (!is_baudrate_right()) while (!is_baudrate_right())
{ {
which_rate++;
if (baudtab[which_rate].rate == -1) if (baudtab[which_rate].rate == -1)
{ {
which_rate = 0; which_rate = 0;
} }
else
{
which_rate++;
}
baudrate = baudtab[which_rate].rate; baudrate = baudtab[which_rate].rate;
printf_filtered("Board not responding, trying %d baud\n",baudrate); printf_filtered("Board not responding, trying %d baud\n",baudrate);
@ -860,9 +878,8 @@ hms_resume (step, sig)
if (step) if (step)
{ {
hms_write_cr("s"); hms_write_cr("s");
expect("Step>");
hms_write("\003",1);
expect_prompt();
/* Force the next hms_wait to return a trap. Not doing anything /* 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 about I/O from the target means that the user has to type
"continue" to see any. FIXME, this should be fixed. */ "continue" to see any. FIXME, this should be fixed. */
@ -871,7 +888,7 @@ hms_resume (step, sig)
else else
{ {
hms_write_cr("g"); hms_write_cr("g");
expect("g\r"); expect("g");
} }
DEXIT("hms_resume()"); DEXIT("hms_resume()");
} }
@ -888,7 +905,7 @@ hms_wait (status)
of the string cannot recur in the string, or we will not of the string cannot recur in the string, or we will not
find some cases of the string in the input. */ 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" /* It would be tempting to look for "\n[__exit + 0x8]\n"
but that requires loading symbols with "yc i" and even if but that requires loading symbols with "yc i" and even if
we did do that we don't know that the file has symbols. */ we did do that we don't know that the file has symbols. */
@ -920,20 +937,26 @@ hms_wait (status)
timeout = 0; /* Don't time out -- user program is running. */ timeout = 0; /* Don't time out -- user program is running. */
immediate_quit = 1; /* Helps ability to QUIT */ immediate_quit = 1; /* Helps ability to QUIT */
while (1) { while (1)
{
QUIT; /* Let user quit and leave process running */ QUIT; /* Let user quit and leave process running */
ch_handled = 0; ch_handled = 0;
ch = readchar (); ch = readchar ();
if (ch == *bp) { if (ch == *bp)
{
bp++; bp++;
if (*bp == '\0') if (*bp == '\0')
break; break;
ch_handled = 1; ch_handled = 1;
*swallowed_p++ = ch; *swallowed_p++ = ch;
} else }
else
{
bp = bpt; bp = bpt;
if (ch == *ep || *ep == '?') { }
if (ch == *ep || *ep == '?')
{
ep++; ep++;
if (*ep == '\0') if (*ep == '\0')
break; break;
@ -941,8 +964,12 @@ hms_wait (status)
if (!ch_handled) if (!ch_handled)
*swallowed_p++ = ch; *swallowed_p++ = ch;
ch_handled = 1; ch_handled = 1;
} else }
else
{
ep = exitmsg; ep = exitmsg;
}
if (!ch_handled) { if (!ch_handled) {
char *p; char *p;
/* Print out any characters which have been swallowed. */ /* Print out any characters which have been swallowed. */
@ -1081,8 +1108,6 @@ hms_fetch_registers ()
linebuf[REGREPLY_SIZE] = 0; linebuf[REGREPLY_SIZE] = 0;
gottok = 0; gottok = 0;
if (linebuf[0] == 'r' && if (linebuf[0] == 'r' &&
linebuf[1] == '\r' &&
linebuf[2] == '\n' &&
linebuf[3] == 'P' && linebuf[3] == 'P' &&
linebuf[4] == 'C' && linebuf[4] == 'C' &&
linebuf[5] == '=' && linebuf[5] == '=' &&
@ -1359,7 +1384,7 @@ hms_read_inferior_memory(memaddr, myaddr, len)
if (memaddr & 0xf) abort(); if (memaddr & 0xf) abort();
if (len != 16) 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); hms_write_cr(buffer);
/* drop the echo and newline*/ /* drop the echo and newline*/
for (i = 0; i < 13; i++) 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(); expect_prompt();
@ -1620,9 +1645,13 @@ char *s;
} }
} }
static hms_speed(s) static
hms_speed(s)
char *s; char *s;
{ {
check_open();
if (s) if (s)
{ {
char buffer[100]; char buffer[100];
@ -1637,18 +1666,15 @@ char *s;
which++; which++;
} }
printf_filtered("Checking target is in sync\n"); printf_filtered("Checking target is in sync\n");
get_baudrate_right(); get_baudrate_right();
baudrate = newrate; baudrate = newrate;
printf_filtered("Sending commands to set target to %d\n", printf_filtered("Sending commands to set target to %d\n",
baudrate); baudrate);
sprintf(buffer, "tm %d. N 8 1", 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 IEEE_FLOAT
/* Define the bit, byte, and word ordering of the machine. */ /* Define the bit, byte, and word ordering of the machine. */
#define TARGET_BYTE_ORDER BIG_ENDIAN #define TARGET_BYTE_ORDER BIG_ENDIAN
#undef TARGET_INT_BIT #undef TARGET_INT_BIT
#define TARGET_INT_BIT 16 #define TARGET_INT_BIT 16
#undef TARGET_PTR_BIT
#define TARGET_PTR_BIT 16
/* Offset from address of function to start of its code. /* 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 #define NAMES_HAVE_UNDERSCORE
typedef unsigned short INSN_WORD; 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)