From b9e585030c6d1007849c42d0bc19d1e77041505d Mon Sep 17 00:00:00 2001 From: Peter Schauer Date: Sat, 25 Mar 1995 09:23:10 +0000 Subject: [PATCH] * buildsym.c (patch_subfile_name): Update last_source_file with the real source file name. * dbxread.c (end_psymtab): Handle static functions in the SOFUN_ADDRESS_MAYBE_MISSING case by passing pst->filename to lookup_minimal_symbol. (process_one_symbol): Ignore extra outermost context from SunPRO cc and acc. * stabsread.c (define_symbol): Do not complain for SunPRO static variable encoding if STATIC_TRANSFORM_NAME is defined. * sparc-tdep.c, config/sparc/tm-sun4sol2.h (sunpro_static_transform_name): Renamed from solaris_static_transform_name. * config/sparc/tm-sun4os4.h (STATIC_TRANSFORM_NAME): Define to sunpro_static_transform_name for acc 3.0 compiled executables. * procfs.c, config/alpha/nm-osf2.h (PROCFS_DONT_TRACE_FAULTS): Renamed from PROCFS_DONT_TRACE_IFAULT, don't trace any faults if defined. * procfs.c (info_proc_siginfo): Cast sip->si_addr to `unsigned long' and use `lx' format for printing it. --- gdb/ChangeLog | 66 ++++++++++++++++++++++++++++ gdb/buildsym.c | 3 +- gdb/dbxread.c | 111 ++++++++++++++++++++++++----------------------- gdb/procfs.c | 25 +++++------ gdb/sparc-tdep.c | 20 ++++----- gdb/stabsread.c | 6 +++ 6 files changed, 149 insertions(+), 82 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 008448e6215..e10a7bdf39c 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,69 @@ +Sat Mar 25 01:16:10 1995 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) + + * buildsym.c (patch_subfile_name): Update last_source_file + with the real source file name. + * dbxread.c (end_psymtab): Handle static functions in the + SOFUN_ADDRESS_MAYBE_MISSING case by passing pst->filename + to lookup_minimal_symbol. + (process_one_symbol): Ignore extra outermost context from + SunPRO cc and acc. + * stabsread.c (define_symbol): Do not complain for SunPRO + static variable encoding if STATIC_TRANSFORM_NAME is defined. + * sparc-tdep.c, config/sparc/tm-sun4sol2.h + (sunpro_static_transform_name): Renamed from + solaris_static_transform_name. + * config/sparc/tm-sun4os4.h (STATIC_TRANSFORM_NAME): + Define to sunpro_static_transform_name for acc 3.0 compiled + executables. + * procfs.c, config/alpha/nm-osf2.h (PROCFS_DONT_TRACE_FAULTS): + Renamed from PROCFS_DONT_TRACE_IFAULT, don't trace any faults + if defined. + * procfs.c (info_proc_siginfo): Cast sip->si_addr to + `unsigned long' and use `lx' format for printing it. + +Fri Mar 24 15:45:42 1995 Stu Grossman (grossman@cygnus.com) + + * configure.in: Move test for m68*-est-* before m68*-*-coff*. + * findvar.c: Move default def of CANNOT_STORE_REGISTER closer to + the beginning of the code. + * (write_register_gen): New routine. Analogous to + read_register_gen. + * (write_register_bytes): Another rewrite! Make it smarter about + not updating regs with the same value. + * monitor.c (printf_monitor readchar): Use stderr instead of + stdout to output debug info. Also cleanup readchar a little. + * (expect): Make sure that excessive responses are null + terminated. + * (monitor_open): Check for magic number in monitor_ops struct. + Allow multiple commands as init strings. Also, clear all + breakpoints. + * (monitor_resume monitor_wait): Send a command to dump all the + regs for those targets which don't do so when waking up after a + continue command. + * (monitor_wait): Handle excessive response output better. + * (monitor_write_memory): Use block fill, word, and long word + commands (if they exist) to write memory more efficiently. + * General cleanups to use flag bits instead of individual flag + words in monitor_ops struct. + * (monitor_command): Return output from command. + * (monitor_load_srec): Allocate buffer only once. Use alloca. + Wait for load response string instead of using a timeout to start + sending S-records. Fix bug where value of srec_frame shrinks. If + hashmark is set, print `-' for retransmissions. General cleanups. + * (monitor_make_srec): Get rid of S-record default type kludge. + * monitor.h: Use seperate struct for memory and register + read/write commands. Memory commands can come in byte, word, + long, and longlong forms. + * (monitor_ops): Change lots of fields. Generalize some stuff. + Put all flags into flags word. Allow init to be a list of commands. + Add command for clearing all breakpoints, block fill, dumping all + registers. + * remote-est.c: Rewrite to use new monitor conventions. + * config/m68k/est.mt (TDEPFILES): Add monitor.o. + * config/m68k/tm-est.h: Set NUM_REGS to 18. + * testsuite/gdb.base/break.exp: Lots of cleanups. Use gdb_test + more thoroughly. + Thu Mar 23 23:20:00 1995 Jeff Law (law@snake.cs.utah.edu) * somsolib.c (som_solib_add): Handle case where a shared library diff --git a/gdb/buildsym.c b/gdb/buildsym.c index 45ee77affed..d62d2ee2162 100644 --- a/gdb/buildsym.c +++ b/gdb/buildsym.c @@ -1,5 +1,5 @@ /* Support routines for building symbol tables in GDB's internal format. - Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992 + Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1995 Free Software Foundation, Inc. This file is part of GDB. @@ -526,6 +526,7 @@ patch_subfile_names (subfile, name) { subfile->dirname = subfile->name; subfile->name = savestring (name, strlen (name)); + last_source_file = name; /* Default the source language to whatever can be deduced from the filename. If nothing can be deduced (such as for a C/C++ diff --git a/gdb/dbxread.c b/gdb/dbxread.c index a0a9820a6bd..e7793667528 100644 --- a/gdb/dbxread.c +++ b/gdb/dbxread.c @@ -1,5 +1,5 @@ /* Read dbx symbol tables and convert to internal format, for GDB. - Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994 + Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995 Free Software Foundation, Inc. This file is part of GDB. @@ -961,12 +961,8 @@ read_dbx_dynamic_symtab (section_offsets, objfile) if (sym->flags & BSF_GLOBAL) type |= N_EXT; - name = (char *) bfd_asymbol_name (sym); - record_minimal_symbol - (obsavestring (name, strlen (name), &objfile -> symbol_obstack), - sym_value, - type, - objfile); + record_minimal_symbol ((char *) bfd_asymbol_name (sym), sym_value, + type, objfile); } } @@ -1018,7 +1014,7 @@ read_dbx_dynamic_symtab (section_offsets, objfile) continue; } - name = bfd_asymbol_name (*rel->sym_ptr_ptr); + name = (char *) bfd_asymbol_name (*rel->sym_ptr_ptr); prim_record_minimal_symbol (obsavestring (name, strlen (name), &objfile -> symbol_obstack), address, @@ -1240,29 +1236,21 @@ end_psymtab (pst, include_list, num_includes, capping_symbol_offset, LDSYMLEN(pst) = capping_symbol_offset - LDSYMOFF(pst); pst->texthigh = capping_text; -#ifdef N_SO_ADDRESS_MAYBE_MISSING +#ifdef SOFUN_ADDRESS_MAYBE_MISSING /* Under Solaris, the N_SO symbols always have a value of 0, instead of the usual address of the .o file. Therefore, we have to do some tricks to fill in texthigh and textlow. The first trick is in partial-stab.h: if we see a static or global function, and the textlow for the current pst is still 0, then we use that function's address for - the textlow of the pst. + the textlow of the pst. */ - Now, to fill in texthigh, we remember the last function seen + /* Now, to fill in texthigh, we remember the last function seen in the .o file (also in partial-stab.h). Also, there's a hack in bfd/elf.c and gdb/elfread.c to pass the ELF st_size field to here via the misc_info field. Therefore, we can fill in a reliable texthigh by taking the address plus size of the - last function in the file. - - Unfortunately, that does not cover the case where the last function - in the file is static. See the paragraph below for more comments - on this situation. - - Finally, if we have a valid textlow for the current file, we run - down the partial_symtab_list filling in previous texthighs that - are still unknown. */ + last function in the file. */ if (pst->texthigh == 0 && last_function_name) { char *p; @@ -1277,31 +1265,12 @@ end_psymtab (pst, include_list, num_includes, capping_symbol_offset, strncpy (p, last_function_name, n); p[n] = 0; - minsym = lookup_minimal_symbol (p, objfile); + minsym = lookup_minimal_symbol (p, pst->filename, objfile); - if (minsym) { + if (minsym) pst->texthigh = SYMBOL_VALUE_ADDRESS (minsym) + (long) MSYMBOL_INFO (minsym); - } else { - /* This file ends with a static function, and it's - difficult to imagine how hard it would be to track down - the elf symbol. Luckily, most of the time no one will notice, - since the next file will likely be compiled with -g, so - the code below will copy the first fuction's start address - back to our texthigh variable. (Also, if this file is the - last one in a dynamically linked program, texthigh already - has the right value.) If the next file isn't compiled - with -g, then the last function in this file winds up owning - all of the text space up to the next -g file, or the end (minus - shared libraries). This only matters for single stepping, - and even then it will still work, except that it will single - step through all of the covered functions, instead of setting - breakpoints around them as it usualy does. This makes it - pretty slow, but at least it doesn't fail. - - We can fix this with a fairly big change to bfd, but we need - to coordinate better with Cygnus if we want to do that. FIXME. */ - } + last_function_name = NULL; } @@ -1309,7 +1278,7 @@ end_psymtab (pst, include_list, num_includes, capping_symbol_offset, if (pst->textlow == 0) /* This loses if the text section really starts at address zero (generally true when we are debugging a .o file, for example). - That is why this whole thing is inside N_SO_ADDRESS_MAYBE_MISSING. */ + That is why this whole thing is inside SOFUN_ADDRESS_MAYBE_MISSING. */ pst->textlow = pst->texthigh; /* If we know our own starting text address, then walk through all other @@ -1331,7 +1300,7 @@ end_psymtab (pst, include_list, num_includes, capping_symbol_offset, } /* End of kludge for patching Solaris textlow and texthigh. */ -#endif /* N_SO_ADDRESS_MAYBE_MISSING. */ +#endif /* SOFUN_ADDRESS_MAYBE_MISSING. */ pst->n_global_syms = objfile->global_psymbols.next - (objfile->global_psymbols.list + pst->globals_offset); @@ -1762,6 +1731,10 @@ process_one_symbol (type, desc, valu, name, section_offsets, objfile) /* This "symbol" just indicates the start of an inner lexical context within a function. */ + /* Ignore extra outermost context from SunPRO cc and acc. */ + if (n_opt_found && desc == 1) + break; + #if defined(BLOCK_ADDRESS_ABSOLUTE) /* Relocate for dynamic loading (?). */ valu += function_start_offset; @@ -1789,6 +1762,10 @@ process_one_symbol (type, desc, valu, name, section_offsets, objfile) /* This "symbol" just indicates the end of an inner lexical context that was started with N_LBRAC. */ + /* Ignore extra outermost context from SunPRO cc and acc. */ + if (n_opt_found && desc == 1) + break; + #if defined(BLOCK_ADDRESS_ABSOLUTE) /* Relocate for dynamic loading (?). */ valu += function_start_offset; @@ -2070,6 +2047,30 @@ process_one_symbol (type, desc, valu, name, section_offsets, objfile) case 'F': function_stab_type = type; +#ifdef SOFUN_ADDRESS_MAYBE_MISSING + /* Deal with the SunPRO 3.0 compiler which omits the address + from N_FUN symbols. */ + if (type == N_FUN && valu == 0) + { + struct minimal_symbol *msym; + char *p; + int n; + + p = strchr (name, ':'); + if (p == NULL) + p = name; + n = p - name; + p = alloca (n + 1); + strncpy (p, name, n); + p[n] = 0; + + msym = lookup_minimal_symbol (p, last_source_file, + objfile); + if (msym) + valu = SYMBOL_VALUE_ADDRESS (msym); + } +#endif + #ifdef SUN_FIXED_LBRAC_BUG /* The Sun acc compiler, under SunOS4, puts out functions with N_GSYM or N_STSYM. The problem is @@ -2086,16 +2087,18 @@ process_one_symbol (type, desc, valu, name, section_offsets, objfile) previous function. This means that we can use the minimal symbol table to get the address. */ - /* On solaris up to 2.2, the N_FUN stab gets relocated. - On Solaris 2.3, ld no longer relocates stabs (which - is good), and the N_FUN's value is now always zero. - The following code can't deal with this, because - last_pc_address depends on getting the address from a - N_SLINE or some such and in Solaris those are function - relative. Best fix is probably to create a Ttext.text symbol - and handle this like Ddata.data and so on. */ - - if (type == N_GSYM || type == N_STSYM) + /* Starting with release 3.0, the Sun acc compiler, + under SunOS4, puts out functions with N_FUN and a value + of zero. This gets relocated to the start of the text + segment of the module, which is no good either. + Under SunOS4 we can deal with this as N_SLINE and N_SO + entries contain valid absolute addresses. + Release 3.0 acc also puts out N_OPT entries, which makes + it possible to discern acc from cc or gcc. */ + + if (type == N_GSYM || type == N_STSYM + || (type == N_FUN + && n_opt_found && !block_address_function_relative)) { struct minimal_symbol *m; int l = colon_pos - name; diff --git a/gdb/procfs.c b/gdb/procfs.c index 00e92602b88..dba7599cdea 100644 --- a/gdb/procfs.c +++ b/gdb/procfs.c @@ -1460,12 +1460,8 @@ create_procinfo (pid) prfillset (&pi->prrun.pr_fault); prdelset (&pi->prrun.pr_fault, FLTPAGE); -#ifdef PROCFS_DONT_TRACE_IFAULT - /* Tracing T_IFAULT under Alpha OSF/1 causes a `floating point enable' - fault from which we cannot continue (except by disabling the - tracing). We rely on the delivery of a SIGTRAP signal (which is traced) - for the other T_IFAULT faults if tracing them is disabled. */ - prdelset (&pi->prrun.pr_fault, T_IFAULT); +#ifdef PROCFS_DONT_TRACE_FAULTS + premptyset (&pi->prrun.pr_fault); #endif if (ioctl (pi->fd, PIOCWSTOP, &pi->prstatus) < 0) @@ -2067,12 +2063,8 @@ do_attach (pid) prfillset (&pi->prrun.pr_fault); prdelset (&pi->prrun.pr_fault, FLTPAGE); -#ifdef PROCFS_DONT_TRACE_IFAULT - /* Tracing T_IFAULT under Alpha OSF/1 causes a `floating point enable' - fault from which we cannot continue (except by disabling the - tracing). We rely on the delivery of a SIGTRAP signal (which is traced) - for the other T_IFAULT faults if tracing them is disabled. */ - prdelset (&pi->prrun.pr_fault, T_IFAULT); +#ifdef PROCFS_DONT_TRACE_FAULTS + premptyset (&pi->prrun.pr_fault); #endif if (ioctl (pi->fd, PIOCSFAULT, &pi->prrun.pr_fault)) @@ -2997,7 +2989,8 @@ info_proc_siginfo (pip, summary) (sip -> si_signo == SIGSEGV) || (sip -> si_signo == SIGBUS)) { - printf_filtered ("addr=%#x ", sip -> si_addr); + printf_filtered ("addr=%#lx ", + (unsigned long) sip -> si_addr); } else if ((sip -> si_signo == SIGCHLD)) { @@ -3036,13 +3029,15 @@ info_proc_siginfo (pip, summary) if ((sip -> si_signo == SIGILL) || (sip -> si_signo == SIGFPE)) { - printf_filtered ("\t%-16#x %s.\n", sip -> si_addr, + printf_filtered ("\t%#-16lx %s.\n", + (unsigned long) sip -> si_addr, "Address of faulting instruction"); } else if ((sip -> si_signo == SIGSEGV) || (sip -> si_signo == SIGBUS)) { - printf_filtered ("\t%-16#x %s.\n", sip -> si_addr, + printf_filtered ("\t%#-16lx %s.\n", + (unsigned long) sip -> si_addr, "Address of faulting memory reference"); } else if ((sip -> si_signo == SIGCHLD)) diff --git a/gdb/sparc-tdep.c b/gdb/sparc-tdep.c index c83cbcde5b3..172f98d1a5b 100644 --- a/gdb/sparc-tdep.c +++ b/gdb/sparc-tdep.c @@ -279,8 +279,13 @@ CORE_ADDR sparc_extract_struct_value_address (regbuf) char regbuf[REGISTER_BYTES]; { +#ifdef GDB_TARGET_IS_SPARC64 + return extract_address (regbuf + REGISTER_BYTE (O0_REGNUM), + REGISTER_RAW_SIZE (O0_REGNUM)); +#else return read_memory_integer (((int *)(regbuf)) [SP_REGNUM] + (16 * SPARC_INTREG_SIZE), TARGET_PTR_BIT / TARGET_CHAR_BIT); +#endif } /* Find the pc saved in frame FRAME. */ @@ -1272,7 +1277,7 @@ get_longjmp_target (pc) related to C++ mangling, it is done for C too. */ char * -solaris_static_transform_name (name) +sunpro_static_transform_name (name) char *name; { char *p; @@ -1295,20 +1300,11 @@ solaris_static_transform_name (name) #ifdef GDB_TARGET_IS_SPARC64 -CORE_ADDR -sparc64_extract_struct_value_address (regbuf) - char regbuf[REGISTER_BYTES]; -{ - CORE_ADDR addr; - - /* FIXME: We assume a non-leaf function. */ - addr = read_register (I0_REGNUM); - return addr; -} - /* Utilities for printing registers. Page numbers refer to the SPARC Architecture Manual. */ +static void dump_ccreg PARAMS ((char *, int)); + static void dump_ccreg (reg, val) char *reg; diff --git a/gdb/stabsread.c b/gdb/stabsread.c index 66488f8e735..e2674e6099b 100644 --- a/gdb/stabsread.c +++ b/gdb/stabsread.c @@ -593,6 +593,12 @@ define_symbol (valu, string, desc, type, objfile) /* This was an anonymous type that was never fixed up. */ goto normal; +#ifdef STATIC_TRANSFORM_NAME + case 'X': + /* SunPRO (3.0 at least) static variable encoding. */ + goto normal; +#endif + default: complain (&unrecognized_cplus_name_complaint, string); goto normal; /* Do *something* with it */ -- 2.30.2