From 07aa9fdc6b069aa8c02333a37e5da34f19e10f8c Mon Sep 17 00:00:00 2001 From: Peter Schauer Date: Sat, 15 Oct 1994 10:50:07 +0000 Subject: [PATCH] * eval.c (evaluate_subexp): Make fnptr a LONGEST instead of using longest_to_int. * infcmd.c (run_stack_dummy): Reinstate set_current_frame call, mips and alpha targets need the real breakpoint pc for creating the breakpoint frame. * stack.c (return_command): Cast return value to the return type of the function from which we return. * values.c (set_return_value): Pass VALUE_CONTENTS unmodified to STORE_RETURN_VALUE. * symtab.c (lookup_symbol): Remove search for `static mangled symbols', the search for `static symbols' already looks for mangled and demangled symbols via lookup_block_symbol. * valarith.c (value_binop): Use ANSI C arithmetic conversions when performing integral evaluations, implement BINOP_EQUAL and BINOP_LESS. (value_equal, value_less): Use value_binop to perform the comparison if both operands have TYPE_CODE_INT. * rs6000-tdep.c (pop_frame): Make sure all registers are valid, as they are written back later. Handle sp restore for frameless functions. Use fdata.nosavedpc instead of fdata.frameless to determine if the pc has been saved. (function_frame_info): Handle `mr r31,r1', which is generated by gcc-2.6, as a synonym for `oril r31,r1,0'. (skip_trampoline_code): Handle shared library trampolines. * xcoffread.c (read_xcoff_symtabs): Record XMC_GL symbols with their real name. Enables setting of breakpoints in shared libraries before the executable is run. --- gdb/ChangeLog | 35 +++++++++++++++++++++++++++++++++++ gdb/rs6000-tdep.c | 29 +++++++++++++++++++++++------ gdb/values.c | 16 +--------------- gdb/xcoffread.c | 33 ++------------------------------- 4 files changed, 61 insertions(+), 52 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 70860ebe500..3abb0956bba 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,38 @@ +Sat Oct 15 03:43:00 1994 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) + + * eval.c (evaluate_subexp): Make fnptr a LONGEST instead + of using longest_to_int. + + * infcmd.c (run_stack_dummy): Reinstate set_current_frame call, + mips and alpha targets need the real breakpoint pc for + creating the breakpoint frame. + + * stack.c (return_command): Cast return value to the return + type of the function from which we return. + * values.c (set_return_value): Pass VALUE_CONTENTS unmodified + to STORE_RETURN_VALUE. + + * symtab.c (lookup_symbol): Remove search for `static mangled + symbols', the search for `static symbols' already looks for + mangled and demangled symbols via lookup_block_symbol. + + * valarith.c (value_binop): Use ANSI C arithmetic conversions + when performing integral evaluations, implement BINOP_EQUAL and + BINOP_LESS. + (value_equal, value_less): Use value_binop to perform the + comparison if both operands have TYPE_CODE_INT. + + * rs6000-tdep.c (pop_frame): Make sure all registers are valid, + as they are written back later. Handle sp restore for frameless + functions. Use fdata.nosavedpc instead of fdata.frameless to + determine if the pc has been saved. + (function_frame_info): Handle `mr r31,r1', which is generated by + gcc-2.6, as a synonym for `oril r31,r1,0'. + (skip_trampoline_code): Handle shared library trampolines. + * xcoffread.c (read_xcoff_symtabs): Record XMC_GL symbols with + their real name. Enables setting of breakpoints in shared libraries + before the executable is run. + Fri Oct 14 19:39:47 1994 Rob Savoye * monitor.h, remote-mon.c: Hack up to so the old ROM monitor diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c index b5df530da52..757e1115dd1 100644 --- a/gdb/rs6000-tdep.c +++ b/gdb/rs6000-tdep.c @@ -1,5 +1,6 @@ /* Target-dependent code for GDB, the GNU debugger. - Copyright 1986, 1987, 1989, 1991, 1992 Free Software Foundation, Inc. + Copyright 1986, 1987, 1989, 1991, 1992, 1993, 1994 + Free Software Foundation, Inc. This file is part of GDB. @@ -464,6 +465,9 @@ pop_frame () return; } + /* Make sure that all registers are valid. */ + read_register_bytes (0, NULL, REGISTER_BYTES); + /* figure out previous %pc value. If the function is frameless, it is still in the link register, otherwise walk the frames and retrieve the saved %pc value in the previous frame. */ @@ -471,8 +475,11 @@ pop_frame () addr = get_pc_function_start (fr->pc) + FUNCTION_START_OFFSET; function_frame_info (addr, &fdata); - prev_sp = read_memory_integer (sp, 4); if (fdata.frameless) + prev_sp = sp; + else + prev_sp = read_memory_integer (sp, 4); + if (fdata.nosavedpc) lr = read_register (LR_REGNUM); else lr = read_memory_integer (prev_sp+8, 4); @@ -666,10 +673,12 @@ function_frame_info (pc, fdata) fdata->frameless = 0; } - if (op == 0x603f0000) { /* oril r31, r1, 0x0 */ - fdata->alloca_reg = 31; - fdata->frameless = 0; - } + if (op == 0x603f0000 /* oril r31, r1, 0x0 */ + || op == 0x7c3f0b78) /* mr r31, r1 */ + { + fdata->alloca_reg = 31; + fdata->frameless = 0; + } } @@ -887,6 +896,8 @@ CORE_ADDR rs6000_struct_return_address; /* Indirect function calls use a piece of trampoline code to do context switching, i.e. to set the new TOC table. Skip such code if we are on its first instruction (as when we have single-stepped to here). + Also skip shared library trampoline code (which is different from + indirect function call trampolines). Result is desired PC to step until, or NULL if we are not in trampoline code. */ @@ -895,6 +906,7 @@ skip_trampoline_code (pc) CORE_ADDR pc; { register unsigned int ii, op; + CORE_ADDR solib_target_pc; static unsigned trampoline_code[] = { 0x800b0000, /* l r0,0x0(r11) */ @@ -907,6 +919,11 @@ CORE_ADDR pc; 0 }; + /* If pc is in a shared library trampoline, return its target. */ + solib_target_pc = find_solib_trampoline_target (pc); + if (solib_target_pc) + return solib_target_pc; + for (ii=0; trampoline_code[ii]; ++ii) { op = read_memory_integer (pc + (ii*4), 4); if (op != trampoline_code [ii]) diff --git a/gdb/values.c b/gdb/values.c index 916bf6f27ab..aa4a4f2090a 100644 --- a/gdb/values.c +++ b/gdb/values.c @@ -1466,8 +1466,6 @@ set_return_value (val) value_ptr val; { register enum type_code code = TYPE_CODE (VALUE_TYPE (val)); - double dbuf; - LONGEST lbuf; if (code == TYPE_CODE_ERROR) error ("Function return type unknown."); @@ -1476,19 +1474,7 @@ set_return_value (val) || code == TYPE_CODE_UNION) /* FIXME, implement struct return. */ error ("GDB does not support specifying a struct or union return value."); - /* FIXME, this is bogus. We don't know what the return conventions - are, or how values should be promoted.... */ - if (code == TYPE_CODE_FLT) - { - dbuf = value_as_double (val); - - STORE_RETURN_VALUE (VALUE_TYPE (val), (char *)&dbuf); - } - else - { - lbuf = value_as_long (val); - STORE_RETURN_VALUE (VALUE_TYPE (val), (char *)&lbuf); - } + STORE_RETURN_VALUE (VALUE_TYPE (val), VALUE_CONTENTS (val)); } void diff --git a/gdb/xcoffread.c b/gdb/xcoffread.c index 5605131fdc5..0cb2f3a6e20 100644 --- a/gdb/xcoffread.c +++ b/gdb/xcoffread.c @@ -1,5 +1,5 @@ /* Read AIX xcoff symbol tables and convert to internal format, for GDB. - Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993 + Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994 Free Software Foundation, Inc. Derived from coffread.c, dbxread.c, and a lot of hacking. Contributed by IBM Corporation. @@ -1365,38 +1365,9 @@ read_xcoff_symtab (objfile, nsyms) /* record trampoline code entries as mst_solib_trampoline symbol. When we lookup mst symbols, we will choose mst_text over mst_solib_trampoline. */ - -#if 1 - /* After the implementation of incremental loading of shared - libraries, we don't want to access trampoline entries. This - approach has a consequence of the necessity to bring the whole - shared library at first, in order do anything with it (putting - breakpoints, using malloc, etc). On the other side, this is - consistient with gdb's behaviour on a SUN platform. */ - - /* FIXME: I think this code is using "" instead of - the real name because there didn't used to be a way to prefer - mst_text symbols over mst_solib_trampoline symbols (in fact, - it was using mst_unknown because mst_solib_trampoline didn't - exist yet). Using the real name would cause better output - from print_address. */ - - /* Recording this entry is necessary. Single stepping relies on - this vector to get an idea about function address boundaries. */ - - prim_record_minimal_symbol_and_info - ("", cs->c_value, mst_solib_trampoline, - (char *)NULL, cs->c_secnum, objfile); -#else - - /* record trampoline code entries as mst_solib_trampoline symbol. - When we lookup minimal symbols, we will choose mst_text over - mst_solib_trampoline. */ - RECORD_MINIMAL_SYMBOL (cs->c_name, cs->c_value, mst_solib_trampoline, - symname_alloced, objfile); -#endif + symname_alloced, cs->c_secnum, objfile); continue; case XMC_DS: -- 2.30.2