diff options
author | Steve Chamberlain <sac@cygnus> | 1992-03-03 07:05:23 +0000 |
---|---|---|
committer | Steve Chamberlain <sac@cygnus> | 1992-03-03 07:05:23 +0000 |
commit | 96743d3c3033705c391308b45e61686b10dba1d5 (patch) | |
tree | 0849cb4d8597111f54dcb0f977e2350704447d9d | |
parent | bff1c97a6634f6a8dfde48f22bfbd9b85b2e7170 (diff) | |
download | gdb-96743d3c3033705c391308b45e61686b10dba1d5.zip gdb-96743d3c3033705c391308b45e61686b10dba1d5.tar.gz gdb-96743d3c3033705c391308b45e61686b10dba1d5.tar.bz2 |
* 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.
-rw-r--r-- | gdb/ChangeLog | 9 | ||||
-rw-r--r-- | gdb/gdbtypes.c | 7 | ||||
-rw-r--r-- | gdb/h8300-tdep.c | 12 | ||||
-rw-r--r-- | gdb/remote-hms.c | 158 | ||||
-rw-r--r-- | gdb/tm-h8300.h | 8 |
5 files changed, 118 insertions, 76 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 3e1192a..f4802ff 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -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 diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c index c67b41c..a2bf943 100644 --- a/gdb/gdbtypes.c +++ b/gdb/gdbtypes.c @@ -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); } diff --git a/gdb/h8300-tdep.c b/gdb/h8300-tdep.c index 4983e34..0ef703d 100644 --- a/gdb/h8300-tdep.c +++ b/gdb/h8300-tdep.c @@ -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(); diff --git a/gdb/remote-hms.c b/gdb/remote-hms.c index 4e4e349..75af3b9 100644 --- a/gdb/remote-hms.c +++ b/gdb/remote-hms.c @@ -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; - - *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; + 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 ++; - + 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); } } diff --git a/gdb/tm-h8300.h b/gdb/tm-h8300.h index 330576e..12e5b05 100644 --- a/gdb/tm-h8300.h +++ b/gdb/tm-h8300.h @@ -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) |