From 359a097f9fac5066bce1f1fc78ff99d61c1d94cc Mon Sep 17 00:00:00 2001 From: Jim Kingdon Date: Tue, 30 Mar 1993 23:06:29 +0000 Subject: [PATCH] Tue Mar 30 08:06:24 1993 Jim Kingdon (kingdon@cygnus.com) * command.c (do_setshow_command): Use %u with var_{u,z}integer. * command.{c,h}: New var_type var_integer. main.c: Use it for history_size. * rs6000-tdep.c, xcoffexec.c, config/rs6000/xm-rs6000.h, breakpoint.c: Lint and byte-order fixups. --- gdb/ChangeLog | 8 ++++++++ gdb/breakpoint.c | 2 +- gdb/command.c | 25 ++++++++++++++++++++++++- gdb/config/rs6000/xm-rs6000.h | 3 +++ gdb/rs6000-tdep.c | 33 ++++++++++++++++++++++----------- gdb/xcoffexec.c | 16 ++++++++++------ 6 files changed, 68 insertions(+), 19 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 166fdab6c92..853af4d9a6e 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,13 @@ Tue Mar 30 08:06:24 1993 Jim Kingdon (kingdon@cygnus.com) + * command.c (do_setshow_command): Use %u with var_{u,z}integer. + + * command.{c,h}: New var_type var_integer. + main.c: Use it for history_size. + + * rs6000-tdep.c, xcoffexec.c, config/rs6000/xm-rs6000.h, breakpoint.c: + Lint and byte-order fixups. + * breakpoint.c (print_it_normal): Return 0 after hitting watchpoint. * breakpoint.h (bpstat): New field print_it. diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index 070ea857360..678ea2b2857 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -942,7 +942,7 @@ bpstat_stop_status (pc, frame_address) "Error evaluating expression for watchpoint %d\n"; char message[sizeof (message1) + 30 /* slop */]; sprintf (message, message1, b->number); - switch (catch_errors (watchpoint_check, bs, message)) + switch (catch_errors (watchpoint_check, (char *) bs, message)) { case WP_DISABLED: /* We've already printed what needs to be printed. */ diff --git a/gdb/command.c b/gdb/command.c index abcc1a0d69f..092f860ddbd 100644 --- a/gdb/command.c +++ b/gdb/command.c @@ -1058,6 +1058,20 @@ do_setshow_command (arg, from_tty, c) if (*(unsigned int *) c->var == 0) *(unsigned int *) c->var = UINT_MAX; break; + case var_integer: + { + unsigned int val; + if (arg == NULL) + error_no_arg ("integer to set it to."); + val = parse_and_eval_address (arg); + if (val == 0) + *(int *) c->var = INT_MAX; + else if (val >= INT_MAX) + error ("integer %u out of range", val); + else + *(int *) c->var = val; + break; + } case var_zinteger: if (arg == NULL) error_no_arg ("integer to set it to."); @@ -1101,8 +1115,17 @@ do_setshow_command (arg, from_tty, c) } /* else fall through */ case var_zinteger: - fprintf_filtered (stdout, "%d", *(unsigned int *) c->var); + fprintf_filtered (stdout, "%u", *(unsigned int *) c->var); break; + case var_integer: + if (*(int *) c->var == INT_MAX) + { + fputs_filtered ("unlimited", stdout); + } + else + fprintf_filtered (stdout, "%d", *(int *) c->var); + break; + default: error ("gdb internal error: bad var_type in do_setshow_command"); } diff --git a/gdb/config/rs6000/xm-rs6000.h b/gdb/config/rs6000/xm-rs6000.h index 5ee3bdda984..6a9b8c1defb 100644 --- a/gdb/config/rs6000/xm-rs6000.h +++ b/gdb/config/rs6000/xm-rs6000.h @@ -85,6 +85,9 @@ extern char *strdup PARAMS ((char *)); #define SIGWINCH_HANDLER aix_resizewindow extern void aix_resizewindow (); +/* This doesn't seem to be declared in any header file I can find. */ +char *termdef PARAMS ((int, int)); + /* `lines_per_page' and `chars_per_line' are local to utils.c. Rectify this. */ #define SIGWINCH_HANDLER_BODY \ diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c index d07c94526e0..94aadf24d99 100644 --- a/gdb/rs6000-tdep.c +++ b/gdb/rs6000-tdep.c @@ -135,7 +135,7 @@ single_step (signal) if (!one_stepped) { loc = read_pc (); - read_memory (loc, &insn, 4); + read_memory (loc, (char *) &insn, 4); breaks[0] = loc + INSNLEN(insn); opcode = insn >> 26; @@ -322,7 +322,14 @@ extern int stop_stack_dummy; void push_dummy_frame () { - int sp, pc; /* stack pointer and link register */ + /* stack pointer. */ + CORE_ADDR sp; + + /* link register. */ + CORE_ADDR pc; + /* Same thing, target byte order. */ + char pc_targ[4]; + int ii; target_fetch_registers (-1); @@ -338,7 +345,8 @@ push_dummy_frame () } sp = read_register(SP_REGNUM); - pc = read_register(PC_REGNUM); + pc = read_register(PC_REGNUM); + memcpy (pc_targ, (char *) &pc, 4); dummy_frame_addr [dummy_frame_count++] = sp; @@ -357,7 +365,7 @@ push_dummy_frame () set_current_frame (create_new_frame (sp-DUMMY_FRAME_SIZE, pc)); /* save program counter in link register's space. */ - write_memory (sp+8, &pc, 4); + write_memory (sp+8, pc_targ, 4); /* save all floating point and general purpose registers here. */ @@ -382,7 +390,7 @@ push_dummy_frame () sp -= DUMMY_FRAME_SIZE; /* And finally, this is the back chain. */ - write_memory (sp+8, &pc, 4); + write_memory (sp+8, pc_targ, 4); } @@ -449,7 +457,7 @@ pop_dummy_frame () void pop_frame () { - int pc, lr, sp, prev_sp; /* %pc, %lr, %sp */ + CORE_ADDR pc, lr, sp, prev_sp; /* %pc, %lr, %sp */ struct aix_framedata fdata; FRAME fr = get_current_frame (); int addr, ii; @@ -469,11 +477,11 @@ pop_frame () addr = get_pc_function_start (fr->pc) + FUNCTION_START_OFFSET; function_frame_info (addr, &fdata); - read_memory (sp, &prev_sp, 4); + prev_sp = read_memory_integer (sp, 4); if (fdata.frameless) lr = read_register (LR_REGNUM); else - read_memory (prev_sp+8, &lr, 4); + lr = read_memory_integer (prev_sp+8, 4); /* reset %pc value. */ write_register (PC_REGNUM, lr); @@ -826,7 +834,7 @@ ran_out_of_registers_for_arguments: ++f_argno; } - write_memory (sp+24+(ii*4), VALUE_CONTENTS (arg), len); + write_memory (sp+24+(ii*4), (char *) VALUE_CONTENTS (arg), len); ii += ((len + 3) & -4) / 4; } } @@ -927,7 +935,7 @@ CORE_ADDR pc; for (ii=0; trampoline_code[ii]; ++ii) { op = read_memory_integer (pc + (ii*4), 4); if (op != trampoline_code [ii]) - return NULL; + return 0; } ii = read_register (11); /* r11 holds destination addr */ pc = read_memory_integer (ii, 4); /* (r11) value */ @@ -1110,7 +1118,10 @@ unsigned int pid; vmap_ldinfo(ldi); do { - add_text_to_loadinfo (ldi->ldinfo_textorg, ldi->ldinfo_dataorg); + /* We are allowed to assume CORE_ADDR == pointer. This code is + native only. */ + add_text_to_loadinfo ((CORE_ADDR) ldi->ldinfo_textorg, + (CORE_ADDR) ldi->ldinfo_dataorg); } while (ldi->ldinfo_next && (ldi = (void *) (ldi->ldinfo_next + (char *) ldi))); diff --git a/gdb/xcoffexec.c b/gdb/xcoffexec.c index e3bbba5c2bf..0fae0902de0 100644 --- a/gdb/xcoffexec.c +++ b/gdb/xcoffexec.c @@ -241,8 +241,9 @@ build_section_table (some_bfd, start, end) } void -sex_to_vmap(bfd *bf, sec_ptr sex, struct vmap_and_bfd *vmap_bfd) +sex_to_vmap(bfd *bf, sec_ptr sex, PTR arg3) { + struct vmap_and_bfd *vmap_bfd = (struct vmap_and_bfd *)arg3; register struct vmap *vp, **vpp; register struct symtab *syms; bfd *arch = vmap_bfd->pbfd; @@ -571,9 +572,10 @@ retry: /* found a corresponding VMAP. remap! */ ostart = vp->tstart; - vp->tstart = ldi->ldinfo_textorg; + /* We can assume pointer == CORE_ADDR, this code is native only. */ + vp->tstart = (CORE_ADDR) ldi->ldinfo_textorg; vp->tend = vp->tstart + ldi->ldinfo_textsize; - vp->dstart = ldi->ldinfo_dataorg; + vp->dstart = (CORE_ADDR) ldi->ldinfo_dataorg; vp->dend = vp->dstart + ldi->ldinfo_datasize; if (vp->tadj) { @@ -920,9 +922,10 @@ bfd_err: offset += ldip->ldinfo_next; - vp->tstart = ldip->ldinfo_textorg; + /* We can assume pointer == CORE_ADDR, this code is native only. */ + vp->tstart = (CORE_ADDR) ldip->ldinfo_textorg; vp->tend = vp->tstart + ldip->ldinfo_textsize; - vp->dstart = ldip->ldinfo_dataorg; + vp->dstart = (CORE_ADDR) ldip->ldinfo_dataorg; vp->dend = vp->dstart + ldip->ldinfo_datasize; if (vp->tadj != 0) { @@ -965,7 +968,8 @@ bfd_err: vmap_symtab (vp); - add_text_to_loadinfo (ldip->ldinfo_textorg, ldip->ldinfo_dataorg); + add_text_to_loadinfo ((CORE_ADDR)ldip->ldinfo_textorg, + (CORE_ADDR)ldip->ldinfo_dataorg); } while (ldip->ldinfo_next != 0); vmap_exec (); do_cleanups (old); -- 2.30.2