From: David Taylor Date: Thu, 31 Dec 1998 21:58:30 +0000 (+0000) Subject: all remaining *.c *.h files from hp merge. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=65b07ddca8832033e0e102c3a2a0d9f9f5922a9d;p=binutils-gdb.git all remaining *.c *.h files from hp merge. --- diff --git a/gdb/.Sanitize b/gdb/.Sanitize index e6416196d7e..15753f57e2d 100644 --- a/gdb/.Sanitize +++ b/gdb/.Sanitize @@ -126,6 +126,7 @@ a29k-tdep.c a68v-nat.c abug-rom.c acconfig.h +acinclude.m4 aclocal.m4 alpha-nat.c alpha-tdep.c @@ -244,12 +245,15 @@ gould-tdep.c gould-xdep.c h8300-tdep.c h8500-tdep.c +hp-psymtab-read.c +hp-symtab-read.c hp300ux-nat.c hppa-tdep.c hppab-nat.c hppah-nat.c hppam3-nat.c hpread.c +hpread.h hpux-thread.c i386-stub.c i386-tdep.c @@ -269,6 +273,7 @@ inflow.c infptrace.c infrun.c inftarg.c +infttrace.c irix4-nat.c irix5-nat.c isi-xdep.c @@ -435,6 +440,7 @@ top.c top.h tracepoint.c tracepoint.h +tui typeprint.c typeprint.h ultra3-nat.c diff --git a/gdb/ChangeLog b/gdb/ChangeLog index db86c1dcf13..3e0342673d1 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,2821 @@ +Thu Dec 31 16:54:30 1998 David Taylor + + The following changes were made by + Elena Zannoni + Edith Epstein + David Taylor + + * config/pa/tm-hppa.h (INSTRUCTION_NULLIFIED): change to read + nullify instruction bit from IPSW only when we are not in a system + call. + (STRCAT_REGISTER, pa_do_strcat_registers_info): additional + parameter -- precision. + + * Makefile.in (BUILD_TUI): to build the tui, only when configured + with --enable-tui. + (YLWRAP): use ylwrap to avoid problems on systems w/o bison. + (gdb$(EXEEXT)): make it dependent on BUILD_TUI. + (all-tui): remove dependency from phony target. + (c-exp.tab.c): use ylwrap instead of bison. + (jv-exp.tab.c): ditto. + (f-exp.tab.c): ditto. + (m2-exp.tab.c): ditto. + + * configure.in (ENABLE_CFLAGS): define and export BUILD_TUI. + + * configure : regenerated. + + * c-typeprint.c (c_type_print_base): get to the method name by + skipping over all the namespaces, classes and '::'. + + * infcmd.c (run_command): only call SOLIB_RESTART if it's + defined. + (detach_command): ditto. + + * infptrace.c (call_ptrace): add some debugging code. + + * infrun.c (follow_inferior_fork): only define on HP. + (wait_for_inferior): only call SOLIB_IN_DYNAMIC_LINKER if we have + shared libraries; restore test of IN_SOLIB_DYNSYM_RESOLVE_CODE + removed by HP. + + Also, altered calls to c_val_print and val_print, to + reflect additional parameter to c_val_print and val_print. + Affected functions : scm_val_print, scm_value_print + + Also, altered calls to c_val_print, to + reflect additional parameter to c_val_print. + Affected functions : m2_val_print + + Altered calls to val_print, to reflect the + additional parameter for val_print. + Affected files : val_print_array_elements + + In addition there are new macro definitions : + target_pid_to_exec_file, target_acknowledge_forked_child, + target_create_catch_fork_hook, target_create_catch_vfork_hook, + target_has_forked, target_has_vforked. These are generalized + macros for dealing with fork/vfork/exec. + + In addition, there are new functions : normal_pid_to_exec_file, + normal_acknowledge_forked_child, normal_target_has_forked, + normal_target_has_vforked. + + Note : initialized the new fields to NULL -> use the definitions + supplied by inftarg.c. This may not be the correct thing + in all cases. Fix later. + + The INHERIT macro has additional entries for + to_require_attach and to_require_detach. + + The de_fault macro has additional entries for + to_require_attach and to_require_detach. + + The setup_target_debug function is altered to make + sure that the to_require_attach and to_require_detach + fields are set for the current_target. + + There are 4 new functions : find_default_require_attach, + find_default_require_detach, debug_to_require_attach, + debug_to_require_detach. + + removed some target_ops vector fields, HP folks changed + their minds about them : to_create_catch_fork_hook, + to_create_catch_vfork_hook + + * Makefile.in (ALLDEPFILES): add somread.c, hp-psymtab-read.c, + hp-symtab-read.c. + (SFILES): remove the above files + (COMMON_OBS): remove somread.o + + * Makefile.in (SFILES): Add the tui files to this, so they get + included in etags tables. + + * Makefile.in (all-tui): Renamed from tui-all, for consistency + with everything else. + + * Makefile.in (gdb$(EXEEXT)): Add tui-all to the list of + dependencies, and add tui/libtui.a to the link list. + (tui-all): New rule, which does a recursive make in the tui + subdir. + + * Makefile.in (tui/libtui.a): When recursing, pass down + ${FLAGS_TO_PASS}. And don't echo the make command. This is + closer to what the other recursions do. + + * Makefile.in: (HFILES_NO_SRCDIR) add hpread.h + (COMMON_OBS): add hp-psymtab-read.o, hp-symtab-read.o + (SFILES): add hp-psymtab-read.c, hp-symtab-read.c + add rules for the new files. + Remove hpread.c, hpread.o + + * Makefile.in: Allow the TUI code to be conditionally enabled. + (TUI_TARGET, TUI_LIBRARY): New variables, whose values are set by + the configuration script. They're set to the empty string when + the TUI isn't enabled. + (gdb$(GDBEXT)): Use those, instead of referring to tui-all and + tui/libtui.a directly. + + * Makefile.in: Avoid spurious relinking. + (gdb$(EXEEXT)): Depend on the actual tui library, not on a + fictitious target. Since the fictitious target never existed, make + would always relink. + (tui/libtui.a): Renamed from all-tui. Always recurse to make sure + the library is up to date. + (TUI_TARGET): Variable removed; there's no need for it any more. + + * Makefile.in: look for tui include files in the tui source dir. + + * Use automake's `aclocal' program to generate aclocal.m4, to allow + us to use automake macros in configure.in with impunity. + + * acconfig.h: Add an entry for the `TUI' symbol. + + * acinclude.m4: New file, containing the code from the old + aclocal.m4. Incorporate (by reference) ../bfd/acinclude.m4, not + ../bfd/aclocal.m4, since we only want bfd's local macros. + + * aclocal.m4: Now automagically generated. Just run aclocal! + + * annotate.c: HP merge, 4/15/98 snapshot + New function. annotate_catchpoint + + * annotate.h: HP merge, 4/15/98 snapshot + New function declaration. annotate_catchpoint + + * annotate.h: taking the new includes (symtab.h and gdbtypes.h). + not taking the ansic C build fix. + + * blockframe.c (blockvector_for_pc_sect): check that the end of + the block is >= to the pc, not just >. + (bpstat_do_actions): if we just set cmd to NULL, don't then try to + set it to cmd->next as we'll SEGV. + + * breakpoint.c (create_temp_exception_breakpoint): #if it out -- + nothing calls it. + (bpstat_stop_status): don't call SOLIB_HAVE_LOAD_EVENT if it's not + defined; don't call SOLIB_HAVE_UNLOAD_EVENT if it's not defined. + (bpstat_get_triggered_catchpoints): if we don't have shared + library support, then don't call SOLIB_LOADED_LIBRARY_PATHNAME nor + SOLIB_UNLOADED_LIBRARY_PATHNAME. + (watch_command_1): don't require a run before a watch command + unless we're on HP [it's an HP OS bug, not a generic limitation] + (catch_load_command_1): don't define if no shared libraries. + (catch_command_1): don't claim to support fork catchpoints unless + CHILD_INSERT_FORK_CATCHPOINT is defined, don't claim to support + vfork catchpoints unless CHILD_INSERT_VFORK_CATCHPOINT is defined, + don't clain to support shared library load catchpoints if shared + libraries aren't supported, and don't claim to support exec + catchpoints unless CHILD_INSERT_EXEC_CATCHPOINT is defined + + (bpstat_do_actions): simplify significantly. It's + now almost as simple as before the merge and it no longer has the + HP bug that breakpoint commands are executed repeatedly. + + (break_at_finish_command_1): rewrite and make sure + selected_frame points to a frame before using it. Fix string + termination error. + (break_at_finish_at_depth_command_1): ditto. + + (can_use_hw_watchpoints): new static variable. + (read_memory_nobpt): test for breakpoint type bp_none. + (insert_breakpoints): test for breakpoint type bp_catch_exec; + insure have a current frame before getting the frame address. + (remove_breakpoints): check for breakpoints of types bp_none, + bp_catch_fork, bp_catch_vfork, and bp_catch_exec. + (bpstat_stop_status): fix updates of b->hit_count. + (bpstat_have_active_hw_watchpoints): new function. + (create_exec_event_watchpoint): new function. + (watch_command_1): use can_use_hw_watchpoints. + (catch_fork_command_1): change name of function to call from + target_create_catch_(v)fork_hook to create_(v)fork_even_catchpoint. + (delete_breakpoint): test for already deleted breakpoints; add + support for bp_catch_fork, bp_catch_vfork, and bp_catch_exec + breakpoints. + (_initialize_breakpoint): add can-use-hw-watchpoints to list of + user settable debugger variables. + + (clear_command): When there is no argument + to the clear command, delete all breakpoints that are hit at + default line. This will include a breakpoint whose line number + does not correspond to the default line, but has been set at + the default address. + + (delete_breakpoint): don't call bpstat_clear_actions, instead + clear things explicitly; if clearing breakpoint_at, then also + clear any associated actions so that bpstat_do_actions won't try + to execute them. + (_initialize_breakpoint): fix function name for bx command. + + (tbreak_command): remove static from declaration. + (maintenance_info_breakpoints): ditto. + + (reattach_breakpoints): new funct definition, used with with + hardware watchpoints + (breakpoint_1): change format and add entries to bptypes[] + (maintenance_info_breakpoints): function is no longer static + + (_initialize_breakpoint): removed a comment. + (exception_catchpoints_are_fragile, + exception_support_initialized): define. + (breakpoint_here_p): fixed syntax error in conditional + (disable_watchpoints_before_interactive_call_start): fixed call to + check_duplicates. Need a section parameter. + (enable_watchpoints_after_interactive_call_stop): fixed call to + check_duplicates. Need a section parameter. + (breakpoint_re_set_one): fixed call to check_duplicates. Need a + section parameter. + (delete_command): fixed syntax error in conditional + (breakpoint_re_set): fixed some typos. + + (args_for_catchpoint_enable): New type for handling exceptions. + (current_exception_event): New variable for handling exceptions. + (insert_breakpoints): check for additional breakpoint types -- + bp_catch_throw, bp_catch_catch, call_disabled. Also, do some + additional work to handle an exception catchpoint. + (remove_breakpoint): there are additional breakpoint types to + check for : bp_catch_throw, bp_catch_catch, call_disabled. Also do + some additional work to remove the exception catchpoints + (breakpoint_init_inferior): new input parameter. If there are + exception catchpoints delete them. + (breakpoint_here_p): there are additional breakpoint enable + settings to check for : shlib_disabled, call_disabled + (breakpoint_thread_match): there are additional breakpoint enable + settings to check for : call_disabled + (ep_is_catchpoint): there are additional breakpoint types to check + for : bp_catch_throw, bp_catch_catch + (ep_is_exception_catchpoint): new function + (bpstat_find_step_resume_breakpoint): new function + (bpstat_do_actions): introduce a local copy of the bpstat + structure. + (print_it_normal): there are additional breakpoint types to check + for : bp_catch_throw, bp_catch_catch Changeing the control + structure a bit (adding else ifs) Add code to print out info about + exceptions. + (bpstat_stop_status): there are additional breakpoint enable + settings to check for : call_disabled. there are additional + breakpoint types to chack for : bp_catch_catch and bp_catch_throw. + Check to see if stopped due to an exception. Minor fixes to the + catch_errors calls. Make sure to count all encountered + breakpoints. There was something funky going on previously with + the counting. + (bpstat_what): Add cases for new breakpoint types : + bp_catch_catch, bp_catch_throw. + (bpstat_get_triggered_catchpoints): Check for new breakpoint types + : bp_catch_catch, bp _catch_throw. + (breakpoint_1): account for new breakpoint types. + (describe_other_breakpoints): account for new breakpoint enable + setting (call_disabled) + (check_duplicates): account for new breakpoint enable setting + (call_disabled) + (disable_breakpoints_in_shlibs): new function + (disable_watchpoints_before_interactive_call_start): new function + (mention): account for new breakpoint types. + (break_command_1): some additional checking for a valid PC. + (watch_command_1): some dditional checking to prevent a watch + before a run command. + (ep_parse_optional_filename): simplified for loop. + (create_exception_catchpoint): new function + (cover_target_enable_exception_callback): new function + (handle_gnu_4_16_catch_command): this used to be thcatch_command_1 + function.e + (create_temp_exception_breakpoint): new function + (catch_command_1): differs from gdb 4.16 and gdb 4.17. Is now + calling catch_exception_command_1 using the EX_EVENT_CATCH and + EX_EVENT_THROW values as parameters. + (clear_command): additional comments + (delete_breakpoint): handle exceptions. Check for additional + breakpoint enable settings : shlib_disabled, call_disabled. + (delete_command): HP folks are claiming that we should not delete + shlib_event breakpoints + (breakpoint_re_set_one): moved call to check_duplicates. Add new + breakpoint types to switch statement. + (breakpoint_re_set_thread): new function + (enable_command): account for new breakpoint types. + + (insertion_state_t): new enumerated type. + (remove_breakpoint): new param in funct prototype. + (insert_breakpoints): check for bp_catch_fork and bp_catch_vfork. + (remove_breakpoints): changed call to remove_breakpoint. + (detach_breakpoints): new function. + (remove_breakpoint): New parameter, is. Also changed the + way b->inserted is set. + (ep_is_catchpoint): New function. + (ep_is_shlib_catchpoint): New function. + (print_it_normal): check for bp_catch_load, bp_catch_unload, + bp_catch_fork, bp_catch_vfork, bp_catch_exec. Also new code + to print out catchpoints properly. + (bpstat_stop_status): check for bp_catch_fork, bp_catch_vfork, + and bp_catch_exec. Also, some code to check for catching a + shared library load/unload. + (bpstat_what): Added catch_shlib_event to class enumeration. + Defined new macro, shlr. Expanded the bpstat_what_main_action + table. Add cases for bp_catch_load, bp_catch_unload, + bp_catch_fork, bp_catch_vfork, and bp_catch_exec. + (bpstat_get_triggered_catchpoints): New function. + (breakpoint_1): changes to bptypes definition. Also check for + bp_catch_load, bp_catch_unload, bp_catch_fork, bp_catch_vfork, + bp_catch_exec. Similar changes to the switch statement. + (set_raw_breakpoint): initialize new breakpoint structure fields. + dll_pathname, triggered_dll_pathname, forked_inferior_pid, + exec_pathname. + (create_solib_load_unload_event_breakpoint): New function. + (create_solib_load_event_breakpoint): New function. + (create_solib_unload_event_breakpoint): New function. + (create_fork_vfork_event_catchpoint): New function. + (create_fork_event_catchpoint): New function. + (create_vfork_event_catchpoint): New function. + (mention): new cases for bp_catch_load, bp_catch_unload, + bp_catch_fork, bp_catch_vfork, bp_catch_exec. + (ep_skip_leading_whitespace): New function. + (ep_find_event_name_end): New function. + (ep_parse_optional_if_clause): New function. + (ep_parse_optional_filename): New function. + (catch_fork_kind): New enumerated type. + (catch_fork_command_1): New function. + (catch_exec_command_1) : New function. + (catch_load_command_1) : New function. + (catch_unload_command_1) : New function. + (catch_throw_command_1) : New function. + (catch_command_1) : now calls catch_throw_command_1. + (tcatch_command) : New function. + (delete_breakpoint) : changed call to remove_breakpoint. + Also free the new fields in the breakpoint structure. + (breakpoint_re_set_one) : handle bp_catch_load, bp_catch_unload, + bp_catch_fork, bp_catch_vfork, bp_catch_exec. + (disable_command): handle bp_catch_load, bp_catch_unload, + bp_catch_fork, bp_catch_vfork, bp_catch_exec. + (enable_command): handle bp_catch_load, bp_catch_unload, + bp_catch_fork, bp_catch_vfork, bp_catch_exec. + (_initialize_breakpoint): Alter add_com call for catchpoints, + add add_com call for watchpoints. + + * breakpoint.h (enum bptype): new entries bp_catch_catch, + bp_catch_throw, and bp_none, bp_catch_load, bp_catch_unload, + bp_catch_fork, bp_catch_vfork,bp_catch_exec. Add declarations for + new functions bpstat_have_active_hw_watchpoints and + create_exec_event_catchpoint. + (tbreak_command): add prototype. + (update_breakpoints_after_exec): add prototype; update comments. + (reattach_breakpoints): new funct prototype declaration. + (enable): new enumerated value call_disabled. + (bpstat_find_step_resume_breakpoint): new funct decl. + (inf_context): new enumerated type. + (breakpoint_re_set_thread): new funct decl. + (breakpoint_init_inferior): new parameter. + (disable_watchpoints_before_interactive_call_start): new funct decl. + (enable_watchpoints_after_interactive_call_stop): new funct decl. + (disable_breakpoints_in_shlibs): new funct decl. + (struct breakpoint) : new fields, dll_pathname,triggered_dll_pathname, + forked_inferior_pid,exec_pathname BPSTAT_WHAT_CHECK_SHLIBS_RESUME_FROM_HOOK. + (bpstat_get_triggered_catchpoints): New function. + (detach_breakpoints): New function. + (create_solib_load_event_breakpoint): New function. + (create_solib_unload_event_breakpoint) New function. + (create_fork_event_catchpoint): New function. + (create_vfork_event_catchpoint): New function. + (ep_is_catchpoint): New function. + (ep_is_shlib_catchpoint) New function. + (enum bpstat_what_main_action) : new entry. + + * buildsym.c (finish_block): get rid of processing_hp_compilation; + handle LOC_INDIRECT case. Set the BLOCK_GCC_COMPILED to the right + compiler. + (push_context): add symbols for parameters to the context_stack. + (merge_symbol_lists): new function. Merges two symbol lists. + (struct context_stack): add new field param. + + (processing_hp_compilation): new external var. + + * c-exp.y: use external flag hp_som_som_object_present to decide + whether code was compiled by HP's compilers. Add two new C++ + tokens for true and false. + (yylex): check for template name is done differently for the + HP/aCC compiler case; change some of the template processing code + for handling HP aCC templates. + + * c-lang.c (c_create_fundamental_type): added case to handle + template args. Handle FT_BOOLEAN type. Set no sign flag for + FT_CHAR. + (cplus_builtin_types): new structure for c++ builtin types. + (cplus_language_defn): use cplus_builtin_types instead of + c_builtin_types. + + * c-lang.h(cp_print_value_fields): update prototype; fixed + prototype decl for c_val_print funct -- it needed an + embedded_offset param; fixed prototype of cp_print_value_fields. + include value.h. + (C_LANG_H): define. + + * c-typeprint.c (c_type_print_base): don't print 'privete' label + for a class if all members are private, similarly don't print + 'public' for a struct. Add support for sized enums (HP/aCC). get + rid of the 'static' keyword printed by the demangler for member + function, when printing the type of a class. 'static' will be + added by this function. If the demangled name is null, and the + method is not stubbed, get the signature by looking at the + information stored in the symbol structure. Remove printing of + 'const' and 'volatile' keywords for methods. This is now taken + care as part of the demangled member names. + (cp_type_print_method_args): new function. To print a C++ method + arguments and name to the output stream. + + (c_type_print_cv_qualifier): new function. Print out "const" and + "volatile" attributes. + (c_type_print_varspec_prefix): print const or volatile qualifiers. + (c_type_print_args): print 'void' for c++. + (c_type_print_varspec_suffix): print 'void' for a no argument + function. + (c_type_print_base): print const or volatile qualifiers. Do not + print 'unnamed union' if HP aCC compiler used. Distinguish + between struct and class based on the DECLARED_TYPE. Handle + HP/aCC compiler case for not printing vtable. Add Template + support. + + (cp_type_print_derivation_info): print out 'protected' when + appropriate. This applies only to HP's compilers, not gcc. + + (c_val_print): added parameter embedded_offset. Add + embedded_offset to valaddr in function calls; fix calls to + val_print and cp_print_value_fields. process TYPE_CODE_METHOD as + well. moved call to check_typedef out of conditional. added + embedded offset param to val_print call. + + (c_value_print): add new parameter to call to val_print. + handle pointer to class case. Attempt to + determine the real type of the object to be printed. + ensure that const char *, const unsigned char * + come out without the type but the volatile variants + and the signed variants don't. + + * ch-lang.h: + Added a parameter to the chill_val_print funct decl + + * coff-solib.c (coff_solib_add): add parameters to call + to symbol_file_add. + + * coff-solib.h: + (SOLIB_REMOVE_INFERIOR_HOOK): new macro. defined to 0. + functionality not implemented for coff. + + * coff-solib.h: + (SOLIB_CREATE_CATCH_LOAD_HOOK): new macro, generate error message + for coff. + (SOLIB_CREATE_CATCH_UNLOAD_HOOK): ditto. + (SOLIB_HAVE_LOAD_EVENT): ditto. + (SOLIB_LOADED_LIBRARY_PATHNAME): ditto. + (SOLIB_HAVE_UNLOAD_EVENT): ditto. + (SOLIB_UNLOADED_LIBRARY_PATHNAME): ditto. + (SOLIB_IN_DYNAMIC_LINKER): ditto. + (SOLIB_RESTART): ditto. + + * command.c (find_cmd): new function. (lookup_cmd_1): call it, + change parsing if tui_version or xdb_commands is set. + (_initialize_command): install new alias if xdb_commands is set. + + * complaints.h: add ifdef...endif pair at beginning and end of file. + + * config.in, configure: Regenerated. + + * config/pa/hppabsd.mh (NATDEPFILES): added new files + hp-psymtab-read.o and hp-symtab-read.o. + * config/pa/hppahpux.mh (NATDEPFILES): ditto. + + * config/pa/hppahpux.mh (TERMCAP): use -lHcurses + * config/pa/hppaosf.mh (NATDEPFILES): ditto. + + * config/pa/hpux1020.mh (TERMCAP): use -lHcurses + (MH_CFLAGS): new flag, -D__HP_CURSES, this define + is used by HP's linker to find the correct curses library + + * config/pa/hpux1020.mh: new file. + + * config/pa/hpux1020.mt: new file. + + * config/pa/hpux1100.mh (TERMCAP): Link against -lcurses, not + -lHcurses. The latter does not contain mvwaddstr, wscrl, or + wstbwlmkfzz. + + * config/pa/hpux1100.mh (TERMCAP): use -lHcurses + (MH_CFLAGS): new flag, -D__HP_CURSES, this define + is used by HP's linker to find the correct curses library + + * config/pa/hpux1100.mh (TERMCAP): when hosting on hpux 11.00, use + -lHcurses rather than -lcurses. + + * config/pa/hpux1100.mh: new file. + + * config/pa/hpux1100.mt: new file. + + * config/pa/nm-hppah.h (CHILD_HAS_SYSCALL_EVENT): new macro + (CHILD_THREAD_ALIVE): new macro + (STOPPED_BY_WATCHPOINT): add a condition to the macro, + ! stepped_after_stopped_by_watchpoint + (TARGET_ENABLE_HW_WATCHPOINTS): new macro + (hppa_enable_hw_watchpoints): new funct decl + (TARGET_DISABLE_HW_WATCHPOINTS): new macro + ( hppa_disable_hw_watchpoints): new funct decl + these are for HP's implementation of fast + watchpoints (via page protection). + (target_pid_to_str): new macro, calls hppa_pid_to_str + (target_tid_to_str): new macro, calls hppa_tid_to_str + + * config/pa/nm-hppah.h (CHILD_POST_WAIT): delete; + (CHILD_CREATE_CATCH_FORK_HOOK): replace with + CHILD_INSERT_FORK_CATCHPOINT and CHILD_REMOVE_FORK_CATCHPOINT. + (CHILD_CREATE_CATCH_VFORK_HOOK): replace with + CHILD_INSERT_VFORK_CATCHPOINT and CHILD_REMOVE_VFORK_CATCHPOINT. + (CHILD_CAN_FOLLOW_VFORK_PRIOR_TO_EXEC, + CHILD_INSERT_EXEC_CATCHPOINT, CHILD_REMOVE_EXEC_CATCHPOINT, + CHILD_HAS_EXECD, CHILD_REPORTED_EXEC_EVENTS_PER_EXEC_CALL, + CHILD_POST_ATTACH, TARGET_HAS_HARDWARE_WATCHPOINTS, + TARGET_CAN_USE_HARDWARE_WATCHPOINT, + TARGET_REGION_SIZE_OK_FOR_HW_WATCHPOINT, + TARGET_RANGE_PROFITABLE_FOR_HW_WATCHPOINT, STOPPED_BY_WATCHPOINT, + HAVE_NONSTEPPABLE_WATCHPOINT, target_insert_watchpoint, + target_remote_watchpoint): new macros.. + + * config/pa/nm-hppah.h (CHILD_XFER_MEMORY): reinsert accidentally + deleted define. + + * config/pa/nm-hppah.h: + (PREPARE_TO_PROCEED): defined macro to use + hppa_prepare_to_proceed + (hppa_pid_to_str): extern decl + (hppa_tid_to_str): extern decl + (target_pid_or_tid_to_str): new macro definition + (hppa_pid_or_tid_to_str): extern decl + (ENSURE_VFORKING_PARENT_REMAINS_STOPPED): new macro - for + handling events caused by a call to vfork. + (hppa_ensure_vforking_parent_remains_stopped): extern decl + (RESUME_EXECD_VFORKING_CHILD_TO_GET_PARENT_VFORK): new macro - + for handling events caused by a call to vfork. + (hppa_resume_execd_vforking_child_to_get_parent_vfork): extern decl + + * config/pa/nm-hppah.h: fix PREPARE_TO_PROCEED macro. + + * config/pa/nm-hppah.h: fix for gcc compile on HPUX + change PT_RDUAREA to PT_RUAREA + + * config/pa/nm-hppah.h: introduced an HPUXHPPA define. + A bit of a hack so that I can ifdef some code that + only works for the HP wildebeest debugger. + + * config/pa/nm-hppah.h: lots of new CHILD_ defines; + process_event_kind enum. + + * config/pa/tm-hppa.h (BREAKPOINT32): new define. + (CALL_DUMMY_HAS_COMPLETED): new define. + + * config/pa/tm-hppa.h (STACK_ALIGN): new macro + (NO_EXTRA_ALIGNMENT_NEEDED): new macro + (PC_REQUIRES_RUN_BEFORE_USE): new macro. + (REGISTER_NAMES): formatting in file changed. + (CR27_REGNUM): base register for thread local storage. + (USE_STRUCT_CONVENTION): new macro used to decide whether + a function returning a value of type type will + put it on the stack or into registers (based on the + PA risc calling conventions). + (EXTRACT_RETURN_VALUE): fixed calculation for extracting return value + (VALUE_RETURNED_FROM_STACK): new macro. + (TARGET_READ_PC): declared the function used in the definition. + (SKIP_TRAMPOLINE_CODE): declared the function used in the definition. + (TARGET_WRITE_PC): declared the function used in the definition. + (TARGET_READ_FP): declared the function used in the definition. + + * config/pa/tm-hppa.h (STRCAT_REGISTER): define macro for + future use. + (pa_do_strcat_registers_info): moved function decl from + defs.h to this HPUX specific .h file. + + * config/pa/tm-hppa.h (USE_STRUCT_CONVENTION): TYPE_LENGTH returns + bytes, not bits; fix off by 8 error. + + * config/pa/tm-hppa.h: + new comment for obj_unwind_info definition + New typedef, obj_private_struct + + * config/pa/tm-hppa.h: delete most target_ macros -- use default + versions instead; remove extraneous comma from proc_wait macro. + + * config/pa/tm-hppa.h: get rid of macro HP_COMPILED_TARGET. + + * config/pa/tm-hppa.h: removed redefinitions of + USE_STRUCT_CONVENTION and STACK_ALIGN macros. + + * config/pa/tm-hppa.h: some new definitions + New macros : ARG0_REGNUM, ARG1_REGNUM, ARG2_REGNUM, ARG3_REGNUM. + target_pid_to_exec_file, target_acknowledge_forked_child, + target_create_catch_fork_hook, target_create_catch_vfork_hook, + target_has_forked, target_has_vforked, require_attach, + require_detach, proc_wait + New funct decls : hppa_pid_to_exec_file, + hppa_acknowledge_forked_child, hppa_create_catch_fork_hook, + hppa_create_catch_vfork_hook, hppa_target_has_forked, + hppa_target_has_vforked, hppa_require_attach, + hppa_require_detach, process_wait + (unwind_table_entry): added comments to describe struct fields. + + * config/pa/tm-hppah.h (somsolib.h): include it. + + * config/pa/tm-hppah.h: + (CHILD_ENABLE_EXCEPTION_CALLBACK): new define + (CHILD_GET_CURRENT_EXCEPTION_EVENT): new define + + * config/pa/tm-hppah.h: Added a #define HPPUX_SNAP2 + + * configure, config.in: Regenerated. + + * configure.host (hppa-*-hpux10.20, hppa-*-hpux11.0*): New configs. + + * configure.in (AC_CHECK_HEADERS): Add check for term.h. + + * configure.in: Add an --enable-tui argument. + + * configure.in: Construct tui/Makefile from tui/Makefile.in. + + * configure.in: Use AM_PROG_CC_STDC. If we have the GUI, then we + need this to process libgui.h. + + * configure: Regenerated. + + * convex-tdep.c (decout): change FILE to GDB_FILE. + + * corefile.c (): add new include "objfiles.h". + (core_file_command): attempt to determine the name of the symbol + file from the core file. (read_memory_string): new function. + + * corefile.c: + (core_file_command): temporary hack to make non-hpux + work. For, non-hpux, t->to_core_file_to_sym_file + does not have a reasonable value. No target_ops vector + on the stack gives it a non-zero value. fix later. + + * corefile.c: add include of symfile.h (needed by objfiles.h). + + * corelow.c: + (core_file_to_sym_file): added new local variable, failing command, + and do some explicit type castings. + (core_ops): add three new fields : to_has_syscall_event, + to_enable_exception_callback, to_get_current_exception_event. + Necessary since we still have oldstyle initialization in + this file + + * corelow.c: HP merge, 4/15/98 snapshot + There are new target_ops vector fields that pertain + only to HPUX. Added the to_require_attach and + to_require_detach fields to core_ops. These new + fields are ifdef'ed for HPUX_SNAP1. + + * corelow.c: More target_ops vector changes for HPUX + (core_ops): new fields. ifdefed for HPUX_SNAP2. New fields are + to_post_wait, to_post_startup_inferior + to_acknowledge_created_inferior, to_clone_and_follow_inferior, + to_post_follow_inferior_by_clone, to_create_catch_fork_hook, + to_create_catch_vfork_hook, to_has_forked, to_has_vforked, + to_post_follow_vfork, to_pid_to_exec_file + + * corelow.c: include unistd.h + (core_file_to_sym_file): new function + (core_file_thread_alive): new function + (core_ops) : added new target ops vector fields. see below. And + yes we definitiely need to initialize them here, as long as + we're using static initialization. + + * corelow.c: remove HPUX_SNAP1 and HPUX_SNAP2 ifdefs + + * cxux-nat.c: + (add_shared_symbol_files): additonal params for calls to + symbol_file_add + + * defs.h + (gdb_file_isatty): new function decl. + + * defs.h (GDB_FILE): if TUI is defined, define a structure rather + than making this an alias for FILE. + (gdb_stdout, gdb_stderr): if TUI is defined, then define these + as pointers to variables of type GDB_FILE rather than making them + be aliases for stdout and stderr. + + * defs.h (TUIDO): add definition conditionalized on definition + (or lack thereof) of TUI. + + * defs.h (command_class): add two additional values. + (precision_type): new enum. + + * defs.h (gdb_fclose): add declaration. + + * defs.h (store_address): change prototype to match function. + + * defs.h (tui_version, xdb_commands, dbx_commands): add decl's. + + * defs.h: + (gdb_file_deallocate): new function declaration + + * defs.h: + (pa_do_strcat_registers_info): new function declaration. + tuiRegs.c currently calls this function directly. This + is not great. Should instead use a macro that is defined + in tm-hppa.h to be mapped to pa_do_strcat_registers_info. + Will change soon. Checking this in so that HP will have + something functional. + + * defs.h: + (streamtype): new enumerated type to distinguish between + output to a FILE and output to a buffer. + (tui_stream): new struct type, named GDB_FILE. Contains, + streamtype, FILE, buffer, and bufferlength fields. + (gdb_stdout): of type GDB_FILE, will pass this around gdb + rather than stdout. + (gdb_stderr): of type GDB_FILE, will pass this around gdb + rather than stderr. + (fputs_unfiltered_hook): change stream parameter from FILE to + GDB_FILE + (flush_hook): change stream parameter from FILE to GDB_FILE + (gdb_fclose): Fix declaration for gdb_fclose; parameter is now of + type GDB_FILE ** + (gdb_file_adjust_strbuf): new function declaration. function lives in + utils.c. + (gdb_file_init_astring): new function declaration. function lives + in utils.c + (gdb_file_get_strbuf): new function declaration. function lives + in utils.c + + * defs.h: Remove pa_do_strcat_registers_info function + declaration. + + * defs.h: additional include files included when TUI is defined. + + * defs.h: funct decl source_full_path_of. + + * demangle.c: add HP_DEMANGLING_STYLE_STRING. + + * demangle.c: added new demangling style, EDG_DEMANGLING_STYLE_STRING, + to the demanglers structure. This is for support of + Kuck & Assoc.'s changes for demangling. + + * eval.c (evaluate_subexp_standard): C++ member function changes. + + * eval.c (evaluate_subexp_standard): verify TYPE_TARGET_TYPE is + non NULL before dereferencing it. + + * eval.c (evaluate_subexp_standard): with HP/aCC compiler it is not possible + to perform inferior calls via function pointers. + Resolve calls to overloaded functions using find_overload_match. + We cannot handle HP/aCC pointers to member functions. + Deal with HP/aCC pointers to members in various kind of expressions. + + * f-lang.c (f_printchar): change FILE to GDB_FILE. + (f_printstr): ditto. + (emit_char): ditto. + + * f-lang.c (f_printstr): change stdout to gdb_stdout. + + * f-typeprint.c (f_print_type): change FILE to GDB_FILE. + (f_type_print_varspec_prefix): ditto. + (f_type_print_args): ditto. + (f_type_print_varspec_suffix): ditto. + (print_equivalent_f77_float_type): ditto. + (f_type_print_base): ditto. + + * findvar.c (): HP snapshot 3 changes. (extract_address): coerce + return value from extract_unsigned_integer to CORE_ADDR. + (store_address): change val from CORE_ADDR to LONGEST; changes to + support machines where CORE_ADDR and LONGEST are different sizes. + (get_saved_register): coerce arg to store_address to LONGEST. + (read_relative_register_raw_bytes): cast last arg to + store_address to LONGEST. (read_register): cast return from + extract_address to a CORE_ADDR. (write_register_pid): change val + from LONGEST to CORE_ADDR. (read_pc_pid): save and restore + inferior_pid if necessary. (write_pc_pid): ditto. + (read_var_value): cast arg to store_address. + + * findvar.c (read_relative_register_raw_bytes_for_frame): new + function. + (read_relative_register_raw_bytes): call it. + + * findvar.c (symbol_read_needs_frame): handle LOC_THREAD_LOCAL_STATIC and + LOC_INDIRECT. + + * fork-child.c (fork_inferior): chenge fifth parameter to be a + function returning void. + + * fork-child.c (fork_inferior): delete unused variable f. + + * fork-child.c: + (STARTUP_WITH_SHELL): new macro -- interim fix for a bug + (breakup_args): new function -- breaks up an argument string into + an argument suitable for passing into execvp(). + (fork_inferior): handling problems with starting up gdb with a shell. + -- again, this appears to be an interim fix. + + * fork-child.c: + (fork_inferior): Added a comment + (clone_and_follow_inferior): new function. + (startup_inferior): minor formatting changes. + + * fork-child.c: + (fork_inferior): HP change is problematic. The -f option has + different meanings for different shells. It is particularly + inappropriate for bourne shells. + + * fork-child.c: + (fork_inferior): added new parameter, pre_trace_fun. + pre_trace_fun is a function pointer. For some targets, + like HPUX, this function gets called to prepare for forking + a child. + + * fork-child.c: + (fork_inferior): fixed call to init_trace_fun + + * fork-child.c: + Moved definition of STARTUP_WITH_SHELL to inferior.h + Added a DEBUGGING macro. Currently set to 0. May remove + later. + breakup_args: add DEBUGGING ifdefs. more sophisticated + parsing to break up args. + (fork_inferior): rename kshell variable to shell. new local + variable, tryname. Make use of STARTUP_WITH_SHELL macro. + More error processing if starting up with a shell. + (startup_inferior): distinguish between starting up with a shell + and not doing so. + + * gdbthread.h: + Declarations for load_infrun_state and save_infrun_state take + an additional parameter. + + * gdbthread.h: Note that sometime between gdb 4.16 and 4.17, + thread.h was renamed gdbthread.h + (load_infrun_state): additional parameters + (store_infrun_state): additional parameters + + * gdbthread.h: include breakpoint.h + + * gnu-nat.c: + (init_gnu_ops): adding new target_ops vector fields and + removing a few. see list below + + * gnu-nat.c: + (init_gnu_ops): initializing new target ops vector fields + to_require_attach, to_require_detach, to_post_wait, + to_post_startup_inferior, to_acknowledge_created_inferior, + to_clone_and_follow_inferior, to_create_catch_fork_hook, + to_create_catch_vfork_hook, to_has_forked, to_has_vforked, + to_post_follow_vfork, to_pid_to_exec_file + (gnu_create_inferior): add param to fork_inferior call + + * hp-psymtab-read.c (QUICK_LOOK_UP): redefine to be 0. + (hpread_build_psymtabs): deal with enums. + (hpread_start_psymtab): include section offset. + (hpread_end_psymtab): take care of offset. + + * hp-psymtab-read.c (TRUE): define. + (FALSE): define. + (file_exists): new function. Checks for existance of file. + (hpread_pxdb_needed): rewrite. + (hpread_quick_traverse): use correct demangling style. + Handle F77 case. + (hpread_get_header): rewrite. + (hpread_get_textlow): add support for DOC_FUNCTION. + (hpread_build_psymtabs): make sure we do the right thing + for pxdb and F77. + + * hp-psymtab-read.c (hpread_pxdb_check): change parenthesis positions. + + * hp-psymtab-read.c (hpread_quick_traverse): compare CORE_ADDR + variable end_addr to 0 instaed of NULL to get rif of gcc warning. + + * hp-psymtab-read.c: + (hpread_get_textlow) : added param to function + Defined convennience macros and some datatypes and variables for + processing the quick lookup-tables. Looks like the code existed + before, but has been munged. + (hpread_pxdb_needed): Major rearrangements of code. Additional local + variables. Also, more extensive checking for various scenarios : + debug info for optimized code vs. unoptimized code, pxdb has been + run vs. pxdb has not been run. + (VALID_FILE): new macro + (VALID_MODULE): new macro + (VALID_PROC): new macro + (VALID_CLASS): new macro + (FILE_START): new macro + (MODULE_START): new macro + (PROC_START): new macro + (FILE_END): new macro + (MODULE_END): new macro + (PROC_END): new macro + (FILE_ISYM): new macro + (MODULE_ISYM): new macro + (PROC_ISYM): new macro + (VALID_CURR_FILE): new macro + (VALID_CURR_MODULE): new macro + (VALID_CURR_PROC): new macro + (VALID_CURR_CLASS): new macro + (CURR_FILE_START): new macro + (CURR_MODULE_START): new macro + (CURR_PROC_END): new macro + (CURR_FILE_ISYM): new macro + (CURR_MODULE_ISYM): new macro + (CURR_PROC_ISYM): new macro + (TELL_OBJFILE): new macro + (pst_syms_struct) : new typedef to keep track of the start/end symbol + table (LNTT) indices of psymtabs created so far. + (pst_syms_count) : new variable + (pst_syms_size): new variable + (told_objfile): new variable + (init_pst_syms): new function. sets up psymtab symbol index stuff. + (clear_pst_syms): new function. clean up psymtab symbol index stuff. + (record_pst_syms): new function. add info about newest psymtab to symbol + index table. + (find_next_pst_start): new function. Find a suitable symbol table index. + (find_next_file_isym): new function + (find_next_proc_isym): new function + (find_next_module_isym): new function + (scan_procs): new function. Scan and record partial symbols for all + functions starting from specified index and in a specified code range. + (hpread_quick_traverse: major rearrangement of code. The function + now uses all the nifty macros. There are some new local variables. + Check for EDG_DEMANGLING style. ifdef out some code for handling F77. + Previously, the function looped over all the modules in the table. + Now, the function loops over all the files, modules, and procedures. + With HP aCC and CTTI, it is possible for a compiled object to have a + file and no module. + (hpread_build_psymtabs): Added a section of code ifdefed by + QUICK_LOOK_UP. It check to see whether or not there are any globals + in the executable. Fix number of params to hpread_start_psymtab call. + Some changes to the way DNTT_TYPE_MODULE is handled. + (hpread_get_textlow): change in signature, minor code changes. The + function finds the low address associated with a specified symbol. + In looking for the address for the symbol avoid going of the end of + the LNTT file. + + * hp-psymtab-read.c: change TRUE to 1 and FALSE to 0. Do some + reformatting. + + * hp-psymtab-read.c: include demangle.h + (trans_lang): new function to let gdb know the correct language. + (hpread_quick_traverse): Use ARM style demangling. + Demangle procedures names. + Use gdb language names instead of hp language names. + Add symbol to list using its demangled name. + + * hp-psymtab-read.c: new file. + (hpread_call_pxdb): new function. Call PXDB to process our file. + (hpread_pxdb_check): new function. Return TRUE if the file needs + pre-processing by PXDB and we have thus called PXDB to do this + processing and the file needs to be re-loaded. + (hpread_quick_traverse): new function. Traverse the quick look-up + tables, building a set of psymtabs. + (hpread_get_header): new function. Get appropriate header from obj + file, based on pxdb type + (hpread_symfile_init): no change from hpread.c + (hpread_build_psymtabs): if there are quick lookup tables, read those, + then scan the global section LNTT. Otherwise, just scan the whole LNTT. + Changed: Add a global function entry to the global partial symbol list. + Handle end of symbols, for QLT case. + In case of TAGDEF, if it is a class or a template, add the name to the + var_namespace, so that it is known as a type by gdb. + In case of CONSTANT, and it is global, add it to the globals. + (hpread_symfile_finish): no change from hpread.c + (hpread_get_lntt): make it not static + (hpread_get_gntt): no change from hpread.c + (hpread_get_slt): make it not static + (hpread_get_textlow): no change from hpread.c + (hpread_start_psymtab): no change from hpread.c + (hpread_end_psymtab): no change from hpread.c + + * hp-symtab-read.c (hpread_get_scope_start): renamed. It was + hpread_get_depth. + (hpread_type_translate): distinguish between signed and unsigned char + types. + (hpread_psymtab_to_symtab): set flag for hp compilation. + (hpread_read_function_type): append symbols for parameters to local + list as well as to the global list. Get the parameters types from the + local list instead of the global list. + (hpread_read_struct_type): add new field num_fn_fields to next_fn_field + structure. Rewrite handling of templates + (hpread_type_lookup): change handling of dntt_type_modifier. + (hpread_process_one_debug_symbol): call hpread_get_scope_start instea + of hpread_get_depth. Handle enum as well. + (hpread_get_scope_depth): new function. Get nesting depth for a + DNTT entry. + + * hp-symtab-read.c (hpread_psymtab_to_symtab): set + processing_gcc_compilation to 0. + + * hp-symtab-read.c (hpread_psymtab_to_symtab_1): change stdout to + gdb_stdout; change fflush to gdb_flush. + (hpread_psymtab_to_symtab): change fflush to gdb_flush. + + * hp-symtab-read.c (hpread_read_enum_type): declare variable. + (hpread_read_struct_type): eliminate references + to 'args' member of fn_field. + + * hp-symtab-read.c (hpread_read_struct_type): a static member + is now indicated by the bitsize field, not the bitpos. + Initialize physname to empty. + (fix_static_member_physnames): use new macros to deal with + physnames. + + * hp-symtab-read.c (hpread_read_struct_type): change references + to bitpos member of struct field to use the FIELD_BITPOS macro. + + * hp-symtab-read.c (hpread_read_struct_type): comment out reference to + obsolete field fn_field.args. + Add struct complaint definitions for complaints. + (hpread_read_struct_type): change call to complain. + (hpread_read_array_type): change call to complain. + (hpread_type_lookup): change call to complain. + (hpread_process_one_debug_symbol): change calls to complain. + (hpread_type_translate): change calls to complain. + + * hp-symtab-read.c (hpread_read_struct_type): make sure bitvector + has been allocated before calling has_vtable. + + * hp-symtab-read.c (hpread_read_struct_type): revert change, + just check for vtable without checking for bitvectors too. + + * hp-symtab-read.c: + (hpread_expand_symtab): change name of local variable from + at_end_of_module to at_module_boundary. + Also, if demangling style is already EDG, do not reset it + to the HP demangling style. + Change at_end_of_module param to hpread_process_one_debug_symbol + call to at_module_boundary. + No longer break out of loop when reach end of module. With CTTI, + the compiler can generate function symbols which are not in + any module. Typically they show up after the end of one + module and before the start of the next module. + (hpread_read_struct_type): check that the debug info for + a TEMPLATE_ARG is correct. + (hpread_process_one_debug_symbol): change name of at_end_of_module_p + param to at_module_boundary_p. + Also set *at_module_boundary_p = -1 if missing a module end and set + it to 1 when finished expanding the debug info. + Handle TLS variable. + + * hp-symtab-read.c: include defs.h, symtab.h, gdbtypes.h, complaints.h. + (fixup_class): new static variable. + (fixup_method): new static variable. + (hpread_get_location): rewrite. + (hpread_has_name): add cases for DNTT_TYPE_DOC_FUNCTION and + DNTT_TYPE_DOC_MEMFUNC + (hpread_expand_symtab): use HP demangling style. + Set hp_som_som_object_present to 1. + (hpread_type_translate): error out if not immediate. Issue warning + if there is an unhandled type code. + (error_in_hpread_type_translate_complaint): remove this structure. + (hpread_read_enum_type): don't assume size of enum is always 4 bytes. + (hpread_read_function_type): add new parameter to indicate a new block. + Do not add the parameters to the symbol list. + If the type was read in earlier, do not modify the type structure. + If we are creating a new block, set the local symbol list to be the + param list. + Need to mark this type as preprocessed. + (hpread_read_doc_function_type): new function. Read and internalize + a native DOC function debug symbol. + (hpread_read_struct_type): a method can be of type doc_function and + doc_memfunc too. + Handle case in which a method is read before its class. Deal with + incomplete method types. + Handle cases in which HP/aCC compiler creates operator names w/o + the 'operator' keyword. Rewrite the loop over the fileds. + (fix_static_member_physnames): new function. Adjust the physnames for + each static member. + (fixup_class_method_type): new function. Fix-up the type structure for a + class. + (hpread_read_array_type): cahnge complaint to warning. + (hpread_type_lookup): add case for DNTT_TYPE_DOC_FUNCTION. + For structures/classes set static member to point to strings with full + names. + Change calls to hpread_read_function_type to pass extra parameter. + (hpread_record_lines): handle case for SLT_NORMAL_OFFSET. + (class_of): new function. Given a function "f" which is a member of a class, + find the classname that it is a member of. + (hpread_process_one_debug_symbol): deal with possible alias field from the + som record for the Function or Entry type. + Do the demangling ourselves if the gdb demangler failed. + Add support for DOC functions. + For function types, add parameters to local list. + (hpread_get_scope_depth): make this function a no-op. + (hpread_adjust_bitoffsets): new function. Adjust the bitoffsets for all + fields of an anonymous union. + (hpread_get_next_skip_over_anon_unions): new function. Skip over anonymous + unions. + + * hp-symtab-read.c: include demangle.h + (hpread_expand_symtab): Ensure we are using ARM-style demangling. + (hpread_process_one_debug_symbol): Set the mangled and demangled + names for functions. + Record the class name to generate the demangled names of member + functions. + + * hp-symtab-read.c: new file. + (hpread_get_depth): no change from hpread.c + (hpread_get_line): no change from hpread.c + (hpread_get_location): no change from hpread.c + (hpread_has_name): make it not static. Return 1 for DNTT_TYPE_BLOCKDATA + and DNTT_TYPE_MEMFUNC. Return 0 for CLASS_SCOPE, REFERENCE,PTRMEM, + PTRMEMFUNC, CLASS, GENFIELD, VFUNC, MEMACCESS, INHERITANCE, + FRIEND_CLASS, FRIEND_FUNC, MODIFIER, OBJECT_ID, TEMPLATE, TEMPLATE_ARG, + FUNC_TEMPLATE, LINK. + (hpread_psymtab_to_symtab_1): no changes from hpread.c + (hpread_psymtab_to_symtab): make it a static function + (hpread_expand_symtab): modified + (hpread_type_translate): if not typep.dntti.immediate do not abort, + but complain and return. Same for default action. Handle more HP_TYPEs. + (hpread_lookup_type): initially allocate a correct-size type-vector. + (hpread_alloc_type): reset type_addr only if a type was allocated. + (hpread_read_enum_type): if this has already a type associated, return. + (hpread_read_function_type): do different things depending on whether + function is a MEMFUNC, a TEMPLATE, a FUNCTION som record. + Do not use the LOC_REGPARM_ADDR symbol class. + (hpread_read_struct_type): handle classes and templates too. Major + rewrite. + (hpread_get_nth_template_arg): new function. + (hpread_read_templ_arg_type): new function. + (hpread_read_set_type): no change from hpread.c + (hpread_read_array_type): modified + (hpread_read_subrange_type): add handling of more DNTT entries. + added support for templates, classes, references, virtual functions. + (hpread_type_lookup): handle DNNT_TYPE_MODULE. + (hpread_record_lines): no changes from hpread.c + (hpread_process_one_debug_symbol): Handle WITH, COMMON, + CLASS_SCOPE. Expand TAGDEF case to handle classes and templates. + + * hppa-tdep.c: + (pa_do_strcat_registers_info): Has a new parameter, precision, + which is passed into the call to pa_strcat_fp_reg to indicate + whether to display the floating point registers using + single or double preceision. + (pa_strcat_registers): Introduce local variable, precision, and + pass it into call to pa_strcat_fp_reg. + (pa_strcat_fp_reg): Modified function. New parameter, precision, + used by function to decide whether to use single or double + precision. Also added the code to put a double precision value + into a buffer. + + * hppa-tdep.c: (): add'l includes , + , declare pa_register_look_aside, define is_pa_2. + (rp_saved): check for where to read the return pointer from. + (pa_do_registers_info): handle is_pa_2. (pa_register_look_aside): + new function. (pa_print_registers): handle is_pa_2. + (in_solib_call_trampoline): handle a compiler/linker error. + (skip_trampoline_code): changes to some masks used in examining + instructions. (inst_saves_fr): test for FSTWS instruction. + (skip_prologue): renamed to skip_prologue_hard_way. + (after_prologue): new function. (skip_prologue): new function. + + * hppa-tdep.c (after_prologue): if f is NULL, don't dereference + it. + + * hppa-tdep.c (after_prologue): if no debug info, return zero + telling caller that we need to find the end of the prologue via + the hard way (instruction examination). + + * hppa-tdep.c (find_unwind_entry): avoid dereferencing a null + pointer. + + * hppa-tdep.c (hppa_pid_to_exec_file): deleted -- no longer used. + + * hppa-tdep.c (hppa_prepare_to_proceeed): add prototype. + (read_unwind_info): purecov comments, bug fixes. + (find_unwind_entry): purecov comments, bug fixes. + (find_stub_with_shl_get): purecov comments. + (frame_chain): additional parens. + (hppa_push_arguments): changes to commented out version of routine. + (hppa_fix_call_dummy): purecov comments, fix location of end.o. + (in_solib_call_trampoline): purecov comments. + (in_solib_return_trampoline): purecov comments. + (setup_d_pid_in_inferior): fix location of end.o. + (initialize_hp_cxx_exception_support): fix location of end.o. + (child_enable_exception_callback): purecov comments. + + * hppa-tdep.c: + (pa_do_strcat_registers_info): new routine. called by + tui/tuiRegs.c:_tuiRegisterFormat to place a register name + and value into a string buffer. Interface may change in + future. Checking this in so that we have something + functional for HP. + (pa_strcat_registers): new routine, called by + pa_do_strcat_registers_info. Does same thing as + pa_print_registers except it takes a stream parameter. + This routine should disappear in future. Checking in + so that we have something functional to give HP + (pa_strcat_fp_reg): new routine, called by + pa_do_strcat_registers_info and pa_strvat_registers + to place a floating point register name and value into + a buffer. This interface may change in future. + Checking in so that we have something functional to give HP. + + * hppa-tdep.c: (pa_print_fp_reg): change prototype to match def'n. + (pa_register_look_aside): fix comment immediately before function. + + * hppa-tdep.c: changes to better support stack unwinding, + reading and writing registers for HPUX. The HP folks had + an advantage ... access to a runtime architecture spec ;-}. + New includes : ptrace.h + (internalize_unwinds): initialize new fields in table. + (read_unwind_info): entries in the table are now more complex + structures. References of the form ...->table[index].stub_type + are now ...->table[index].stub_unwind.stub_type. + (find_proc_framesize) : added a check for pc == 0. + (rp_saved): entries in the table are now more complex + structures. References of the form ...->table[index].stub_type + are now ...->table[index].stub_unwind.stub_type. + (frameless_function_invocation): stub_type becomes + stub_unwind.stub_type + (saved_pc_after_call): stub_type becomes stub_unwind.stub_type + (hppa_frame_saved_pc): stub_type becomes stub_unwind.stub_type + (frame_chain_valid): stub_type becomes stub_unwind.stub_type + (hppa_call_dummy): stub_type becomes stub_unwind.stub_type + (pa_print_fp_reg): additional params to call val_print + (in_solib_call_trampoline): stub_type becomes stub_unwind.stub_type + (in_solib_return_trampoline): stub_type becomes stub_unwind.stub_typ + (skip_trampoline_code): additional code to handle external + dyncalls. Also stub_type becomes stub_unwind.stub_type + (hppa_pid_to_exec_file): new funct. FOr HPUX 10.0 and beyond there + is an explicit ptrace request for getting the pathname associated + with a process id (pid). + + * hppa-tdep.c: fix for gcc compile on HPUX + (hppa_pid_to_exec_file): remove unwanted param from + call to call_ptrace. Note, hppa_pid_to_exec_file goes + away in subsequent hp snapshots. + + * hppa-tdep.c: include bfd.h. + include dl.h + (args_for_find_stub): new structure. + (find_unwind_entry): deal with null input pc value. + (rp_saved): ditto. + For the import stub, return -24 always. + (hppa_frame_saved_pc): save old pc value, to detect we are in a loop. + (init_extra_frame_info): use TARGET_READ_FP. + (frame_chain): include thread support. + If the caller's pc is zero, we loose and return, just like stack bottom. + Disable warning about being unable to find unwind info. + (hppa_push_arguments): rewrite. + (hppa_value_returned_from_stack): new function. Handles returning a value + larger that 64 bits, stored on the stack. + (find_stub_with_shl_get): new function. To look up symbols in shlibs. + (cover_find_stub_with_shl_get): new function. Cover routine for + find_stub_with_shl_get to pass to catch_errors. + (hppa_fix_call_dummy): comment out old stub mechanism. Rewrite using dyncall. + (target_read_fp): new function. + (pa_do_registers_info): floating point registers start at FP4. + (pa_print_registers): use FP4_REGNUM instead of 72. + (skip_trampoline_code): do machine instruction matching for PA2.0. + (setup_d_pid_in_inferior): new function. Exception handling support. + (initialize_hp_cxx_exception_support): ditto. + (child_enable_exception_callback): ditto. + (child_get_current_exception_event): ditto. + + * hppah-nat.c (child_post_wait, child_post_follow_vfork, + child_post_follow_inferior_by_clone): new functions. + + * hppah-nat.c (child_xfer_memory): make sure the call to ptrace really + fails before we give up. + (hppa_pid_to_str): new function. Format a process id. + (hppa_tid_to_str): new function. Format a thread id. + + * hppah-nat.c (child_xfer_memory): use xmalloc, not alloca. + (child_post_wait): delete. + (child_post_follow_vfork): delete decl of child_ops; delete + large chunks of function -- let it be handled by the normal + mechanism that notices and handles exec events, in resume(). + + * hppah-nat.c (require_notification_of_exec_events): new function; + just notify of exec events, not all events, and just the specified + pid, don't include it's children (10.20 version). + (child_acknowledge_created_inferior): call new function + require_notification_of_exec_events instead of + require_notification_of_events. + + * hppah-nat.c [!GDB_NATIVE_HPUX_11]: Move HPUX 10.x-specific + support code here from infptrace.c. + + * hppah-nat.c: removed #define ptrace call_ptrace + replaced all calls to ptrace with calls to call_ptrace + (parent_attach_all): removed call to ptrace + + * hpread.c (hpread_psymtab_to_symtab_1): change fflush to + gdb_flush; change stdout to gdb_stdout. + (hpread_psymtab_to_symtab): change fflush to gdb_flush. + + * hpread.h: new file. Includes all includes, struct defs, defines + from hpread.c. + + * infcmd.c + (attach_command): new local variable, exec_file, added code to + determine exec_file from pid if exec_file is not already known, + call new target operation, target_post_attach -- a no-op unless + on HPUXHPPA + (detach_command): after detaching, do a SOLIB_RESTART + + * infcmd.c (objfiles.h): fix typo on include line. + + * infcmd.c (run_command): only call SOLIB_RESTART if it's + defined. + (detach_command): ditto. + + * infcmd.c: + (run_stack_dummy): add calls to + disable_watchpoints_before_interactive_call_start and + enable_watchpoints_after_interactive_call_stops + (finish_command): alter code handling the evaluation and printing + of the target function's return value. + (attach_command): when given a pid, but no exec file, try to determine + the exec file from the process. If the process does not record a + full path name, try to qualify the filename against the source path. + (_initialize_infcmd): add some verbiage about how to use the attach command + + * infcmd.c: + Include objfiles.h + (run_command): If program has already been started, and decide + to restart it, the kill the target, fluch the caches, + call init_wait_for_inferior. Also purge old solib objfiles. + + * infcmd.c: cahnged calls to val_print, using a new macro, + SOLIB_RESTART + (run_command): calls SOLIB_RESTART + (do_registers_info): changed calls to val_print + + * infcmd.c: made the symfile.h include preceed the + objfiles.h include. The other ordering caused a + compile problem (incompletely defined types). + + * inferior.h (REQUIRE_DETACH): Fix default definition. + * inftarg.c (child_post_attach): Fix declaration, make static. + (proc_wait): Make globally visible. + (child_insert_fork_catchpoint, etc): Fix return type. + + * inferior.h (STARTUP_WITH_SHELL): new define. + (START_INFERIOR_TRAPS_EXPECTED): new define + + * inferior.h (fork_inferior): change fifth parameter to be a function + returning void. + + * inferior.h (proc_wait): Declare. + + * inferior.h: + (REQUIRE_ATTACH): new macro + (REQUIRE_DETACH): new macro + (detach): definition is now an extern + (clone_and_follow_inferior): new definition, it's also an extern + + * inferior.h: + (require_attach): default definition for require_attach funct + (require_detach): default definition for require_detach funct + (pre_fork_inferior): new funct decl for function defined in + infptrace.c + (fork_inferior): new parameter in funct decl. + + * inferior.h: + New variable decls : inferior_ignoring_startup_exec_events, + inferior_ignoring_leading_exec_events -- these variables + are used when processing an exec call. + (CALL_DUMMY_HAS_COMPLETED): new default macro -- for targets + where PC in call dummy implies that call dummy has + completed. Note, that on HPUX this inference does not hold. + + * infptrace.c + (require_notification_of_events): new function + (child_acknowledge_created_inferior): previously named + hppa_acknowledge_forked_child. Also calling + require_notification_of_events and clearing some semaphore + variables + (child_post_startup_inferior): new function + (child_create_catch_fork_hook): previously named + hppa_create_catch_fork_hook + (child_create_catch_vfork_hook): previously named + hppa_create_catch_vfork_hook + (child_has_forked) : previously named hppa_target_has_forked + (child_has_vforked): previously named hppa_target_has_vforked + (process_wait): changed to call target_post_wait + (attach): add call to require_notification_of_events + (child_pid_to_exec_file): new function + (hppa_require_attach): new local variable, pt_status + (hppa_get_process_events): new function + + * infptrace.c (call_ptrace): Simplify control flow. + (proc_wait): Move here from inftarg.c, add target_post_wait call. + + * infptrace.c (call_ptrace): add some debugging code. + + * infptrace.c (child_pid_to_exec_file): declare variable. + + * infptrace.c (kill_inferior): clean up call to proc_wait. + + * infptrace.c: + (call_ptrace): when the ptrace request is PT_SETTRC, + call ptrace and then call parent_attach_all. + + * infptrace.c: + (child_has_syscall_event): new function. only applicable + (for now) on HPUX 10.30 and beyond via the ttrace call. + In infptrace.c there is a default operation. + With ttrace, it is possible to tell the kernel to + notify the debugger that the target program is about to make + or return from a syscall. + (child_thread_alive): new function. a default function. + ptrace doesn't support kernel threads. + (hppa_enable_page_protection_events): defualt function + (hppa_disable_page_protection_events): default function + + * infptrace.c: + (child_pid_to_exec_file): fix number of params to cal_ptrace call. + + * infptrace.c: + (hppa_pid_or_tid_to_str): new function + (hppa_switched_threads): new function + (hppa_ensure_vforking_parent_remains_stopped): new function + (hppa_resume_execd_vforking_child_to_get_parent_vfork): new function + + * infptrace.c: Most of the changes found in infptrace.c should + be moved to hppah-nat.c + (PT_VERSION): a new define + (startup_semaphore_t): a new struct type. it is used to + coordinate the parent and child processes after a fork and + before an exec on HPUX. + (call_ptrace): changes to determine whether the ptrace + request is for starting the tracing of the target process. + (parent_attach_all): new funct. used on HPUX for coordinating + the parent and child processes after a fork and before and exec. + (hppa_acknowledge_forked_child) : new funct. prabably belongs + in hppah-nat.c + (hppa_enable_catch_fork) : new funct. probably belongs in + hppah-nat.c + (hppa_disable_catch_fork): new funct. probably belongs in + hppah-nat.c + (hppa_create_catch_fork_hook): new funct. probably belongs in + hppah-nat.c + (hppa_enable_catch_vfork): new funct. probably belongs in + hppah-nat.c + (hppa_disable_catch_vfork): new funct. probably belongs in + hppah-nat.c + (hppa_create_catch_vfork_hook): new funct. probably belongs to + hppah-nat.c + (hppa_target_has_forked): new funct. probably belongs in + hppah-nat.c + (hppa_target_has_vforked): new funct. probably belongs in + hppah-nat.c + (process_wait): new funct. also ifdefed for proc_wait. + (kill_inferior): call proc_wait rather than wait. this is + pretty hacky. + (pre_fork_inferior): new function. used only by HPUX. + probably should be defined elsewhere. + + * infrun.c (follow_inferior_fork): only define on HP. + (wait_for_inferior): only call SOLIB_IN_DYNAMIC_LINKER if we have + shared libraries; restore test of IN_SOLIB_DYNSYM_RESOLVE_CODE + removed by HP. + + * infrun.c (normal_stop): Add a call to the TUIDO + macro just before the annotate_stopped label. This + updates the windows after each program stop. + + * infrun.c (normal_stop): verify stop_command is non-zero before + dereferencing it (it won't be set if dbx_commands is set). + + * infrun.c (resume): Add #ifdef HPPAHPUX around HPUX-specific + code. + + * infrun.c (resume): add missing semicolon. + + * infrun.c (wait_for_inferior): fix syntax error. + + * infrun.c: + (follow_fork): eclosed calls to target_require_detach and + target_require_attach with HPUX_SNAP1 ifdef + + * infrun.c: + (follow_fork_mode_kind_names) : removed "both" option + (follow_fork): added parameters. additional code for handling + following of parent, following of child + (resume): added code for deciding how to resume in presence of + fork. Additional params to follow_fork call. + + * infrun.c: + (follow_exec): ifdef for HPUXHPPA for the moment, the + code in here assumes the existance of the child_ops + target vector. This is incorrect for Solaris. + + * infrun.c: + (resume): fixed ifdefs, HPPAHPUX -> HPUXHPPA + + * infrun.c: + (wait_for_inferior): fixed a matching parenths problem -- + matching curly brace inside ifdefed code which is not being + compiled. Change local validFlag to be an 'int' rather than + a 'bool' and fixed the corresponding assignment statements. + + * infrun.c: + Two new global variables: inferior_ignoring_startup_exec_events and + inferior_ignoring_leading_exec_events. + New static variables: parent_of_vfork_trap_expected_and_ignorable, + step_resume_breakpoint, through_sigtramp_breakpoint, pending_follow, + follow_vfork_when_exec + (follow_inferior_fork): does what follow_fork did! + (follow_fork): is now a wrapper function for follow_inferior_fork + (follow_vfork): is now a wrapper function for follow_inferior_fork + (follow_exec): new function, handles an exec event. + (resume): remove 3 local variables: child_pid, has_forked, has_vforked. + move and expand code that tries to follow a fork (i.e. also check + for vfork and exec + (init_wait_for_inferior): initialize the new structure, pending_follow + (delete_breakpoint_current_contents): when deleting all the breakpoints also + set the breakpoint struct pointer to NULL. + (wait_for_inferior): a number of changes. + The step_resume_breakpoint and through_sigtramp_breakpoint local + variables are now visible in entire module. + Changed name of variable from child_inferior_pid to saved_inferior_pid. + Added several cases to the event processing switch statement: + TARGET_WAITKIND_FORKED, TARGET_WAITKIND_VFORKED, TARGET_WAITKIND_EXECD. + Also, for TARGET_WAITKIND_STOPPED, check to see if expecting a trap + from the parent of a vfork (ignorable) otherwise break as usual. + When determining the value of 'random_signal' (0 or 1), no longer check for + catchpoints. + When determining how to handle unexpected signals, must now take into + account fork, vfork, and exec. + Change call to PC_IN_CALL_DUMMY to a call to CALL_DUMMY_HAS_COMPLETED + At stop_stepping label, check to see if stopped for fork or + vfork event. + + * infrun.c: New code is related to threads and fork/vfork/exec. + New static variable : thread_step_needed + Deleted static variable : parent_of_vfork_trap_expected_and_ignorable + Altered the pending_follow and fork_event structs + (follow_inferior_fork): Before detaching from child and removing + all breakpoints form it -- but only if forking or following + vforks as soon as they happen. Also reset the solib inferior hook. + The same kind of logic applies to hitting step_resume_breakpoints + (calling breakpoint_re_set_thread) and to resetting and inserting + breakpoints. + (follow_exec): forward decl + (follow_vfork): check to see if gdb followed the child. If + the child exec'd before gdb saw the parent's vfork event + then call follow_exec. + (follow_exec): if the exec occured after a vfork, then follow + the vfork as well. Do it before following the exec. + Make sure to update breakpoints after and exec + (resume): new local variable, should_resume. + Change parameters in calls to follow_fork, follow_vfork, and + follow_exec. Some changes to the way various pending_follow.kind + situations are handled (there's TARGET_WAITKIND_FORKED, + TARGET_WAITKIND_VFORKED, ARGET_WAITKIND_EXECD. Some additional + conditions to check before deciding to resume the target (i.e. + should_resume=1, stepping?, thread_step_needed?i, regular + resume?) + (proceed): When proceeded at location that does not have a breakpoint + set thread_step_needed=0 to indicate that it is not necessary to + single step thread over breakpoint. SOme additional checks to see + if it is necessary to step thread over breakpoint. + (start_remote): remove call to clear_proceed_status. + (init_wait_for_inferior): initialize new fields in fork_event + structure and add a call to clear_proceed_status. + (wait_for_inferior): new local variable : new_thread_event. + Initialize thread_step_needed = 0. + Minor massaging of conditions for adding a new thread to the thread list. + No longer resuming execution after adding a new thread. Let user play with thread first. + Some changes in the way TARGET_WAITKIND_FORKED, ARGET_WAITKIND_VFORKED, + TARGET_WAITKIND_EXECD are handled -- this is all HPUX related. + Simplified TARGET_WAITKIND_STOPPED -- HP previously had some + more complicated code in here. + Moved the code to resume threads to after the large case statement that processes the events. + Additional processing for stop_signal=TARGET_SIGNAL_TRAP. + Cleanup code at process_event_stop_test label. + Set thread_step_needed when processing a BPSTAT_WHAT_SINGLE. + Minor massaging of fork/vfork/exec part of stop_stepping code. + (normal_stop): minor changes. calling show_and_print_stack_frame. + (xdb_handle_command): new function + (_initialize_infrun): handle xdb_commands. also handle dbx commands + + * infrun.c: changes to support following forks, and handling + catchpoints. + (follow_fork_mode_kind_names): new array + (follow_fork): new function. implements the follow parent, + or child functionality. + (resume): additions to check whether the target process + just forked and decide which process to follow. + (wait_for_inferior): additional variables (child_inferior_pid, + stepping_through_solib_after_catch, + - stepping_through_solib_catchpoints. + - Altered CURRENTLY_STEPPING macro to check for stepping through + a shared library after hitting a catchpoint. + - Add parameters to save_infrun_state call + - Check for fork and vfork when deciding if event is a random + signal + - When considering stops due to breakpoints, check for + BPSTAT_WHAT_CHECK_SHLIBS_RESUME_FROM_HOOK + - Check for stop due to an explicit catchpoint + - When checking for single stepping event, also check for + stepping to get out of dynamic linker's hook after catching + a shlib event + (is_internal_shlib_eventpoint): new funct. check to see if + event type is bp_shlib_event. + (stopped_for_internal_shlib_event): new funct. check for shlib + events + (stopped_for_shlib_catchpoint): new funct. check for catchpoints. + (normal_stop): additions to check for shlib event + (set_follow_fork_mode_command): new funct. handles the new follow + fork command. + (_initialize_infrun): additions for follow-fork-mode command. + + * infrun.c: ifdefing references to + switched_from_inferior_pid for HPUXHPPA. They don't seem + useful for Solaris (i.e. non-HPUX) + + * infrun.c: included tuiData.h and tuiDataWin.h, ifdefed for TUI. + Included top.h. New static variables : switched_from_inferior_pid, + number_of_threads_in_syscalls. + (follow_inferior_fork): If there is a step_resume breakpoint + explicitly reset the thread number. + (resume): For TARGET_WAITKIND_VFORKED, removed a check for getting + the vfork event to soon. + (init_wait_for_inferior): added parameter to call to + breakpoint_init_inferior. Initialize number_of_threads_in_syscalls. + (wait_for_inferior): New local variables : prev_sal, + enable_hw_watchpoints_after_wait, stepping_through_sigtramp, + stepped_after_stopped_by_watchpoint. Enable watchpoints after a wait. + Added cases for TARGET_WAITKIND_SYSCALL_ENTRY and + TARGET_WAITKIND_SYSCALL_RETURN. + Do additional processing if stop due to breakpoint, but breakpoint is + only valid for a thread other than the one currently running. Additional + parameters to save_infrun_state and load_infrun_state. Some additional + processing for BPSTAT_WHAT_STEP_RESUME. Some additional processing to + handle stepping over a function. + (normal_stop): added notification of switching threads. ifdefing some + TUI changes and leaving out non-essential TUI changes. + (restore_selected_frame): ifdefing some TUI changes + (restore_inferior_status): ifdefing some TUI changes + + * infrun.c: remove HPUX_SNAP1 and HPUX_SNAP2 ifdefs + + * infrun.c: removed the TUI ifdefs and TUI code. Also removed + include for top.h. HP introduced this. I'm taking it out. + + * inftarg.c (child_detach_from_process): declare. + (child_attach_to_process): declare. + (child_stop): make static to match declaration. + + * inftarg.c (ptrace_him): change prototype back to return int. + + * inftarg.c (ptrace_me): Remove debug output, pass NULL to + fork_inferior if not HPUX. + + * inftarg.c: + (child_require_attach): new funct prototype and definition + (child_require_detach): new funct prototype and definition + (proc_wait): funct prototype and definition are enclosed by + proc_wait ifndef + (child_attach_to_process): new function, does most of the + work that child_attach used to do and some additional + work to determine whether gdb is already attached to the + target how to react. + (child_attach): altered. It's now a wrapper for + child_attach_to_process. + (child_require_attach): new function, called if should attach + even when gdb is already attached to target. + (child_detach_from_process): new function, does most of the + work that child_detach used to do and some additional work + to determine whether gdb is currently attached to the target. + (child_detach): altered. It's now a wrapper for + child_detach_from_process. + (child_require_detach): new function, called if should try to + detach even when gdb is not attached to target. + (ptrace_him): calls a new function, target_acknowledge_forked_child. + Currently, target_acknowledge_forked_child, is only defined to + do something for HPUX. + (child_create_inferior): changed call to fork_inferior. + (child_ops): added to_require_attach and to_require_detach fields + to the child_ops target ops vector. + + * inftarg.c: + Some hacks for ttrace work + (child_wait): Additional local variables, additional code in + while loop to check for : process exited, process forked, + process vforked, process execd + (child_thread_alive): John B. seems to think that the kill + call is inapproapriate for HPUX. + (child_attach_to_process): using strtol rather than atoi. + no longer check for case where there is no known exec file. + (child_post_attach): new function, a default, a no-op + (child_insert_fork_catchpoint): new function, a default, a no-op + (child_remove_fork_catchpoint): new function, a default, a no-op + (child_create_catch_fork_hook): deleted + (child_create_catch_vfork_hook): deleted + (child_insert_vfork_catchpoint): new function, a default, a no-op + (child_remove_vfork_catchpoint): new function, a default, a no-op + (child_can_follow_vfork_prior_to_exec ):new function, a default, + a no-op + (child_insert_exec_catchpoint): new function, a default, a no-op + (child_remove_exec_catchpoint): new function, a default, a no-op + (child_has_execd): new function, a default, returns 0 + (child_reported_exec_events_per_exec_call): new function, a + default, returns 1 + (child_has_exited): new function, a default. + (child_core_file_to_sym_file): new function, a default, returns NULL. + (child_ops): initialize new target_ops vector fields to the + child* functions. + * infptrace.c: + (call_ptrace): for HPUX, handle additional requests : PT_CONTIN1, + PT_STEP1. + (require_notification_of_events): add several signals to the + set of events requiring notification : PTRACE_SIGNAL, + PTRACE_EXEC, PTRACE_FORK, PTRACE_VFORK + (child_acknowledge_created_inferior): This function is only + defined if CHILD_ACKNOWLEDGE_CREATED_INFERIOR is defined. + (child_post_startup_inferior): function is only defined if + CHILD_POST_STARTUP_INFERIOR is defiend. Also, now call + require_notification_of_events. + (child_create_catch_fork_hook): deleted + (child_create_catch_vfork_hook): deleted + (child_insert_fork_catchpoint): new function + (child_remove_fork_catchpoint): new function + (child_insert_vfork_catchpoint): new function + (child_remove_vfork_catchpoint): new function + (child_has_forked): now enclosed by a CHILD_HAS_FORKED ifdef + (child_has_vforked): now enclosed by CHILD_HAS_VFORKED ifdef + (child_can_follow_vfork_prior_to_exec): new function + (child_insert_exec_catchpoint): new function + (attach): removed call to require_notification_of_events + (child_post_attach): new function, call to + require_notification_of_events moved here. + (child_pid_to_exec_file): new enclosed by CHILD_PID_TO_EXEC_FILE ifdef + introduced the concept of a saved_inferior_pid + (hppa_require_attach): Add some code to decide if gdb is already + attached to process. Can not figure this out via a ptrace call. + (hppa_insert_hw_watchpoint): new function + (hppa_remove_hw_watchpoint): new function + + * inftarg.c: + (child_attach_to_process): change position in file + (child_detach_from_process): change position in file + + * inftarg.c: + (child_attach_to_process): changed parameter to child_wait call + + * inftarg.c: + (child_post_wait): new function declaration and definition + (ptrace_him): + - change return value to a void. + - change target_acknowledge_forked_child call to + target_acknowledge_created_inferior + - call target_post_startup_inferior rather than returning pid. + (child_attach_to_process): change param name, fail_if_already_attached + -> after_fork. + Invert a couple of if-then-else statments. + Use REQUIRE_ATTACH macro + (child_attach): change params in child_attach_to_process call + (child_require_attach): change params in child_attach_to_process call + (child_detach_to_process): change param name, + fail_if_already_attached -> after_fork. + Invert a couple of if-then-else statments. + Use REQUIRE_DETACH macro + (child_detach): change params in child_detach_from_process call + (child_require_detach): change params in child_detach_from_process + call + (child_post_startup_inferior): new function + (child_acknowledge_created_inferior): new function + (child_clone_and_follow_inferior): new function + (child_post_follow_inferior_by_clone): new function + (child_create_catch_fork_hook): new function + (child_create_catch_vfork_hook): new function + (child_has_forked): new function + (child_has_vforked): new function + (child_post_follow_vfork): new function + (child_stop): no longer a static function + (child_pid_to_exec_file): new function + + * inftarg.c: + (child_wait): child_pid becomes related pid. return pid + rather than inferior_pid. Changes are in code handling fork + and vfork + + * inftarg.c: + Include gdb_stat.h and sys/unistd.h + (child_wait): new local variables. Check for live threads. + Check for syscall events + (child_thread_alive): no longer a static funct. + (ptrace_him): remove some code inserted in snap3 + (child_create_inferior): added a bunch of code to handle a + bad interaction between start-up-with-shell and the HP + catch-fork/catch-exec logic. I am ifdefing this for + HPUXHPPA for now. + (child_has_syscall_event): new default target_ops function + (child_enable_exception_callback): new default target_ops function + (child_get_current_exception_event): new default target_ops function + (child_ops): 3 new fields + + * inftarg.c: remove HPUX_SNAP1 and HPUX_SNAP2 ifdefs + + * inftarg.c: reverted previous change. + + * infttrace.c (hppa_remove_hw_watchpoint): fix check for write + access hardware watchpoint. + + * infttrace.c (proc_wait): Rename from proc_wait. + + * infttrace.c (require_notification_of_exec_events): new function; + just notify of exec events, not all events, and just the specified + pid, don't include it's children. + (child_acknowledge_created_inferior): call new function + require_notification_of_exec_events instead of + require_notification_of_events. + (child_post_startup_inferior): call require_notification_of_events + + * infttrace.c: changed all references to boolean to int. + Changed all references to TRUE and FALSE to 1 and 0. + + * irix5-nat.c: + (symbol_add_stub): add params to call to symbol_file_add. + + * jv-lang.c: + (get_dynamics_objfile): add 2 more parameters to call to + allocate_objfile. + + * m3-nat.c: + (m3_create_inferior): add param to fork_inferior call + (m3_pid_to_exec_file): new function + (m3_ops): initializing new target ops vector fields. see list below. + + * m3-nat.c: + (m3_ops): adding new target_ops vector fields and + removing a few. see list below + + * main.c: + (fputs_unfiltered): changes to prevent cursor form jumping around + in the TUI. Altered where tuiTermUnsetup and tuiTermSetup are + called + + * main.c (fputs_unfiltered): Changed function so that it + checks to see if output is to a string buffer or to a + FILE stream and does the correct action (i.e. strcat or + fputs). Fixed params for fputs call. + + * main.c (fputs_unfiltered): Don't try to call the TUI's + CommandCharCount functions when the TUI isn't enabled. + + * main.c (fputs_unfiltered): change FILE to GDB_FILE. + + * main.c (main): If the user asks for the TUI, then disable + GDB/Tk. + + * main.c (main): If the user gives the --version or --help flags, + disable the TUI. + + * main.c (tui_version, xdb_commands, dbx_commands): new variables. + (main): new command line arguments --tui, --xdb, --dbx; add call + to tyiCleanUp via tuiDo to main loop. + (fputs_unfiltered): tui related changes. + + * main.c: + Define 2 new global variables, gdb_stdout and gdb_stderr of type GDB_FILE. + (main): Allocate space for and initialize gdb_stdout and gdb_stdin. + + * objfiles.c (find_pc_sect_section): make end condition be less + than s->endaddr, not less than or equal to s->endaddr. + + * objfiles.c: + (allocate_objfile): 2 new parameters : user_loaded and is_solib. + When appropriate, record in the object file that it is user loaded. + The run command can use this information to purge object file + entries associated with the old inferior and keep user loaded + object files loaded via the add-symbol-file command. + (objfile_purge_solibs): new function. deletes all objectfile entries + that are not explicitly loaded by the user. + + * objfiles.c: + (objfile_relocate): check for LOC_INDIRECT + (find_pc_sect_section): change condition from + pc < s->endaddr to pc <= s->endaddr + + * objfiles.h: + New variables : user_loaded and is_solib + (OBJF_SHARED): new macro. used to distinguish objfile for + shared library from "vanilla" objfile. + (allocate_objfile): add new parameters to function decl. + (objfile_purge_solibs): new function decl. + + * objfiles.h: Add some typedefs : ImportEntry, ExportEntry. + Add some new variables : import_list, import_list_size, + export_list, export_list_size + + * osfsolib.c: + (symbol_add_stub): added params to call to symbol_file_add + + * pa/hpux1020.mh (NATDEPFILES): Add corelow.o, symbol table and + solib files. + + * pa/hpux1100.mh (NAT_FILE): Use nm-hppah11.h. + (NATDEPFILES): Add symbol table and solib files. + + * pa/nm-hppah11.h: New file, HPUX11-only definitions. + + * pa/tm-hppa.h (proc_wait): Remove decl and macro. + + * parse.c (write_dollar_variable): handle cases in which variables + besides the debugger ones start with $ and $$. + (parse_nested_classes_for_hpacc): new function. Parse a string that + is possibly a namespace / nested class specification. + (find_template_name_end): new function. + + * procfs.c: + (procfs_init_inferior): return value is now a void. + + * procfs.c: + (procfs_ops): initializing new target ops vector fields. see list below. + + * procfs.c: + (procfs_ops): adding new target_ops vector fields and + removing a few. see list below + + * procfs.c: added new fields to procfs_ops. + Necessary since we still have oldstyle initialization in + this file + + * pyr-tdep.c (pyr_do_registers_info): change stdout to gdb_stdout. + (frame_locals_address): change stderr to gdb_stderr. + (frame_args_addr): ditto. + + * pyr-xdep.c (fetch_inferior_registers): change stderr to + gdb_stderr. + + * remote-udi.c: + (init_udi_ops): adding new target_ops vector fields and + removing a few. see list below + + * remote-udi.c: + (init_udi_ops): initializing new target ops vector fields. see list below. + + * remote-udi.c: + (udi_load): fixed params in call to symbol_file_add + + * remote-vx.c: + (vx_add_symbols): fixed params in call to symbol_file_add + + * remote-vx.c: + (init_vx_ops): adding new target_ops vector fields and + removing a few. see list below + (init_vx_run_ops): ditto + + * remote-vx.c: + (init_vx_ops): initializing new target ops vector fields. see list below. + (init_vx_run_ops):initializing new target ops vector fields. see list below. + + * serial.c (serial_close): call gdb_fclose, not fclose on a + GDB_FILE. + + * serial.c (serial_logchar): change chtype to ch_type. sigh. + + * solib.c (look_for_base): the parameter to file must be + of type FILE *. So cast exec_bfd -> iostream in the call + to fileno as a FILE *, not a GDB_FILE *. This will work because + exec_bfd -> iostream is declared and given a value in bdf and + bfd will continue to use FILE rather than GDB_FILE. + + * solib.c: + (solib_add): remove references to exec_ops. + + * solib.c: + (solib_add): update exec_ops.to_sections + + * solib.c: + (symbol_add_stub): added params to call to symbol_file_add + + * solib.h: + (SOLIB_REMOVE_INFERIOR_HOOK): new macro. defined to 0. + functionality not implemented for this target. + + * solib.h: Added macro definitions. These macros generate + error messages for solaris?? + (SOLIB_CREATE_CATCH_LOAD_HOOK) + (SOLIB_CREATE_CATCH_UNLOAD_HOOK) + (SOLIB_HAVE_LOAD_EVENT) + (SOLIB_LOADED_LIBRARY_PATHNAME) + (SOLIB_HAVE_UNLOAD_EVENT) + (SOLIB_UNLOADED_LIBRARY_PATHNAME) + (SOLIB_IN_DYNAMIC_LINKER) + (SOLIB_RESTART) + + * somread.c (is_in_import_list): ditto. + + * somread.c (som_symfile_read): added some comments + + * somread.c (som_symfile_read): read in import and export lists. + (som_symtab_read): change test for dynamic executable. + (is_in_import_list): new function. Check if a given symbol name + is in the import list. + (init_import_symbols): new function. Read in and initialize the + som import list. + (init_export_symbols): new function. Read in and initialize the + som export list. + + * somread.c: + (som_symfile_read): fix missing comment delimiters + + * somsolib.c (DLD_FLAGS_MAPPRIVATE): new macro. + Define bit of __dld_flags in HP-UX a.out files. + (DLD_FLAGS_HOOKVALID): ditto. + (DLD_FLAGS_LISTVALID): ditto. + (DLD_FLAGS_BOR_ENABLE): ditto. + (som_solib_total_st_size): cumulative size in bytes of the + symbol tables of all shared objects on the so_list_head list. + (som_solib_st_size_threshhold_exceeded): threshold for adding symbols + for shlibs. + (som_solib_sizeof_symbol_table): new function. Computes size of + symbol table for a shlib. + (som_solib_load_symbols): new function. Load symbols from shlib. + (som_solib_add): detect if __dld_list is not valid. + Record main program's symbol table size. + Load symbols if called from command line. + Keep threshold into account when loading shlib symbols. + (som_solib_create_inferior_hook): use dld_flags macros. + (som_sharedlibrary_info_command): let user know if symbols were + not loaded. + (som_solib_restart): discard all the shlibs descriptors. + (_initialize_som_solib): chenge help message for auto-solib-add + command. + Set threshold for symbol table to 50 megabytes. + + * somsolib.c (_initialize_som_solib): added call to som_solib_restart. + (som_solib_restart): new function + (som_solib_in_dynamic_linker): new function + (som_solib_desire_dynamic_linker_symbols): new function + (som_solib_unloaded_library_pathname): new function + (som_solib_loaded_library_pathname): new function + (som_solib_library_pathname): new function + (som_solib_have_unload_event): new function + (som_solib_have_load_event): new function + (som_solib_create_catch_unload_hook): new function + (som_solib_create_catch_load_hook): new function + (som_solib_create_inferior_hook): rewritten + dld_cache: new struct + addr_and_unwind_t: new struct + (find_unwind_entry) added prototype + + * somsolib.c (som_solib_create_inferior_hook): introduce new local + msymbol2 and change some msymbol's to msymbol2's -- was clobbering + msymbol, passing a NULL to lookup_minimal_symbol_solib_trampoline, + and ultimately core dumping with a SEGV. + + * somsolib.c: + Include assert.h + (som_solib_mapped_entry): additional comments for text_addr, + text_link_addr, text_end, and tsd_start_addr fields. Commenting + out 2 tsd fields, __data_start and __data_end. + (som_solib_add_solib_objfile): add params to calls to symbol_file_add. + Add some code for distinguishing between a shared library and other + objfiles. This appears to be a prelude to thread local storage. + (som_solib_load_symbols): changes to printf statement + enclosed by SOLIB_DEBUG ifdef. + (som_solib_add): change comment to correctly specify path + to end.o -- /opt/langtools/lib/end.o. changes to printf statement + enclosed by SOLIB_DEBUG ifdef. + Removed several SOLIB_DEBUG ifdefs and the associated printfs. + Add code to find the start address for the object file's thread + local storage + (som_solib_create_inferior_hook): Fix warning messages use correct + path to end.o -- /opt/langtools/lib/end.o. Change control flow. + No longer user early returns from function is cases of error. + (reset_inferior_pid): new function + (som_solib_remove_inferior_hook): new function + (so_lib_thread_start_addr): new function. used for tsd. + + * somsolib.c: Removed references to ASSERT macro. + + * somsolib.c: add debugging macro. + (struct som_solib_mapped_entry): add new field tsd_start_addr. + (struct so_list): added new field solib_addr. + (som_solib_add_solib_objfile): new function. + (som_solib_load_symbols): rewritten. + (som_solib_add): make sure we don't load the symbols in if the + threshold was exceeded. + (som_solib_get_solib_by_pc): new function. Return the address of + handle of the shared library. + (som_solib_restart): disable breakpoints at restart. + (_initialize_som_solib): set threshold to 100 megabytes. + + * somsolib.c: add include of fcntl.h so that O_RDONLY is defined. + + * somsolib.h (DISABLE_UNSETTABLE_BREAK): new macro. + (PC_SOLIB): new macro. + + * somsolib.h: + (SOLIB_CREATE_CATCH_LOAD_HOOK): define + (SOLIB_CREATE_CATCH_UNLOAD_HOOK): define + (SOLIB_HAVE_LOAD_EVENT): define + (SOLIB_LOADED_LIBRARY_PATHNAME): define + (SOLIB_HAVE_UNLOAD_EVENT): define + (SOLIB_UNLOADED_LIBRARY_PATHNAME): define + (SOLIB_IN_DYNAMIC_LINKER): define + (SOLIB_RESTART): define + + * somsolib.h: + (SOLIB_REMOVE_INFERIOR_HOOK): new macro. defined to use + som_solib_remove_inferior_hook. + + * somsolib.h: + (som_solib_create_catch_load_hook) + (som_solib_create_catch_unload_hook) + (som_solib_have_load_event) + (som_solib_loaded_library_pathname) + (som_solib_have_unload_event) + (som_solib_unloaded_library_pathname) + (som_solib_in_dynamic_linker) + Fix prototypes to use type names, not parameter names. + + * source.c (find_source_lines): make non static. + (open_source_file): ditto. + (source_full_path_of): new function. + (print_source_lines): rename to print_source_lines_base and make + static; formatting. + (print_source_lines): new function. + (forward_search_command): tui changes. + (reverse_search_command): tui changes. + (_initialize_source): add xdb and dbx compatibility commands. + + * source.c (list_command): handle case of odd number of source + lines to display. + + * source.c: + (source_full_path_of): new function. file was overlooked + in merge ;-/. + + * stack.c (func_command): make high bound be <, not <=. + + * stack.c (_initialize_stack): for the backtrace command, delete + the help line about usage, since this has to be a valid help + message for the 'where' command too. + + * stack.c (current_frame_command): add a check for the + existance of a stack. If there is no stack produce an + error message and exit. + + * stack.c (down_silently_base, up_silently_base, + args_plus_locals_info, print_frame_info_base, + print_stack_frame_base, print_stack_frame_base_stub): declare. + (print_frame_local_vars): add'l parameter. + (print_stack_frame_stub): new version created, old version renamed + to show_and_print_stack_frame_base_stub. + (print_stack_frame_base_stub, print_only_stack_frame_stub, + show_and_print_stack_frame, print_only_stack_frame, + stack_publish_stopped_with_no_frame, print_frame_info, + show_stack_frame, backtrace_full_command, args_plus_locals_info, + select_and_print_frame, select_and_maybe_print_frame, + current_frame_command, func_command): new functions. + (backtrace_command): new function, old renamed to + backtrace_command_1. + (print_block_frame_locals, print_frame_local_vars): additional + parameter, number of tabs. + (up_silently_command): new function, old renamed to + up_silently_command_base. + (down_silently_command): new function, old renamed to + down_silently_base. + (_initialize_stack): register new commands based on values of + xdb_commands and dbx_commands variables. + + * stack.c (func_command): make high bound be <, not <=. + + * stack.c (parse_frame_specification): fix prototype to match + function definition. + (show_and_print_stack_frame_stub): fix name. + (select_and_print_frame): change uncaught tuiDO call. + + * stack.c (up_silent_base): rename from up_silently_command_base. + + * symfile.c (symbol_file_command): only call SOLIB_RESTART if it's + defined. + + * symfile.c (add_psymbol_with_dem_name_to_list): new function. + Adds a symbol with a long value to a psymtab. Differs from + add_psymbol_to_list in taking both a mangled and a demangled name. + + * symfile.c (compare_psymbols): call strcmp directly, instead of + using macro. + + * symfile.c (symbol_file_add): reindent portions. + (symbol_file_command): add call to tuiDo. + + * symfile.c (symbol_file_command): only call SOLIB_RESTART if it's + defined. + + * symfile.c (symfile_bfd_open): add code to call PXDB on hpux, if + the file has not already been processed by pxdb. + Added define USE_PXDB. + + * symfile.c (symfile_bfd_open): change parenthesis positioning + around call to hpread_pxdb_check. + + * symfile.c (symfile_bfd_open): make not static. + (RESET_HP_UX_GLOBALS): new macro. Resets globals when new symbol + file loaded. + (USE_PXDB): not needed. Removed. + (symbol_file_add): add HP specific code to deal with pxdb. + (symbol_file_command): reset HP specific globals if new symbol file + loaded. + (symfile_bfd_open): comment out checking for pxdb. + (reread_symbols): reset HP specific globals. + + * symfile.c (symfile_bfd_open): uncomment hpus specific code. + + * symfile.c: + (symbol_file_add): add user_loaded and is_solib parameters. + fixed number of parameters in call to allocate_objfile + (symbol_file_command): added call to SOLIB_RESTART macro. + fixed number of parameters in calls to symbol_file_add. + (add_symbol_file_command): fixed number of parameters in calls to + symbol_file_add. + + * symfile.c: added prototype for hpread_pxdb_check. + + * symfile.c: changed HPUX_SNAP1 ifdef to HPUXHPPA. enclosed calls to + RESET_HP_UX_GLOBALS with an HPUXHPPA ifdef + + * symfile.h (symfile_bfd_open): add protptype. + + * symfile.h: add prototype for add_psymbol_with_dem_name_to_list. + + * symfile.h: clarify purpose of auto_solib_add. + + * symmisc.c (maintenance_print_symbols): call gdb_fclose, not + fclose on a GDB_FILE* during cleanup. + (maintenance_print_psymbols): call gdb_fclose, not fclose on a + GDB_FILE* during cleanup. + (maintenance_print_msymbols): call gdb_fclose, not fclose on a + GDB_FILE* during cleanup. + + * symmisc.c (maintenance_print_symbols): gdb_fclose now takes a + GDB_FILE ** parameter. Fix the local GDB_FILE variables and the + call to make_cleanup. + (maintenance_print_psymbols): ditto + (maintenance_print_msymbols): ditto + + * symmisc.c (print_objfile_statistics): close quotes in + output strings. + + * symmisc.c: + (print_symbol): Add LOC_INDIRECT to switch statement + (print_partial_symbols): Add LOC_INDIRECT to switch statement + + * symtab.c (find_pc_sect_psymtab): high bounds should be <, not <=. + (find_pc_sect_symtab): ditto. + + * symtab.c (hp_som_som_object_present): new flag to indicate HP + compiled code. + (find_pc_sect_psymtab): change tests to make sure we are checking + the texthigh adress as well. + (lookup_transparent_type): new function. Look up a type name + in the struct_namespace. The type returned must not be opaque. + (find_pc_sect_symtab): make sure we check the address 'pc' itself, + too. + (find_addr_symbol): prepare to handle LOC_INDIRECT address class, but + leave it commented out. + (find_pc_sect_line): return correct information if pc is in import + or export stub (trampoline). + (decode_line_1): skip two chars, if they are '$$'. Like for HP's + $$dyncall. Handle cases in which varaible and function names can start + with $. + (overload_list_add_symbol): if cannot demangle name, use it as is. + Free string after use. + (make_symbol_overload_list): initialize oload_name to NULL and + oload_name_len to 0. If demangle not successful, use name as it is. + Free string after use. + + * symtab.c (lookup_symbol): Changed call to find_pc_sect_symtab, + to the original find_pc_symtab, in HP added fragment. + + * symtab.c (lookup_symbol): change HPUX_SNAP1 ifdef to a HPUXHPPA ifdef + + * symtab.c (lookup_symbol): ifdef the searching of symbol in the + minimal symbol tables, for hpux we move this check at the end + of the function. + Before we error out if symbol is not found in the symtab, look + in the statics. + Before erroring out if static symbol not found look in the globals. + + * symtab.c (lookup_symbol): return symbol as soon as found. + (decode_line_1): check whether we have a conditional break. Temporarily + remove it from the line, to not confure perenthesis checking. + Handle namespaces. + (overload_list_add_symbol): new function. Overload + resolution support. + (make_symbol_overload_list): ditto. + + * symtab.c: + (find_template_name_end): new prototype decl. + (lookup_symbol): when a global or static symbol shows up in the + psymtab table, but not the symtab table, tell the user that + the symbol may be an inlined function or a template function and + provide some guidance to the user about how to more fully + specify the symbol. + (lookup_transparent_type): when a global or static symbol shows up + in the psymtab table, but not the symtab table, tell the user that + the symbol may be an inlined function or a template function and + provide some guidance to the user about how to more fully + specify the symbol. + (decode_line_1): handle template function specification when decoding a + line. May need to be ifdefed for HP's aCC? + (_initialize_symtab): handle dbx commands. + + * symtab.h (address_class): add new address calss for + LOC_THREAD_LOCAL_STATIC and LOC_INDIRECT. + (lookup_transparent_type): add prototype. + (exception_event_kind): new enum for exception catchpoints. + (exception_event_record): new structure for exception catchpoints. + (CURRENT_EXCEPTION_KIND): new macro. + (CURRENT_EXCEPTION_CATCH_SAL): new macro. + (CURRENT_EXCEPTION_CATCH_LINE): new macro. + (CURRENT_EXCEPTION_CATCH_FILE): new macro. + (CURRENT_EXCEPTION_CATCH_PC): new macro. + (CURRENT_EXCEPTION_THROW_SAL): new macro. + (CURRENT_EXCEPTION_THROW_LINE): new macro. + (CURRENT_EXCEPTION_THROW_FILE) new macro.: + (CURRENT_EXCEPTION_THROW_PC): new macro. + + * symtab.h(make_symbol_overload_list): add prototype. + + * symtab.h: + (symbol_file_add): add new params to function decl. + + * target.c (cleanup_target): changed casting of default functions for + to_has_forked, to_has_vforked, to_pid_to_exec_file to get rid of + warnings. + + * target.c (cleanup_target): changed the default functions for + to_pid_to_exec_file and to_core_file_to_sym_file + + * target.c (cleanup_target): fixed PARAMS for to_has_syscall_event + + * target.c (cleanup_target): syntax error, mismatched paranthesis. + + * target.c (debug_to_open): change stderr to gdb_stderr. + (debug_to_close): ditto. + (debug_to_attach): ditto. + (debug_to_post_attach): ditto. + (debug_to_require_attach): ditto. + (debug_to_detach): ditto. + (debug_to_require_detach): ditto. + (debug_to_resume): ditto. + (debug_to_wait): ditto. + (debug_to_post_wait): ditto. + (debug_to_fetch_registers): ditto. + (debug_to_store_registers): ditto. + (debug_to_prepare_to_store): ditto. + (debug_to_xfer_memory): ditto. + (debug_to_files_info): ditto. + (debug_to_insert_breakpoint): ditto. + (debug_to_remove_breakpoint): ditto. + (debug_to_terminal_init): ditto. + (debug_to_terminal_inferior): ditto. + (debug_to_terminal_ours_for_output): ditto. + (debug_to_terminal_ours): ditto. + (debug_to_terminal_info): ditto. + (debug_to_kill): ditto. + (debug_to_load): ditto. + (debug_to_lookup_symbol): ditto. + (debug_to_create_inferior): ditto. + (debug_to_post_startup_inferior): ditto. + (debug_to_acknowledge_created_inferior): ditto. + (debug_to_clone_and_follow_inferior): ditto. + (debug_to_post_follow_inferior_by_clone): ditto. + (debug_to_insert_fork_catchpoint): ditto. + (debug_to_remove_fork_catchpoint): ditto. + (debug_to_insert_vfork_catchpoint): ditto. + (debug_to_remove_vfork_catchpoint): ditto. + (debug_to_has_forked): ditto. + (debug_to_has_vforked): ditto. + (debug_to_can_follow_vfork_prior_to_exec): ditto. + (debug_to_post_follow_vfork): ditto. + (debug_to_insert_exec_catchpoint): ditto. + (debug_to_remove_exec_catchpoint): ditto. + (debug_to_has_execd): ditto. + (debug_to_reported_exec_events_per_exec_call): ditto. + (debug_to_has_syscall_event): ditto. + (debug_to_has_exited): ditto. + (debug_to_mourn_inferior): ditto. + (debug_to_can_run): ditto. + (debug_to_notice_signals): ditto. + (debug_to_thread_alive): ditto. + (debug_to_stop): ditto. + (debug_to_enable_exception_callback): ditto. + (debug_to_get_current_exception_event): ditto. + (debug_to_pid_to_exec_file): ditto. + (debug_to_core_file_to_sym_file): ditto. + + * target.c: + (default_clone_and_follow_inferior): new funct prototype declaration + and function definition + (dummy_target) : More target_ops vector changes for HPUX + new fields. ifdefed for HPUX_SNAP2. New fields are + to_post_wait, to_post_startup_inferior + to_acknowledge_created_inferior, to_clone_and_follow_inferior, + to_post_follow_inferior_by_clone, to_create_catch_fork_hook, + to_create_catch_vfork_hook, to_has_forked, to_has_vforked, + to_post_follow_vfork, to_pid_to_exec_file + (de_fault): add new HPUX specific target_ops operations to + the de_fault macro + (INHERIT): add new HPUX specific target_ops operations to the + INHERIT macro + (find_default_clone_and_follow_inferior): new funct definition + (debug_to_post_wait): new funct + (debug_to_post_startup_inferior): new funct + (debug_to_acknowledge_created_inferior): new funct + (debug_to_clone_and_follow_inferior): new funct + (debug_to_post_follow_inferior_by_clone): new funct + (debug_to_create_catch_fork_hook): new funct + (debug_to_create_catch_vfork_hook): new funct + (debug_to_has_forked): new funct + (debug_to_has_vforked): new funct + (debug_to_post_follow_vfork): new funct + (setup_target_debug): initialize new target_ops vector fields. + + * target.c: + (cleanup_target): fixed the return type on a few of the + default function values. + + * target.c: + (dummy_target): Add 3 new fields + (nosupport_runtime): new function, used in cleanup_target + (cleanup_target): changes in the de_fault macro, both to + accomodate the new target_ops vector fields and to use + more accurate default functions. + (update_current_target): Add new target_ops vector fields to the + INHERIT macro + (generic_mourn_inferior): the call to breakpoint_init_inferior now takes a + parameter + (normal_pid_to_str): Adding a \0 to the end of buf. + (debug_to_has_syscall_event): new func + (debug_to_enable_exception_callback): new func + (debug_to_get_current_exception_event): new func + (setup_target_debug): initialize the 3 new target_ops vector fields + + * target.c: + (struct signals): fix message associated with SIGRETRACT. + + * target.c: + (dummy_target): fix syntax error + (cleanup_target): changed the default values for the new + target_ops vector fields. HP folks inappropriately set + most of them to noprocess(). They should be a mixture + of ignore() and return_zero(). + + * target.c: + (dummy_target): Add new target_ops vector fields and their initializations + (cleanup_target): Added new new target_ops vector fields to the de_fault + macro definition. + (update_current_target): Added new new target_ops vector fields to the INHERIT + macro definition + (return_one): new function, used by the de_fault macro + (debug_to_post_attach): new function + (debug_to_wait): added new cases : TARGET_WAITKIND_FORKED, TARGET_WAITKIND_VFORKED, + TARGET_WAITKIND_EXECD + (debug_to_insert_fork_catchpoint): new function + (debug_to_remove_fork_catchpoint): new function + (debug_to_insert_vfork_catchpoint): new function + (debug_to_remove_vfork_catchpoint): new function + (debug_to_can_follow_vfork_prior_to_exec): new function + (debug_to_insert_exec_catchpoint): new function + (debug_to_remove_exec_catchpoint): new function + (debug_to_core_file_to_sym_file): new function + (setup_target_debug): give new fields in current_target target_ops vector values. + + * target.c: HP merge, 4/15/98 snapshot + There are new target_ops fields that pertain only + to HPUX. All the changes relate to this. Fist, + new fields are added to the dummy_target target_ops + vector : to_require_attach, to_require_detach. + + * target.c: remove HPUX_SNAP1 and HPUX_SNAP2 ifdefs + + * thread.c (info_threads_command): call print_only_stack_frame + instead of print_stack_frame. + (_initialize_thread): make t an alias for thread only if + xdb_commands is not set. + + * thread.c (thread_command): if no arguments, don't generate an + error, instead tell the user which thread is current. + (info_threads_commands): don't lose the users position within the + current thread -- remember it and then restore it. + + * thread.c: + (struct thread_info): add stepping_through_sigtramp field + (add_thread): initialize stepping_through_sigtramp field + (load_infrun_state): add stepping_through_sigtramp param and + make sure it gets assigned a value. + (save_infrun_state): add stepping_through_sigtramp param and + make sure that the value gets saved. + (info_threads_command): ifdefing some local variables and + code for HPUXHPPA. HP folks want print the tid rather than pid? + Also, looks like the HP folks solved the same thread switching + problem that 4.17 solves. Taking 4.17. + (restore_current_thread): print out the current frame after + switching threads. + (thread_apply_all_command): ifdefing a print statement for + HPUXHPPA. The HP folks want to print out a tid rather than pid? + (thread_apply_command): ifdefing a print statement for + HPUXHPPA. The HP folks want to print out a tid rather than pid? + (thread_command): decided not to take HP change. + + * thread.c: Fixing gdb core dump problem causing many testsuite + failures. + (add_thread): remove call to bpstat_clear, initialize + tp->stepping_through_solib_catchpoints = NULL; + + * thread.c: changes for catchpoints, shared libaries, + (thread_info) : additional fields in the thread_info struct + for stepping_through_solib_after_catch and + stepping_through_solib_catchpoints. + (add_thread): initialize the new thread_info fields. + (load_infrun_state) : additional parameters for handling + catchpoints and shared libraries. + (save_infrun_state): additional parameters for handling + catchpoints and shared libraries. + + * top.c (command_loop): initialize space_at_cmd_start to 0. + + * top.c (set_prompt): new function. + + * top.c (togglelist, stoplist): new command lists. + (command_loop): tui changes -- paranoia to make sure + insert mode is off when not editing. + (quit_force): clean up tui on exit. + (init_main): make definition of info status command dependent upon + dbx mode not being set. + + * top.c: + (fputs_unfiltered_hook): changed stream parameter from FILE + to GDB_FILE + (flush_hook): changed stream parameter from FILE to GDB_FILE + + * top.h: declare it. + + * typeprint.c (whatis_exp): decide real runtime type. For the vtable + case. + + + * utils.c: + (query): changes to prevent cursor from jumping around in the + TUI. Call tuiBufferGetc explicitly, rather than passing it + into tuiDo. The tuiDo function does some additional work + that is inappropriate when handling queries. + + * utils.c + (GDB_FILE_ISATTY): new macro that takes a GDB_FILE param and + determines whether or not it's using a tty. + (gdb_file_isatty); called by the GDB_FILE_ISATTY macro. Does + the actual work + (init_page_info): Call GDB_FILE_ISATTY rather than ISATTY + (print_spaces): fix parameter to fputc. fix call to + gdb_file_adjust_strbuf. + (gdb_file_init_astring): fix parameter to xmalloc + (gdb_file_deallocate): new function to deallocate + a GDB_FILE object and possibly a string buffer + + * utils.c (gdb_file_init_astring): initialize buffer as the empty + string. + Indent GNU style. + + + * utils.c (gdb_fopen): gdb_fopen is called if the GDB_FILE object is + actually afile rather than astring. The routine now allocates space + for a GDB_FILE object and initializes its fields in addition to + performing an fopen. + (gdb_flush): fix the parameter passed into fflush. It's now stream->ts_filestream. + (gdb_fclose): Pass in an object of type GDB_FILE **. Fix parameter to fclose. It's + now tmpstream->ts_filestream. Make sure to free the GDB_FILE object and set the + GDB_FILE * object to NULL. + (gdb_adjust_strbuf): new function. Determine if the current ts_strbuf field + contains sufficient space to concatenate a string of length n on the end. + If not, then reallocate the ts_strbuf. + (print_spaces): Check to see if the GDB_FILE is afile or astring. If it is + astring, then adjust the size of the ts_strbuf field and concatenate the + correct number of spaces onto the end of the buffer. Otherwise continue to + use fputc. + (gdb_file_get_strbuf): new function. return a ptr to the ts_strbuf field in a + GDB_FILE object + (gdb_file_init_astring): new function to allocate space for and initialize + a GDB_FILE object when it is an astring. + + * utils.c (set_width): declare it. + (pagination_enabled): define it. + (query): tui changes. + (init_page_info, set_width): new functions. + (set_width_command): call set_width. + (_initialize_utils): replace termcap stuff with call to + init_page_info; if xdb_commands set, define am and sm commands; + define pagination as a set/show command. + + * utils.c (vfprintf_maybe_filtered): change FILE to GDB_FILE. + (fputs_maybe_filtered): ditto. + (print_spaces): ditto. + (gdb_printchar): ditto. + (gdb_flush): ditto. + (fputs_filtered): ditto. + (vfprintf_filtered): ditto. + (vfprintf_unfiltered): ditto. + (fprintf_filtered): ditto. + (fprintf_unfiltered): ditto. + (fprintfi_filtered): ditto. + (print_spaces_filtered): ditto. + (fprintf_symbol_filtered): ditto. + (gdb_fclose): new function. + + * valops.c (call_function_by_hand): assign to param_type only + if function has parameters. + + * valops.c (call_function_by_hand): ifdef the + HP_COMPILED_TARGET stuff. + (value_arg_coerce): ditto. + + * valops.c (call_function_by_hand): make sure param_type is + initialized to NULL. + + * valops.c (find_rt_vbase_offset): add parameter to value_at. + (value_rtti_type): ditto. + (value_full_object): ditto. + + * valops.c (search_struct_field_aux): fixed mismatching parenths + + + * valops.c (search_struct_field_aux): make sure TYPE_TAG_NAME + is not null before copying it. + + + * valops.c (search_struct_field_aux): set found_class_name to null + if class has no name (anon unions case). Adjust base_addr + computation. + + * valops.c (value_arg_coerce): change final arg to int. + + * valops.c (value_arg_coerce): remove the conditional on HP + compiled target, for doing coercion of float to double. Removed + third parameter, using_gcc. + (call_function_by_hand): do not use HP_COMPILED_TARGET, just + use the gcc_compiled variable. + + * valops.c (value_cast): take case of the enclosing_type and + pointer_to_offset fields. + (value_at): use VALUE_CONTENTS_ALL_RAW + (value_fetch_lazy): ditto + (value_assign): handle enclosing_type, embedded_offset and + pointed_to_offset fields. + (value_repeat): use VALUE_CONTENTS_ALL_RAW and VALUE_ENCLOSING_TYPE. + (value_ind): set enclosing_type and embedded_offset correctly, + for a pointer value being dereferenced. Target memory bytes + corresponding to the size of the enclosing type are retreived. + (value_addr): handle enclosing_type and pointed_to_offset. + (value_push): use VALUE_CONTENTS_ALL and VALUE_ENCLOSING_TYPE. + (value_arg_coerce): coerce floats to doubles only if gcc was not + used to compile the target. + (call_function_by_hand): handle pointers to functions as paramters. + (value_array): use VALUE_CONTENTS_ALL and VALUE_ENCLOSING_TYPE. + (search_struct_method): produce more informative error message. + (find_rt_vbase_offset): deal with negative offsets. + (value_find_oload_method_list): new function. Return the list of + overloaded methods of a specified name. + (find_method_list): new function. Search through the methods of an + object (and its bases) to find a specified method. + (value_full_object): new function. Given a value, check its real + run-time type. + (value_rtti_target_type): new function. Given a pointer value V, find + the real (RTTI) type of the object it points to. + (value_rtti_type): new function. Find the real run-time type of a + value using RTTI. + + * valops.c: include gdbcmd.h + Set global overload_resolution to 0. + (find_function_in_inferior): modify error message. + (value_allocate_space_in_inferior): modify error message. + (value_cast): deal with HP/aCC peculiarities. + (value_of_variable): use SYMBOL_SOURCE_NAME instead of SYMBOL_NAME. + (value_addr): modify address value by adding the embedded offset. + (value_ind): modify the address of the object by the pointed_to_offset. + (call_function_by_hand): do not do any extra alignment if not needed. + Fetch the return value from the stack rather then from the register, + for the hppa architecture. + (search_struct_field): rewritten. Now this function uses + search_struct_field_aux to do all the work. + (search_struct_field_aux): new function. This is the old + search_struct_field rewritten. + (find_rt_vbase_offset): give error if virtual table pointer is not good. + (find_overload_match): new function. Find the best function that + matches on the argument types according to the overload resolution + rules. + (_initialize_valops): add new set/show command for overload-resolution. + + * value.h (VALUE_POINTED_TO_OFFSET): new macro. + Add field pointed_to_offset to value structure. + Add prototypes for new functions in valops.c. + + * value.h (write_register_pid): change prototype to match + function. + + * value.h: HP merge, 4/15/98 snapshot + Added parameter to val_print func decl. + Added new macro, VALUE_EMBEDDED_OFFSET, and + new func decl, find_rt_vbase_offset, for C++ + support. + + * values.c (allocate_value): allocate also for value_embedded_offset + and value_enclosing_type. + (value_copy): copy value_embedded_offset and value_enclosing_type too. + Use all_raw in copying the value itself. + (value_primitive_field): add handling of base subobjects. + + * values.c (value_copy): copy the pointed_to_offset as well. + (allocate_value): allocate the pointed_to_offset as well. + (value_virtual_fn_field): rewrite. + + * values.c (value_primitive_field): adjust embedded offset and + offset calculation. + + * values.c (value_static_field): take into consideration that static + data members can be minimal symbols too. + + * values.c (value_virtual_fn_field): fix call to value_at. + + * win32-nat.c (child_ops): Remove unneeded settings. + + * win32-nat.c: + (handle_load_dll): added params to call to symbol_file_add. + + * win32-nat.c: + (init_child_ops): adding new target_ops vector fields and + removing a few. see list below + + * win32-nat.c: + (init_child_ops): initializing new target ops vector fields. see list below. + + Other changes have to do with XDB compatability. Leave oout + for now. + + defs.h (vfprintf_filtered): change FILE to GDB_FILE in decl. + (fprintf_filtered): ditto. + (fprintfi_filtered): ditto. + (vfprintf_unfiltered): ditto. + (fprintf_unfiltered): ditto. + + infcmd.c (_initialize_infcmd): if xdb_commands is set, make S an + alias for next and define R, lr, g. Define go. + + pyr-tdep.c (pyr_print_insn): change FILE to GDB_FILE. + + + * breakpoint.c (create_temp_exception_breakpoint): #if it out -- + nothing calls it. + (bpstat_stop_status): don't call SOLIB_HAVE_LOAD_EVENT if it's not + defined; don't call SOLIB_HAVE_UNLOAD_EVENT if it's not defined. + (bpstat_get_triggered_catchpoints): if we don't have shared + library support, then don't call SOLIB_LOADED_LIBRARY_PATHNAME nor + SOLIB_UNLOADED_LIBRARY_PATHNAME. + (watch_command_1): don't require a run before a watch command + unless we're on HP [it's an HP OS bug, not a generic limitation] + (catch_load_command_1): don't define if no shared libraries. + (catch_command_1): don't claim to support fork catchpoints unless + CHILD_INSERT_FORK_CATCHPOINT is defined, don't claim to support + vfork catchpoints unless CHILD_INSERT_VFORK_CATCHPOINT is defined, + don't clain to support shared library load catchpoints if shared + libraries aren't supported, and don't claim to support exec + catchpoints unless CHILD_INSERT_EXEC_CATCHPOINT is defined + + There are new target_ops vector fields that pertain + only to HPUX. Added the to_require_attach and + to_require_detach fields to exec_ops. These new + fields are ifdef'ed for HPUX_SNAP1. + + * breakpoint.h: + Fix compile error in enum bptype. + + * coff-solib.h: + Fixed a number of macro definitions. SOLIB_LOADED_LIBRARY_PATHNAME, + SOLIB_HAVE_LOAD_EVENT, SOLIB_HAVE_UNLOAD_EVENT, + SOLIB_UNLOADED_LIBRARY_PATHNAME, SOLIB_IN_DYNAMIC_LINKER. These + macros are only meaningful (for now) for SOM. So, all + the macros were defined as error(...), but were used in + conditions. This caused the compile to crap out. I redefined + these (for now) to be 0. + + * procfs.c: + (procfs_create_inferior): fix call to fork_inferior -- need another + parameter. + + * solib.h: + Fixed a number of macro definitions. SOLIB_LOADED_LIBRARY_PATHNAME, + SOLIB_HAVE_LOAD_EVENT, SOLIB_HAVE_UNLOAD_EVENT, + SOLIB_UNLOADED_LIBRARY_PATHNAME, SOLIB_IN_DYNAMIC_LINKER. These + macros are only meaningful (for now) for SOM. So, all + the macros were defined as error(...), but were used in + conditions. This caused the compile to crap out. I redefined + these (for now) to be 0. + + * valops.c: + (search_struct_field): undeclared local variable, "assigned". + (find_rt_vbase_offset): fixed call to value_at + + * value.h: + Fix signature for find_rt_vbase_offset funct decl (missing a param) + Wed Dec 30 17:48:12 1998 Stan Shebs From J.T. Conklin : diff --git a/gdb/acconfig.h b/gdb/acconfig.h index 565e6929164..10f8cb02248 100644 --- a/gdb/acconfig.h +++ b/gdb/acconfig.h @@ -64,6 +64,9 @@ /* Define if your locale.h file contains LC_MESSAGES. */ #undef HAVE_LC_MESSAGES +/* Define if you want to use the full-screen terminal user interface. */ +#undef TUI + /* Define if on solaris uses int instead of size_t, and assorted other type changes. */ #undef PROC_SERVICE_IS_OLD diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index f6d860cc4e0..0613bf8acdf 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -41,71 +41,124 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* Prototypes for local functions. */ -static void catch_command_1 PARAMS ((char *, int, int)); +static void +catch_command_1 PARAMS ((char *, int, int)); -static void enable_delete_command PARAMS ((char *, int)); +static void +enable_delete_command PARAMS ((char *, int)); -static void enable_delete_breakpoint PARAMS ((struct breakpoint *)); +static void +enable_delete_breakpoint PARAMS ((struct breakpoint *)); -static void enable_once_command PARAMS ((char *, int)); +static void +enable_once_command PARAMS ((char *, int)); -static void enable_once_breakpoint PARAMS ((struct breakpoint *)); +static void +enable_once_breakpoint PARAMS ((struct breakpoint *)); -static void disable_command PARAMS ((char *, int)); +static void +disable_command PARAMS ((char *, int)); -static void enable_command PARAMS ((char *, int)); +static void +enable_command PARAMS ((char *, int)); -static void map_breakpoint_numbers PARAMS ((char *, - void (*)(struct breakpoint *))); +static void +map_breakpoint_numbers PARAMS ((char *, void (*)(struct breakpoint *))); -static void ignore_command PARAMS ((char *, int)); +static void +ignore_command PARAMS ((char *, int)); -static int breakpoint_re_set_one PARAMS ((char *)); +static int +breakpoint_re_set_one PARAMS ((char *)); -static void clear_command PARAMS ((char *, int)); +static void +clear_command PARAMS ((char *, int)); -static void catch_command PARAMS ((char *, int)); +static void +catch_command PARAMS ((char *, int)); -static struct symtabs_and_lines get_catch_sals PARAMS ((int)); +static void +handle_gnu_4_16_catch_command PARAMS ((char *, int, int)); -static void watch_command PARAMS ((char *, int)); +static struct symtabs_and_lines +get_catch_sals PARAMS ((int)); -static int can_use_hardware_watchpoint PARAMS ((struct value *)); +static void +watch_command PARAMS ((char *, int)); -static void tbreak_command PARAMS ((char *, int)); +static int +can_use_hardware_watchpoint PARAMS ((struct value *)); -static void break_command_1 PARAMS ((char *, int, int)); +void +tbreak_command PARAMS ((char *, int)); -static void mention PARAMS ((struct breakpoint *)); +static void +break_command_1 PARAMS ((char *, int, int)); -struct breakpoint *set_raw_breakpoint PARAMS ((struct symtab_and_line)); +static void +mention PARAMS ((struct breakpoint *)); -static void check_duplicates PARAMS ((CORE_ADDR, asection *)); +struct breakpoint * +set_raw_breakpoint PARAMS ((struct symtab_and_line)); -static void describe_other_breakpoints PARAMS ((CORE_ADDR, asection *)); +static void +check_duplicates PARAMS ((CORE_ADDR, asection *)); -static void breakpoints_info PARAMS ((char *, int)); +static void +describe_other_breakpoints PARAMS ((CORE_ADDR, asection *)); -static void breakpoint_1 PARAMS ((int, int)); +static void +breakpoints_info PARAMS ((char *, int)); -static bpstat bpstat_alloc PARAMS ((struct breakpoint *, bpstat)); +static void +breakpoint_1 PARAMS ((int, int)); -static int breakpoint_cond_eval PARAMS ((char *)); +static bpstat +bpstat_alloc PARAMS ((struct breakpoint *, bpstat)); -static void cleanup_executing_breakpoints PARAMS ((PTR)); +static int +breakpoint_cond_eval PARAMS ((char *)); -static void commands_command PARAMS ((char *, int)); +static void +cleanup_executing_breakpoints PARAMS ((PTR)); -static void condition_command PARAMS ((char *, int)); +static void +commands_command PARAMS ((char *, int)); -static int get_number PARAMS ((char **)); +static void +condition_command PARAMS ((char *, int)); -static int remove_breakpoint PARAMS ((struct breakpoint *)); +static int +get_number PARAMS ((char **)); + +void +set_breakpoint_count PARAMS ((int)); + +#if 0 +static struct breakpoint * +create_temp_exception_breakpoint PARAMS ((CORE_ADDR)); +#endif + +typedef enum { + mark_inserted, + mark_uninserted, +} insertion_state_t; + +static int +remove_breakpoint PARAMS ((struct breakpoint *, insertion_state_t)); static int print_it_normal PARAMS ((bpstat)); +typedef struct { + enum exception_event_kind kind; + int enable; +} args_for_catchpoint_enable; + static int watchpoint_check PARAMS ((char *)); +static struct symtab_and_line * +cover_target_enable_exception_callback PARAMS ((args_for_catchpoint_enable *)); + static int print_it_done PARAMS ((bpstat)); static int print_it_noop PARAMS ((bpstat)); @@ -134,6 +187,16 @@ static void do_enable_breakpoint PARAMS ((struct breakpoint *, enum bpdisp)); /* Prototypes for exported functions. */ +static void +awatch_command PARAMS ((char *, int)); + +static void +do_enable_breakpoint PARAMS ((struct breakpoint *, enum bpdisp)); + +/* If FALSE, gdb will not use hardware support for watchpoints, even + if such is available. */ +static int can_use_hw_watchpoints; + void delete_command PARAMS ((char *, int)); void _initialize_breakpoint PARAMS ((void)); @@ -182,6 +245,18 @@ struct breakpoint *breakpoint_chain; int breakpoint_count; +/* Pointer to current exception event record */ +static struct exception_event_record * current_exception_event; + +/* Indicator of whether exception catchpoints should be nuked + between runs of a program */ +int exception_catchpoints_are_fragile = 0; + +/* Indicator of when exception catchpoints set-up should be + reinitialized -- e.g. when program is re-run */ +int exception_support_initialized = 0; + + /* Set breakpoint count to NUM. */ void @@ -360,8 +435,6 @@ commands_command (arg, from_tty) error ("No breakpoint number %d.", bnum); } -extern int memory_breakpoint_size; /* from mem-break.c */ - /* Like target_read_memory() but if breakpoints are inserted, return the shadow contents instead of the breakpoints themselves. @@ -378,84 +451,96 @@ read_memory_nobpt (memaddr, myaddr, len) { int status; struct breakpoint *b; + CORE_ADDR bp_addr = 0; + int bp_size = 0; - if (memory_breakpoint_size < 0) - /* No breakpoints on this machine. FIXME: This should be - dependent on the debugging target. Probably want - target_insert_breakpoint to return a size, saying how many - bytes of the shadow contents are used, or perhaps have - something like target_xfer_shadow. */ + if (BREAKPOINT_FROM_PC (&bp_addr, &bp_size) == NULL) + /* No breakpoints on this machine. */ return target_read_memory (memaddr, myaddr, len); ALL_BREAKPOINTS (b) { + if (b->type == bp_none) + warning ("attempted to read through apparently deleted breakpoint #%d?\n", b->number); + + /* memory breakpoint? */ if (b->type == bp_watchpoint || b->type == bp_hardware_watchpoint || b->type == bp_read_watchpoint - || b->type == bp_access_watchpoint - || !b->inserted) + || b->type == bp_access_watchpoint) continue; - else if (b->address + memory_breakpoint_size <= memaddr) - /* The breakpoint is entirely before the chunk of memory - we are reading. */ + /* bp in memory? */ + if (!b->inserted) continue; - else if (b->address >= memaddr + len) - /* The breakpoint is entirely after the chunk of memory we + /* Addresses and length of the part of the breakpoint that + we need to copy. */ + /* XXXX The m68k, sh and h8300 have different local and remote + breakpoint values. BREAKPOINT_FROM_PC still manages to + correctly determine the breakpoints memory address and size + for these targets. */ + bp_addr = b->address; + bp_size = 0; + if (BREAKPOINT_FROM_PC (&bp_addr, &bp_size) == NULL) + continue; + if (bp_size == 0) + /* bp isn't valid */ + continue; + if (bp_addr + bp_size <= memaddr) + /* The breakpoint is entirely before the chunk of memory we are reading. */ continue; - else - { - /* Copy the breakpoint from the shadow contents, and recurse - for the things before and after. */ - - /* Addresses and length of the part of the breakpoint that - we need to copy. */ - CORE_ADDR membpt = b->address; - unsigned int bptlen = memory_breakpoint_size; - /* Offset within shadow_contents. */ - int bptoffset = 0; + if (bp_addr >= memaddr + len) + /* The breakpoint is entirely after the chunk of memory we are + reading. */ + continue; + /* Copy the breakpoint from the shadow contents, and recurse for + the things before and after. */ + { + /* Offset within shadow_contents. */ + int bptoffset = 0; - if (membpt < memaddr) - { - /* Only copy the second part of the breakpoint. */ - bptlen -= memaddr - membpt; - bptoffset = memaddr - membpt; - membpt = memaddr; - } - - if (membpt + bptlen > memaddr + len) - { - /* Only copy the first part of the breakpoint. */ - bptlen -= (membpt + bptlen) - (memaddr + len); - } - - memcpy (myaddr + membpt - memaddr, - b->shadow_contents + bptoffset, bptlen); - - if (membpt > memaddr) - { - /* Copy the section of memory before the breakpoint. */ - status = read_memory_nobpt (memaddr, myaddr, membpt - memaddr); - if (status != 0) - return status; - } - - if (membpt + bptlen < memaddr + len) - { - /* Copy the section of memory after the breakpoint. */ - status = read_memory_nobpt - (membpt + bptlen, - myaddr + membpt + bptlen - memaddr, - memaddr + len - (membpt + bptlen)); - if (status != 0) - return status; - } - return 0; - } + if (bp_addr < memaddr) + { + /* Only copy the second part of the breakpoint. */ + bp_size -= memaddr - bp_addr; + bptoffset = memaddr - bp_addr; + bp_addr = memaddr; + } + + if (bp_addr + bp_size > memaddr + len) + { + /* Only copy the first part of the breakpoint. */ + bp_size -= (bp_addr + bp_size) - (memaddr + len); + } + + memcpy (myaddr + bp_addr - memaddr, + b->shadow_contents + bptoffset, bp_size); + + if (bp_addr > memaddr) + { + /* Copy the section of memory before the breakpoint. */ + status = read_memory_nobpt (memaddr, myaddr, bp_addr - memaddr); + if (status != 0) + return status; + } + + if (bp_addr + bp_size < memaddr + len) + { + /* Copy the section of memory after the breakpoint. */ + status = read_memory_nobpt + (bp_addr + bp_size, + myaddr + bp_addr + bp_size - memaddr, + memaddr + len - (bp_addr + bp_size)); + if (status != 0) + return status; + } + return 0; + } } /* Nothing overlaps. Just call read_memory_noerr. */ return target_read_memory (memaddr, myaddr, len); } + /* insert_breakpoints is used when starting or continuing the program. remove_breakpoints is used when the program stops. @@ -469,167 +554,258 @@ insert_breakpoints () int val = 0; int disabled_breaks = 0; + static char message1[] = "Error inserting catchpoint %d:\n"; + static char message[sizeof (message1) + 30]; + + ALL_BREAKPOINTS_SAFE (b, temp) - if (b->type != bp_watchpoint - && b->type != bp_hardware_watchpoint - && b->type != bp_read_watchpoint - && b->type != bp_access_watchpoint - && b->enable != disabled - && b->enable != shlib_disabled - && ! b->inserted - && ! b->duplicate) - { - if (b->type == bp_hardware_breakpoint) - val = target_insert_hw_breakpoint(b->address, b->shadow_contents); - else - { - /* Check to see if breakpoint is in an overlay section; - if so, we should set the breakpoint at the LMA address. - Only if the section is currently mapped should we ALSO - set a break at the VMA address. */ - if (overlay_debugging && b->section && - section_is_overlay (b->section)) - { - CORE_ADDR addr; - - addr = overlay_unmapped_address (b->address, b->section); - val = target_insert_breakpoint (addr, b->shadow_contents); - /* This would be the time to check val, to see if the - breakpoint write to the load address succeeded. - However, this might be an ordinary occurrance, eg. if - the unmapped overlay is in ROM. */ - val = 0; /* in case unmapped address failed */ - if (section_is_mapped (b->section)) - val = target_insert_breakpoint (b->address, - b->shadow_contents); - } - else /* ordinary (non-overlay) address */ - val = target_insert_breakpoint(b->address, b->shadow_contents); - } - if (val) - { - /* Can't set the breakpoint. */ + { + if (b->type != bp_watchpoint + && b->type != bp_hardware_watchpoint + && b->type != bp_read_watchpoint + && b->type != bp_access_watchpoint + && b->type != bp_catch_fork + && b->type != bp_catch_vfork + && b->type != bp_catch_exec + && b->type != bp_catch_throw + && b->type != bp_catch_catch + && b->enable != disabled + && b->enable != shlib_disabled + && b->enable != call_disabled + && ! b->inserted + && ! b->duplicate) + { + if (b->type == bp_hardware_breakpoint) + val = target_insert_hw_breakpoint(b->address, b->shadow_contents); + else + { + /* Check to see if breakpoint is in an overlay section; + if so, we should set the breakpoint at the LMA address. + Only if the section is currently mapped should we ALSO + set a break at the VMA address. */ + if (overlay_debugging && b->section && + section_is_overlay (b->section)) + { + CORE_ADDR addr; + + addr = overlay_unmapped_address (b->address, b->section); + val = target_insert_breakpoint (addr, b->shadow_contents); + /* This would be the time to check val, to see if the + breakpoint write to the load address succeeded. + However, this might be an ordinary occurrance, eg. if + the unmapped overlay is in ROM. */ + val = 0; /* in case unmapped address failed */ + if (section_is_mapped (b->section)) + val = target_insert_breakpoint (b->address, + b->shadow_contents); + } + else /* ordinary (non-overlay) address */ + val = target_insert_breakpoint(b->address, b->shadow_contents); + } + if (val) + { + /* Can't set the breakpoint. */ #if defined (DISABLE_UNSETTABLE_BREAK) - if (DISABLE_UNSETTABLE_BREAK (b->address)) - { - val = 0; - b->enable = shlib_disabled; - if (!disabled_breaks) - { - target_terminal_ours_for_output (); - fprintf_unfiltered (gdb_stderr, - "Cannot insert breakpoint %d:\n", b->number); - printf_filtered ("Temporarily disabling shared library breakpoints:\n"); - } - disabled_breaks = 1; - printf_filtered ("%d ", b->number); - } - else + if (DISABLE_UNSETTABLE_BREAK (b->address)) + { + /* See also: disable_breakpoints_in_shlibs. */ + val = 0; + b->enable = shlib_disabled; + if (!disabled_breaks) + { + target_terminal_ours_for_output (); + fprintf_unfiltered (gdb_stderr, + "Cannot insert breakpoint %d:\n", b->number); + printf_filtered ("Temporarily disabling shared library breakpoints:\n"); + } + disabled_breaks = 1; + printf_filtered ("%d ", b->number); + } + else #endif - { - target_terminal_ours_for_output (); - fprintf_unfiltered (gdb_stderr, "Cannot insert breakpoint %d:\n", b->number); + { + target_terminal_ours_for_output (); + fprintf_unfiltered (gdb_stderr, "Cannot insert breakpoint %d:\n", b->number); #ifdef ONE_PROCESS_WRITETEXT - fprintf_unfiltered (gdb_stderr, - "The same program may be running in another process.\n"); + fprintf_unfiltered (gdb_stderr, + "The same program may be running in another process.\n"); #endif - memory_error (val, b->address); /* which bombs us out */ - } - } - else - b->inserted = 1; - } - else if ((b->type == bp_hardware_watchpoint || - b->type == bp_read_watchpoint || - b->type == bp_access_watchpoint) - && b->enable == enabled - && ! b->inserted - && ! b->duplicate) + memory_error (val, b->address); /* which bombs us out */ + } + } + else + b->inserted = 1; + } + else if (ep_is_exception_catchpoint (b) + && b->enable != disabled + && b->enable != shlib_disabled + && b->enable != call_disabled + && ! b->inserted + && ! b->duplicate) + { - struct frame_info *saved_frame; - int saved_level, within_current_scope; - value_ptr mark = value_mark (); - value_ptr v; - - /* Save the current frame and level so we can restore it after - evaluating the watchpoint expression on its own frame. */ - saved_frame = selected_frame; - saved_level = selected_frame_level; - - /* Determine if the watchpoint is within scope. */ - if (b->exp_valid_block == NULL) - within_current_scope = 1; - else - { - struct frame_info *fi; - - /* There might be no current frame at this moment if we are - resuming from a step over a breakpoint. - Set up current frame before trying to find the watchpoint - frame. */ - get_current_frame (); - fi = find_frame_addr_in_frame_chain (b->watchpoint_frame); - within_current_scope = (fi != NULL); - if (within_current_scope) - select_frame (fi, -1); - } + /* If we get here, we must have a callback mechanism for exception + events -- with g++ style embedded label support, we insert + ordinary breakpoints and not catchpoints. */ + struct symtab_and_line * sal; + args_for_catchpoint_enable args; + sprintf (message, message1, b->number); /* Format possible error message */ + + val = target_insert_breakpoint(b->address, b->shadow_contents); + if (val) + { + /* Couldn't set breakpoint for some reason */ + target_terminal_ours_for_output (); + fprintf_unfiltered (gdb_stderr, + "Cannot insert catchpoint %d; disabling it\n", b->number); + b->enable = disabled; + } + else + { + /* Bp set, now make sure callbacks are enabled */ + args.kind = b->type == bp_catch_catch ? EX_EVENT_CATCH : EX_EVENT_THROW; + args.enable = 1; + sal = catch_errors ((int (*) PARAMS ((char *))) cover_target_enable_exception_callback, + (char *) &args, + message, RETURN_MASK_ALL); + if (sal && (sal != (struct symtab_and_line *) -1)) + { + b->inserted = 1; + } + /* Check if something went wrong; sal == 0 can be ignored */ + if (sal == (struct symtab_and_line *) -1) + { + /* something went wrong */ + target_terminal_ours_for_output (); + fprintf_unfiltered (gdb_stderr, "Cannot insert catchpoint %d; disabling it\n", b->number); + b->enable = disabled; + } + } + } + + else if ((b->type == bp_hardware_watchpoint || + b->type == bp_read_watchpoint || + b->type == bp_access_watchpoint) + && b->enable == enabled + && ! b->inserted + && ! b->duplicate) + { + struct frame_info *saved_frame; + int saved_level, within_current_scope; + value_ptr mark = value_mark (); + value_ptr v; + + /* Save the current frame and level so we can restore it after + evaluating the watchpoint expression on its own frame. */ + saved_frame = selected_frame; + saved_level = selected_frame_level; + + /* Determine if the watchpoint is within scope. */ + if (b->exp_valid_block == NULL) + within_current_scope = 1; + else + { + struct frame_info *fi; + + /* There might be no current frame at this moment if we are + resuming from a step over a breakpoint. + Set up current frame before trying to find the watchpoint + frame. */ + get_current_frame (); + fi = find_frame_addr_in_frame_chain (b->watchpoint_frame); + within_current_scope = (fi != NULL); + if (within_current_scope) + select_frame (fi, -1); + } - if (within_current_scope) - { - /* Evaluate the expression and cut the chain of values - produced off from the value chain. */ - v = evaluate_expression (b->exp); - value_release_to_mark (mark); + if (within_current_scope) + { + /* Evaluate the expression and cut the chain of values + produced off from the value chain. */ + v = evaluate_expression (b->exp); + value_release_to_mark (mark); - b->val_chain = v; - b->inserted = 1; + b->val_chain = v; + b->inserted = 1; - /* Look at each value on the value chain. */ - for ( ; v; v=v->next) - { - /* If it's a memory location, then we must watch it. */ - if (v->lval == lval_memory) - { - int addr, len, type; + /* Look at each value on the value chain. */ + for ( ; v; v=v->next) + { + /* If it's a memory location, then we must watch it. */ + if (v->lval == lval_memory) + { + int addr, len, type; - addr = VALUE_ADDRESS (v) + VALUE_OFFSET (v); - len = TYPE_LENGTH (VALUE_TYPE (v)); - type = 0; - if (b->type == bp_read_watchpoint) - type = 1; - else if (b->type == bp_access_watchpoint) - type = 2; - - val = target_insert_watchpoint (addr, len, type); - if (val == -1) - { - b->inserted = 0; - break; - } - val = 0; - } - } - /* Failure to insert a watchpoint on any memory value in the - value chain brings us here. */ - if (!b->inserted) - warning ("Hardware watchpoint %d: Could not insert watchpoint\n", - b->number); - } - else - { - printf_filtered ("\ + addr = VALUE_ADDRESS (v) + VALUE_OFFSET (v); + len = TYPE_LENGTH (VALUE_TYPE (v)); + type = 0; + if (b->type == bp_read_watchpoint) + type = 1; + else if (b->type == bp_access_watchpoint) + type = 2; + + val = target_insert_watchpoint (addr, len, type); + if (val == -1) + { + b->inserted = 0; + break; + } + val = 0; + } + } + /* Failure to insert a watchpoint on any memory value in the + value chain brings us here. */ + if (!b->inserted) + warning ("Hardware watchpoint %d: Could not insert watchpoint\n", + b->number); + } + else + { + printf_filtered ("\ Hardware watchpoint %d deleted because the program has left the block in\n\ which its expression is valid.\n", b->number); - if (b->related_breakpoint) - b->related_breakpoint->disposition = del_at_next_stop; - b->disposition = del_at_next_stop; - } + if (b->related_breakpoint) + b->related_breakpoint->disposition = del_at_next_stop; + b->disposition = del_at_next_stop; + } - /* Restore the frame and level. */ - select_frame (saved_frame, saved_level); - } + /* Restore the frame and level. */ + if ((saved_frame != selected_frame) || + (saved_level != selected_frame_level)) + select_and_print_frame (saved_frame, saved_level); + } + else if ((b->type == bp_catch_fork + || b->type == bp_catch_vfork + || b->type == bp_catch_exec) + && b->enable == enabled + && ! b->inserted + && ! b->duplicate) + { + val = -1; + switch (b->type) + { + case bp_catch_fork : + val = target_insert_fork_catchpoint (inferior_pid); + break; + case bp_catch_vfork : + val = target_insert_vfork_catchpoint (inferior_pid); + break; + case bp_catch_exec : + val = target_insert_exec_catchpoint (inferior_pid); + break; + } + if (val < 0) + { + target_terminal_ours_for_output (); + fprintf_unfiltered (gdb_stderr, "Cannot insert catchpoint %d:\n", b->number); + } + else + b->inserted = 1; + } + } if (disabled_breaks) printf_filtered ("\n"); + return val; } @@ -644,7 +820,7 @@ remove_breakpoints () { if (b->inserted) { - val = remove_breakpoint (b); + val = remove_breakpoint (b, mark_uninserted); if (val != 0) return val; } @@ -652,17 +828,189 @@ remove_breakpoints () return 0; } +int +reattach_breakpoints (pid) + int pid; +{ + register struct breakpoint *b; + int val; + int saved_inferior_pid = inferior_pid; + + inferior_pid = pid; /* Because remove_breakpoint will use this global. */ + ALL_BREAKPOINTS (b) + { + if (b->inserted) + { + remove_breakpoint (b, mark_inserted); + if (b->type == bp_hardware_breakpoint) + val = target_insert_hw_breakpoint(b->address, b->shadow_contents); + else + val = target_insert_breakpoint(b->address, b->shadow_contents); + if (val != 0) + { + inferior_pid = saved_inferior_pid; + return val; + } + } + } + inferior_pid = saved_inferior_pid; + return 0; +} + +void +update_breakpoints_after_exec () +{ + struct breakpoint * b; + struct breakpoint * temp; + + /* Doing this first prevents the badness of having delete_breakpoint() + write a breakpoint's current "shadow contents" to lift the bp. That + shadow is NOT valid after an exec()! */ + mark_breakpoints_out (); + + ALL_BREAKPOINTS_SAFE (b, temp) + { + /* Solib breakpoints must be explicitly reset after an exec(). */ + if (b->type == bp_shlib_event) + { + delete_breakpoint (b); + continue; + } + + /* Step-resume breakpoints are meaningless after an exec(). */ + if (b->type == bp_step_resume) + { + delete_breakpoint (b); + continue; + } + + /* Ditto the sigtramp handler breakpoints. */ + if (b->type == bp_through_sigtramp) + { + delete_breakpoint (b); + continue; + } + + /* Ditto the exception-handling catchpoints. */ + if ((b->type == bp_catch_catch) || (b->type == bp_catch_throw)) + { + delete_breakpoint (b); + continue; + } + + /* Don't delete an exec catchpoint, because else the inferior + won't stop when it ought! + + Similarly, we probably ought to keep vfork catchpoints, 'cause + on this target, we may not be able to stop when the vfork is seen, + but only when the subsequent exec is seen. (And because deleting + fork catchpoints here but not vfork catchpoints will seem mysterious + to users, keep those too.) + + ??rehrauer: Let's hope that merely clearing out this catchpoint's + target address field, if any, is sufficient to have it be reset + automagically. Certainly on HP-UX that's true. */ + if ((b->type == bp_catch_exec) || + (b->type == bp_catch_vfork) || + (b->type == bp_catch_fork)) + { + b->address = NULL; + continue; + } + + /* bp_finish is a special case. The only way we ought to be able + to see one of these when an exec() has happened, is if the user + caught a vfork, and then said "finish". Ordinarily a finish just + carries them to the call-site of the current callee, by setting + a temporary bp there and resuming. But in this case, the finish + will carry them entirely through the vfork & exec. + + We don't want to allow a bp_finish to remain inserted now. But + we can't safely delete it, 'cause finish_command has a handle to + the bp on a bpstat, and will later want to delete it. There's a + chance (and I've seen it happen) that if we delete the bp_finish + here, that its storage will get reused by the time finish_command + gets 'round to deleting the "use to be a bp_finish" breakpoint. + We really must allow finish_command to delete a bp_finish. + + In the absense of a general solution for the "how do we know it's + safe to delete something others may have handles to?" problem, what + we'll do here is just uninsert the bp_finish, and let finish_command + delete it. + + (We know the bp_finish is "doomed" in the sense that it's momentary, + and will be deleted as soon as finish_command sees the inferior stopped. + So it doesn't matter that the bp's address is probably bogus in the + new a.out, unlike e.g., the solib breakpoints.) */ + if (b->type == bp_finish) + { + continue; + } + + /* Without a symbolic address, we have little hope of the + pre-exec() address meaning the same thing in the post-exec() + a.out. */ + if (b->addr_string == NULL) + { + delete_breakpoint (b); + continue; + } + + /* If this breakpoint has survived the above battery of checks, then + it must have a symbolic address. Be sure that it gets reevaluated + to a target address, rather than reusing the old evaluation. */ + b->address = NULL; + } +} + +int +detach_breakpoints (pid) + int pid; +{ + register struct breakpoint *b; + int val; + int saved_inferior_pid = inferior_pid; + + if (pid == inferior_pid) + error ("Cannot detach breakpoints of inferior_pid"); + + inferior_pid = pid; /* Because remove_breakpoint will use this global. */ + ALL_BREAKPOINTS (b) + { + if (b->inserted) + { + val = remove_breakpoint (b, mark_inserted); + if (val != 0) + { + inferior_pid = saved_inferior_pid; + return val; + } + } + } + inferior_pid = saved_inferior_pid; + return 0; +} static int -remove_breakpoint (b) +remove_breakpoint (b, is) struct breakpoint *b; + insertion_state_t is; { int val; + if (b->type == bp_none) + warning ("attempted to remove apparently deleted breakpoint #%d?\n", b->number); + if (b->type != bp_watchpoint && b->type != bp_hardware_watchpoint && b->type != bp_read_watchpoint - && b->type != bp_access_watchpoint) + && b->type != bp_access_watchpoint + && b->type != bp_catch_fork + && b->type != bp_catch_vfork + && b->type != bp_catch_exec + && b->type != bp_catch_catch + && b->type != bp_catch_throw) + { if (b->type == bp_hardware_breakpoint) val = target_remove_hw_breakpoint(b->address, b->shadow_contents); @@ -693,7 +1041,7 @@ remove_breakpoint (b) } if (val) return val; - b->inserted = 0; + b->inserted = (is == mark_inserted); } else if ((b->type == bp_hardware_watchpoint || b->type == bp_read_watchpoint || @@ -703,7 +1051,7 @@ remove_breakpoint (b) { value_ptr v, n; - b->inserted = 0; + b->inserted = (is == mark_inserted); /* Walk down the saved value chain. */ for (v = b->val_chain; v; v = v->next) { @@ -728,7 +1076,7 @@ remove_breakpoint (b) } } /* Failure to remove any of the hardware watchpoints comes here. */ - if (b->inserted) + if ((is == mark_uninserted) && (b->inserted)) warning ("Hardware watchpoint %d: Could not remove watchpoint\n", b->number); @@ -741,6 +1089,53 @@ remove_breakpoint (b) } b->val_chain = NULL; } + else if ((b->type == bp_catch_fork || + b->type == bp_catch_vfork || + b->type == bp_catch_exec) + && b->enable == enabled + && ! b->duplicate) + { + val = -1; + switch (b->type) + { + case bp_catch_fork: + val = target_remove_fork_catchpoint (inferior_pid); + break; + case bp_catch_vfork : + val = target_remove_vfork_catchpoint (inferior_pid); + break; + case bp_catch_exec : + val = target_remove_exec_catchpoint (inferior_pid); + break; + } + if (val) + return val; + b->inserted = (is == mark_inserted); + } + else if ((b->type == bp_catch_catch || + b->type == bp_catch_throw) + && b->enable == enabled + && ! b->duplicate) + { + + val = target_remove_breakpoint(b->address, b->shadow_contents); + if (val) + return val; + b->inserted = (is == mark_inserted); + } + else if (ep_is_exception_catchpoint (b) + && b->inserted /* sometimes previous insert doesn't happen */ + && b->enable == enabled + && ! b->duplicate) + { + + val = target_remove_breakpoint(b->address, b->shadow_contents); + if (val) + return val; + + b->inserted = (is == mark_inserted); + } + return 0; } @@ -756,12 +1151,22 @@ mark_breakpoints_out () } /* Clear the "inserted" flag in all breakpoints and delete any breakpoints - which should go away between runs of the program. */ + which should go away between runs of the program. + + Plus other such housekeeping that has to be done for breakpoints + between runs. + + Note: this function gets called at the end of a run (by generic_mourn_inferior) + and when a run begins (by init_wait_for_inferior). */ + + void -breakpoint_init_inferior () +breakpoint_init_inferior (context) + enum inf_context context; { register struct breakpoint *b, *temp; + static int warning_needed = 0; ALL_BREAKPOINTS_SAFE (b, temp) { @@ -789,11 +1194,28 @@ breakpoint_init_inferior () if (b->exp_valid_block != NULL) delete_breakpoint (b); break; - default: - break; + /* Likewise for exception catchpoints in dynamic-linked + executables where required */ + if (ep_is_exception_catchpoint (b) && + exception_catchpoints_are_fragile) + { + warning_needed = 1; + delete_breakpoint (b); + } + break; } } + + if (exception_catchpoints_are_fragile) + exception_support_initialized = 0; + + /* Don't issue the warning unless it's really needed... */ + if (warning_needed && (context != inf_exited)) + { + warning ("Exception catchpoints from last run were deleted, you must reinsert them explicitly"); + warning_needed = 0; + } } /* breakpoint_here_p (PC) returns 1 if an enabled breakpoint exists at PC. @@ -808,6 +1230,8 @@ breakpoint_here_p (pc) ALL_BREAKPOINTS (b) if (b->enable == enabled + && b->enable != shlib_disabled + && b->enable != call_disabled && b->address == pc) /* bp is enabled and matches pc */ { if (overlay_debugging && @@ -896,6 +1320,7 @@ breakpoint_thread_match (pc, pid) ALL_BREAKPOINTS (b) if (b->enable != disabled && b->enable != shlib_disabled + && b->enable != call_disabled && b->address == pc && (b->thread == -1 || b->thread == thread)) { @@ -914,6 +1339,44 @@ breakpoint_thread_match (pc, pid) /* bpstat stuff. External routines' interfaces are documented in breakpoint.h. */ +int +ep_is_catchpoint (ep) + struct breakpoint * ep; +{ + return + (ep->type == bp_catch_load) + || (ep->type == bp_catch_unload) + || (ep->type == bp_catch_fork) + || (ep->type == bp_catch_vfork) + || (ep->type == bp_catch_exec) + || (ep->type == bp_catch_catch) + || (ep->type == bp_catch_throw) + + + /* ??rehrauer: Add more kinds here, as are implemented... */ + ; +} + +int +ep_is_shlib_catchpoint (ep) + struct breakpoint * ep; +{ + return + (ep->type == bp_catch_load) + || (ep->type == bp_catch_unload) + ; +} + +int +ep_is_exception_catchpoint (ep) + struct breakpoint * ep; +{ + return + (ep->type == bp_catch_catch) + || (ep->type == bp_catch_throw) + ; +} + /* Clear a bpstat so that it says we are not at any breakpoint. Also free any storage that is part of a bpstat. */ @@ -982,6 +1445,32 @@ bpstat_find_breakpoint(bsp, breakpoint) return NULL; } +/* Find a step_resume breakpoint associated with this bpstat. + (If there are multiple step_resume bp's on the list, this function + will arbitrarily pick one.) + + It is an error to use this function if BPSTAT doesn't contain a + step_resume breakpoint. + + See wait_for_inferior's use of this function. */ +struct breakpoint * +bpstat_find_step_resume_breakpoint (bsp) + bpstat bsp; +{ + if (bsp == NULL) + error ("Internal error (bpstat_find_step_resume_breakpoint)"); + + for (; bsp != NULL; bsp = bsp->next) + { + if ((bsp->breakpoint_at != NULL) && + (bsp->breakpoint_at->type == bp_step_resume)) + return bsp->breakpoint_at; + } + + error ("Internal error (no step_resume breakpoint found)"); +} + + /* Return the breakpoint number of the first breakpoint we are stopped at. *BSP upon return is a bpstat which points to the remaining breakpoints stopped at (but which is not guaranteed to be good for @@ -1055,6 +1544,15 @@ bpstat_do_actions (bsp) old_chain = make_cleanup (cleanup_executing_breakpoints, 0); top: + /* Note that (as of this writing), our callers all appear to + be passing us the address of global stop_bpstat. And, if + our calls to execute_control_command cause the inferior to + proceed, that global (and hence, *bsp) will change. + + We must be careful to not touch *bsp unless the inferior + has not proceeded. */ + + /* This pointer will iterate over the list of bpstat's. */ bs = *bsp; breakpoint_proceeded = 0; @@ -1064,7 +1562,11 @@ top: while (cmd != NULL) { execute_control_command (cmd); - cmd = cmd->next; + + if (breakpoint_proceeded) + break; + else + cmd = cmd->next; } if (breakpoint_proceeded) /* The inferior is proceeded by the command; bomb out now. @@ -1082,7 +1584,21 @@ top: /* This is the normal print_it function for a bpstat. In the future, much of this logic could (should?) be moved to bpstat_stop_status, - by having it set different print_it functions. */ + by having it set different print_it functions. + + Current scheme: When we stop, bpstat_print() is called. + It loops through the bpstat list of things causing this stop, + calling the print_it function for each one. The default + print_it function, used for breakpoints, is print_it_normal(). + (Also see print_it_noop() and print_it_done()). + + Return values from this routine (used by bpstat_print() to + decide what to do): + 1: Means we printed something, and we do *not* desire that + something to be followed by a location. + 0: Means we printed something, and we *do* desire that + something to be followed by a location. + -1: Means we printed nothing. */ static int print_it_normal (bs) @@ -1092,14 +1608,113 @@ print_it_normal (bs) which has since been deleted. */ if (bs->breakpoint_at == NULL || (bs->breakpoint_at->type != bp_breakpoint + && bs->breakpoint_at->type != bp_catch_load + && bs->breakpoint_at->type != bp_catch_unload + && bs->breakpoint_at->type != bp_catch_fork + && bs->breakpoint_at->type != bp_catch_vfork + && bs->breakpoint_at->type != bp_catch_exec + && bs->breakpoint_at->type != bp_catch_catch + && bs->breakpoint_at->type != bp_catch_throw && bs->breakpoint_at->type != bp_hardware_breakpoint && bs->breakpoint_at->type != bp_watchpoint && bs->breakpoint_at->type != bp_read_watchpoint && bs->breakpoint_at->type != bp_access_watchpoint && bs->breakpoint_at->type != bp_hardware_watchpoint)) - return 0; + return -1; - if (bs->breakpoint_at->type == bp_breakpoint || + if (ep_is_shlib_catchpoint (bs->breakpoint_at)) + { + annotate_catchpoint (bs->breakpoint_at->number); + printf_filtered ("\nCatchpoint %d (", bs->breakpoint_at->number); + if (bs->breakpoint_at->type == bp_catch_load) + printf_filtered ("loaded"); + else if (bs->breakpoint_at->type == bp_catch_unload) + printf_filtered ("unloaded"); + printf_filtered (" %s), ", bs->breakpoint_at->triggered_dll_pathname); + return 0; + } + else if (bs->breakpoint_at->type == bp_catch_fork || + bs->breakpoint_at->type == bp_catch_vfork) + { + annotate_catchpoint (bs->breakpoint_at->number); + printf_filtered ("\nCatchpoint %d (", bs->breakpoint_at->number); + if (bs->breakpoint_at->type == bp_catch_fork) + printf_filtered ("forked"); + else if (bs->breakpoint_at->type == bp_catch_vfork) + printf_filtered ("vforked"); + printf_filtered (" process %d), ", bs->breakpoint_at->forked_inferior_pid); + return 0; + } + else if (bs->breakpoint_at->type == bp_catch_exec) + { + annotate_catchpoint (bs->breakpoint_at->number); + printf_filtered ("\nCatchpoint %d (exec'd %s), ", + bs->breakpoint_at->number, + bs->breakpoint_at->exec_pathname); + return 0; + } + else if (bs->breakpoint_at->type == bp_catch_catch) + { + if (current_exception_event && (CURRENT_EXCEPTION_KIND == EX_EVENT_CATCH)) + { + annotate_catchpoint (bs->breakpoint_at->number); + printf_filtered ("\nCatchpoint %d (exception caught), ", bs->breakpoint_at->number); + printf_filtered ("throw location "); + if (CURRENT_EXCEPTION_THROW_PC && CURRENT_EXCEPTION_THROW_LINE) + printf_filtered ("%s:%d", + CURRENT_EXCEPTION_THROW_FILE, + CURRENT_EXCEPTION_THROW_LINE); + else + printf_filtered ("unknown"); + + printf_filtered (", catch location "); + if (CURRENT_EXCEPTION_CATCH_PC && CURRENT_EXCEPTION_CATCH_LINE) + printf_filtered ("%s:%d", + CURRENT_EXCEPTION_CATCH_FILE, + CURRENT_EXCEPTION_CATCH_LINE); + else + printf_filtered ("unknown"); + + printf_filtered ("\n"); + return 1; /* don't bother to print location frame info */ + } + else + { + return -1; /* really throw, some other bpstat will handle it */ + } + } + else if (bs->breakpoint_at->type == bp_catch_throw) + { + if (current_exception_event && (CURRENT_EXCEPTION_KIND == EX_EVENT_THROW)) + { + annotate_catchpoint (bs->breakpoint_at->number); + printf_filtered ("\nCatchpoint %d (exception thrown), ", bs->breakpoint_at->number); + printf_filtered ("throw location "); + if (CURRENT_EXCEPTION_THROW_PC && CURRENT_EXCEPTION_THROW_LINE) + printf_filtered ("%s:%d", + CURRENT_EXCEPTION_THROW_FILE, + CURRENT_EXCEPTION_THROW_LINE); + else + printf_filtered ("unknown"); + + printf_filtered (", catch location "); + if (CURRENT_EXCEPTION_CATCH_PC && CURRENT_EXCEPTION_CATCH_LINE) + printf_filtered ("%s:%d", + CURRENT_EXCEPTION_CATCH_FILE, + CURRENT_EXCEPTION_CATCH_LINE); + else + printf_filtered ("unknown"); + + printf_filtered ("\n"); + return 1; /* don't bother to print location frame info */ + } + else + { + return -1; /* really catch, some other bpstat willhandle it */ + } + } + + else if (bs->breakpoint_at->type == bp_breakpoint || bs->breakpoint_at->type == bp_hardware_breakpoint) { /* I think the user probably only wants to see one breakpoint @@ -1140,10 +1755,25 @@ print_it_normal (bs) return -1; } -/* Print a message indicating what happened. Returns nonzero to - say that only the source line should be printed after this (zero - return means print the frame as well as the source line). */ -/* Currently we always return zero. */ +/* Print a message indicating what happened. + This is called from normal_stop(). + The input to this routine is the head of the bpstat list - a list + of the eventpoints that caused this stop. + This routine calls the "print_it" routine(s) associated + with these eventpoints. This will print (for example) + the "Breakpoint n," part of the output. + The return value of this routine is one of: + + -1: Means we printed nothing + 0: Means we printed something, and expect subsequent + code to print the location. An example is + "Breakpoint 1, " which should be followed by + the location. + 1 : Means we printed something, but there is no need + to also print the location part of the message. + An example is the catch/throw messages, which + don't require a location appended to the end. */ + int bpstat_print (bs) bpstat bs; @@ -1151,7 +1781,7 @@ bpstat_print (bs) int val; if (bs == NULL) - return 0; + return -1; val = (*bs->print_it) (bs); if (val >= 0) @@ -1165,7 +1795,7 @@ bpstat_print (bs) return bpstat_print (bs->next); /* We reached the end of the chain without printing anything. */ - return 0; + return -1; } /* Evaluate the expression EXP and return 1 if value is zero. @@ -1293,6 +1923,15 @@ which its expression is valid.\n", bs->breakpoint_at->number); /* This is used when everything which needs to be printed has already been printed. But we still want to print the frame. */ + +/* Background: When we stop, bpstat_print() is called. + It loops through the bpstat list of things causing this stop, + calling the print_it function for each one. The default + print_it function, used for breakpoints, is print_it_normal(). + Also see print_it_noop() and print_it_done() are the other + two possibilities. See comments in bpstat_print() and + in header of print_it_normal() for more detail. */ + static int print_it_done (bs) bpstat bs; @@ -1301,6 +1940,13 @@ print_it_done (bs) } /* This is used when nothing should be printed for this bpstat entry. */ +/* Background: When we stop, bpstat_print() is called. + It loops through the bpstat list of things causing this stop, + calling the print_it function for each one. The default + print_it function, used for breakpoints, is print_it_normal(). + Also see print_it_noop() and print_it_done() are the other + two possibilities. See comments in bpstat_print() and + in header of print_it_normal() for more detail. */ static int print_it_noop (bs) @@ -1327,9 +1973,7 @@ print_it_noop (bs) several reasons concurrently.) Each element of the chain has valid next, breakpoint_at, - commands, FIXME??? fields. - - */ + commands, FIXME??? fields. */ bpstat bpstat_stop_status (pc, not_a_breakpoint) @@ -1354,14 +1998,20 @@ bpstat_stop_status (pc, not_a_breakpoint) ALL_BREAKPOINTS_SAFE (b, temp) { if (b->enable == disabled - || b->enable == shlib_disabled) + || b->enable == shlib_disabled + || b->enable == call_disabled) continue; if (b->type != bp_watchpoint && b->type != bp_hardware_watchpoint && b->type != bp_read_watchpoint && b->type != bp_access_watchpoint - && b->type != bp_hardware_breakpoint) /* a non-watchpoint bp */ + && b->type != bp_hardware_breakpoint + && b->type != bp_catch_fork + && b->type != bp_catch_vfork + && b->type != bp_catch_exec + && b->type != bp_catch_catch + && b->type != bp_catch_throw) /* a non-watchpoint bp */ if (b->address != bp_addr || /* address doesn't match or */ (overlay_debugging && /* overlay doesn't match */ section_is_overlay (b->section) && @@ -1379,19 +2029,55 @@ bpstat_stop_status (pc, not_a_breakpoint) && not_a_breakpoint) continue; - /* Come here if it's a watchpoint, or if the break address matches */ + /* Is this a catchpoint of a load or unload? If so, did we + get a load or unload of the specified library? If not, + ignore it. */ + if ((b->type == bp_catch_load) +#if defined(SOLIB_HAVE_LOAD_EVENT) + && (!SOLIB_HAVE_LOAD_EVENT(inferior_pid) + || ((b->dll_pathname != NULL) + && (strcmp (b->dll_pathname, SOLIB_LOADED_LIBRARY_PATHNAME(inferior_pid)) != 0))) +#endif + ) + continue; + + if ((b->type == bp_catch_unload) +#if defined(SOLIB_HAVE_UNLOAD_EVENT) + && (!SOLIB_HAVE_UNLOAD_EVENT(inferior_pid) + || ((b->dll_pathname != NULL) + && (strcmp (b->dll_pathname, SOLIB_UNLOADED_LIBRARY_PATHNAME(inferior_pid)) != 0))) +#endif + ) + continue; + + if ((b->type == bp_catch_fork) + && ! target_has_forked (inferior_pid, &b->forked_inferior_pid)) + continue; + + if ((b->type == bp_catch_vfork) + && ! target_has_vforked (inferior_pid, &b->forked_inferior_pid)) + continue; + + if ((b->type == bp_catch_exec) + && ! target_has_execd (inferior_pid, &b->exec_pathname)) + continue; - ++(b->hit_count); + if (ep_is_exception_catchpoint (b) && + !(current_exception_event = target_get_current_exception_event ())) + continue; + + /* Come here if it's a watchpoint, or if the break address matches */ bs = bpstat_alloc (b, bs); /* Alloc a bpstat to explain stop */ + /* Watchpoints may change this, if not found to have triggered. */ bs->stop = 1; bs->print = 1; sprintf (message, message1, b->number); if (b->type == bp_watchpoint || b->type == bp_hardware_watchpoint) { - switch (catch_errors (watchpoint_check, (char *) bs, message, + switch (catch_errors ((int (*) PARAMS ((char *))) watchpoint_check, (char *) bs, message, RETURN_MASK_ALL)) { case WP_DELETED: @@ -1401,6 +2087,7 @@ bpstat_stop_status (pc, not_a_breakpoint) break; case WP_VALUE_CHANGED: /* Stop. */ + ++(b->hit_count); break; case WP_VALUE_NOT_CHANGED: /* Don't stop. */ @@ -1445,7 +2132,7 @@ bpstat_stop_status (pc, not_a_breakpoint) } } if (found) - switch (catch_errors (watchpoint_check, (char *) bs, message, + switch (catch_errors ((int (*) PARAMS ((char *))) watchpoint_check, (char *) bs, message, RETURN_MASK_ALL)) { case WP_DELETED: @@ -1456,6 +2143,7 @@ bpstat_stop_status (pc, not_a_breakpoint) case WP_VALUE_CHANGED: case WP_VALUE_NOT_CHANGED: /* Stop. */ + ++(b->hit_count); break; default: /* Can't happen. */ @@ -1470,12 +2158,19 @@ bpstat_stop_status (pc, not_a_breakpoint) break; } } - else if (DECR_PC_AFTER_BREAK != 0 || must_shift_inst_regs) - real_breakpoint = 1; + else + { + /* By definition, an encountered breakpoint is a triggered + breakpoint. */ + ++(b->hit_count); + + if (DECR_PC_AFTER_BREAK != 0 || must_shift_inst_regs) + real_breakpoint = 1; + } if (b->frame && b->frame != (get_current_frame ())->frame && (b->type == bp_step_resume && - (get_current_frame ())->frame INNER_THAN b->frame)) + (INNER_THAN (get_current_frame ()->frame, b->frame)))) bs->stop = 0; else { @@ -1487,7 +2182,7 @@ bpstat_stop_status (pc, not_a_breakpoint) so that the conditions will have the right context. */ select_frame (get_current_frame (), 0); value_is_zero - = catch_errors (breakpoint_cond_eval, (char *)(b->cond), + = catch_errors ((int (*) PARAMS ((char *))) breakpoint_cond_eval, (char *)(b->cond), "Error in testing breakpoint condition:\n", RETURN_MASK_ALL); /* FIXME-someday, should give breakpoint # */ @@ -1512,7 +2207,9 @@ bpstat_stop_status (pc, not_a_breakpoint) bs->commands = b->commands; if (b->silent) bs->print = 0; - if (bs->commands && STREQ ("silent", bs->commands->line)) + if (bs->commands && + (STREQ ("silent", bs->commands->line) || + (xdb_commands && STREQ ("Q", bs->commands->line)))) { bs->commands = bs->commands->next; bs->print = 0; @@ -1593,6 +2290,9 @@ bpstat_what (bs) /* We hit the shared library event breakpoint. */ shlib_event, + /* We caught a shared library event. */ + catch_shlib_event, + /* This is just used to count how many enums there are. */ class_last }; @@ -1610,6 +2310,7 @@ bpstat_what (bs) #define sr BPSTAT_WHAT_STEP_RESUME #define ts BPSTAT_WHAT_THROUGH_SIGTRAMP #define shl BPSTAT_WHAT_CHECK_SHLIBS +#define shlr BPSTAT_WHAT_CHECK_SHLIBS_RESUME_FROM_HOOK /* "Can't happen." Might want to print an error message. abort() is not out of the question, but chances are GDB is just @@ -1634,20 +2335,22 @@ bpstat_what (bs) table[(int)class_last][(int)BPSTAT_WHAT_LAST] = { /* old action */ - /* kc ss sn sgl slr clr clrs sr ts shl - */ -/*no_effect*/ {kc, ss, sn, sgl, slr, clr, clrs, sr, ts, shl}, -/*wp_silent*/ {ss, ss, sn, ss, ss, ss, ss, sr, ts, shl}, -/*wp_noisy*/ {sn, sn, sn, sn, sn, sn, sn, sr, ts, shl}, -/*bp_nostop*/ {sgl, ss, sn, sgl, slr, clrs, clrs, sr, ts, shl}, -/*bp_silent*/ {ss, ss, sn, ss, ss, ss, ss, sr, ts, shl}, -/*bp_noisy*/ {sn, sn, sn, sn, sn, sn, sn, sr, ts, shl}, -/*long_jump*/ {slr, ss, sn, slr, err, err, err, sr, ts, shl}, -/*long_resume*/ {clr, ss, sn, clrs, err, err, err, sr, ts, shl}, -/*step_resume*/ {sr, sr, sr, sr, sr, sr, sr, sr, ts, shl}, -/*through_sig*/ {ts, ts, ts, ts, ts, ts, ts, ts, ts, shl}, -/*shlib*/ {shl, shl, shl, shl, shl, shl, shl, shl, ts, shl} - }; + /* kc ss sn sgl slr clr clrs sr ts shl shlr + */ +/*no_effect*/ {kc, ss, sn, sgl, slr, clr, clrs, sr, ts, shl, shlr}, +/*wp_silent*/ {ss, ss, sn, ss, ss, ss, ss, sr, ts, shl, shlr}, +/*wp_noisy*/ {sn, sn, sn, sn, sn, sn, sn, sr, ts, shl, shlr}, +/*bp_nostop*/ {sgl, ss, sn, sgl, slr, clrs, clrs, sr, ts, shl, shlr}, +/*bp_silent*/ {ss, ss, sn, ss, ss, ss, ss, sr, ts, shl, shlr}, +/*bp_noisy*/ {sn, sn, sn, sn, sn, sn, sn, sr, ts, shl, shlr}, +/*long_jump*/ {slr, ss, sn, slr, err, err, err, sr, ts, shl, shlr}, +/*long_resume*/ {clr, ss, sn, clrs, err, err, err, sr, ts, shl, shlr}, +/*step_resume*/ {sr, sr, sr, sr, sr, sr, sr, sr, ts, shl, shlr}, +/*through_sig*/ {ts, ts, ts, ts, ts, ts, ts, ts, ts, shl, shlr}, +/*shlib*/ {shl, shl, shl, shl, shl, shl, shl, shl, ts, shl, shlr}, +/*catch_shlib*/ {shlr, shlr, shlr, shlr, shlr, shlr, shlr, shlr, ts, shlr, shlr} + }; + #undef kc #undef ss #undef sn @@ -1659,6 +2362,7 @@ bpstat_what (bs) #undef sr #undef ts #undef shl +#undef shlr enum bpstat_what_main_action current_action = BPSTAT_WHAT_KEEP_CHECKING; struct bpstat_what retval; @@ -1672,6 +2376,9 @@ bpstat_what (bs) continue; switch (bs->breakpoint_at->type) { + case bp_none: + continue; + case bp_breakpoint: case bp_hardware_breakpoint: case bp_until: @@ -1726,6 +2433,43 @@ bpstat_what (bs) case bp_shlib_event: bs_class = shlib_event; break; + case bp_catch_load: + case bp_catch_unload: + /* Only if this catchpoint triggered should we cause the + step-out-of-dld behaviour. Otherwise, we ignore this + catchpoint. */ + if (bs->stop) + bs_class = catch_shlib_event; + else + bs_class = no_effect; + break; + case bp_catch_fork: + case bp_catch_vfork: + case bp_catch_exec: + if (bs->stop) + { + if (bs->print) + bs_class = bp_noisy; + else + bs_class = bp_silent; + } + else + /* There was a catchpoint, but we're not stopping. This requires + no further action. */ + bs_class = no_effect; + break; + case bp_catch_catch: + if (!bs->stop || CURRENT_EXCEPTION_KIND != EX_EVENT_CATCH) + bs_class = bp_nostop; + else if (bs->stop) + bs_class = bs->print ? bp_noisy : bp_silent; + break; + case bp_catch_throw: + if (!bs->stop || CURRENT_EXCEPTION_KIND != EX_EVENT_THROW) + bs_class = bp_nostop; + else if (bs->stop) + bs_class = bs->print ? bp_noisy : bp_silent; + break; case bp_call_dummy: /* Make sure the action is stop (silent or noisy), so infrun.c pops the dummy frame. */ @@ -1752,11 +2496,93 @@ bpstat_should_step () return 1; return 0; } + +/* Nonzero if there are enabled hardware watchpoints. */ +int +bpstat_have_active_hw_watchpoints () +{ + struct breakpoint *b; + ALL_BREAKPOINTS (b) + if ((b->enable == enabled) && + (b->inserted) && + ((b->type == bp_hardware_watchpoint) || + (b->type == bp_read_watchpoint) || + (b->type == bp_access_watchpoint))) + return 1; + return 0; +} + +/* Given a bpstat that records zero or more triggered eventpoints, this + function returns another bpstat which contains only the catchpoints + on that first list, if any. */ +void +bpstat_get_triggered_catchpoints (ep_list, cp_list) + bpstat ep_list; + bpstat * cp_list; +{ + struct bpstats root_bs[1]; + bpstat bs = root_bs; + struct breakpoint * ep; + char * dll_pathname; + + bpstat_clear (cp_list); + root_bs->next = NULL; + + for (; ep_list != NULL; ep_list = ep_list->next ) + { + /* Is this eventpoint a catchpoint? If not, ignore it. */ + ep = ep_list->breakpoint_at; + if (ep == NULL) + break; + if ((ep->type != bp_catch_load) && + (ep->type != bp_catch_unload) && + (ep->type != bp_catch_catch) && + (ep->type != bp_catch_throw)) /* pai: (temp) ADD fork/vfork here!! */ + continue; + + /* Yes; add it to the list. */ + bs = bpstat_alloc (ep, bs); + *bs = *ep_list; + bs->next = NULL; + bs = root_bs->next; + +#if defined(SOLIB_ADD) + /* Also, for each triggered catchpoint, tag it with the name of + the library that caused this trigger. (We copy the name now, + because it's only guaranteed to be available NOW, when the + catchpoint triggers. Clients who may wish to know the name + later must get it from the catchpoint itself.) */ + if (ep->triggered_dll_pathname != NULL) + free (ep->triggered_dll_pathname); + if (ep->type == bp_catch_load) + dll_pathname = SOLIB_LOADED_LIBRARY_PATHNAME (inferior_pid); + else + dll_pathname = SOLIB_UNLOADED_LIBRARY_PATHNAME (inferior_pid); +#else + dll_pathname = NULL; +#endif + if (dll_pathname) + { + ep->triggered_dll_pathname = (char *) xmalloc (strlen (dll_pathname) + 1); + strcpy (ep->triggered_dll_pathname, dll_pathname); + } + else + ep->triggered_dll_pathname = NULL; + } + + *cp_list = bs; +} + /* Print information on breakpoint number BNUM, or -1 if all. If WATCHPOINTS is zero, process only breakpoints; if WATCHPOINTS is nonzero, process only watchpoints. */ +typedef struct { + enum bptype type; + char * description; +} ep_type_description_t; + static void breakpoint_1 (bnum, allflag) int bnum; @@ -1767,14 +2593,33 @@ breakpoint_1 (bnum, allflag) register struct symbol *sym; CORE_ADDR last_addr = (CORE_ADDR)-1; int found_a_breakpoint = 0; - static char *bptypes[] = {"breakpoint", "hw breakpoint", - "until", "finish", "watchpoint", - "hw watchpoint", "read watchpoint", - "acc watchpoint", "longjmp", - "longjmp resume", "step resume", - "sigtramp", - "watchpoint scope", "call dummy", - "shlib events" }; + static ep_type_description_t bptypes[] = + { + {bp_none, "?deleted?"}, + {bp_breakpoint, "breakpoint"}, + {bp_hardware_breakpoint, "hw breakpoint"}, + {bp_until, "until"}, + {bp_finish, "finish"}, + {bp_watchpoint, "watchpoint"}, + {bp_hardware_watchpoint, "hw watchpoint"}, + {bp_read_watchpoint, "read watchpoint"}, + {bp_access_watchpoint, "acc watchpoint"}, + {bp_longjmp, "longjmp"}, + {bp_longjmp_resume, "longjmp resume"}, + {bp_step_resume, "step resume"}, + {bp_through_sigtramp, "sigtramp"}, + {bp_watchpoint_scope, "watchpoint scope"}, + {bp_call_dummy, "call dummy"}, + {bp_shlib_event, "shlib events"}, + {bp_catch_load, "catch load"}, + {bp_catch_unload, "catch unload"}, + {bp_catch_fork, "catch fork"}, + {bp_catch_vfork, "catch vfork"}, + {bp_catch_exec, "catch exec"}, + {bp_catch_catch, "catch catch"}, + {bp_catch_throw, "catch throw"} + }; + static char *bpdisps[] = {"del", "dstp", "dis", "keep"}; static char bpenables[] = "nyn"; char wrap_indent[80]; @@ -1786,6 +2631,13 @@ breakpoint_1 (bnum, allflag) /* We only print out user settable breakpoints unless the allflag is set. */ if (!allflag && b->type != bp_breakpoint + && b->type != bp_catch_load + && b->type != bp_catch_unload + && b->type != bp_catch_fork + && b->type != bp_catch_vfork + && b->type != bp_catch_exec + && b->type != bp_catch_catch + && b->type != bp_catch_throw && b->type != bp_hardware_breakpoint && b->type != bp_watchpoint && b->type != bp_read_watchpoint @@ -1820,7 +2672,11 @@ breakpoint_1 (bnum, allflag) annotate_field (0); printf_filtered ("%-3d ", b->number); annotate_field (1); - printf_filtered ("%-14s ", bptypes[(int)b->type]); + if ((int)b->type > (sizeof(bptypes)/sizeof(bptypes[0]))) + error ("bptypes table does not describe type #%d.", (int)b->type); + if ((int)b->type != bptypes[(int)b->type].type) + error ("bptypes table does not describe type #%d?", (int)b->type); + printf_filtered ("%-14s ", bptypes[(int)b->type].description); annotate_field (2); printf_filtered ("%-4s ", bpdisps[(int)b->disposition]); annotate_field (3); @@ -1841,6 +2697,51 @@ breakpoint_1 (bnum, allflag) annotate_field (5); print_expression (b->exp, gdb_stdout); break; + + case bp_catch_load: + case bp_catch_unload: + /* Field 4, the address, is omitted (which makes the columns + not line up too nicely with the headers, but the effect + is relatively readable). */ + annotate_field (5); + if (b->dll_pathname == NULL) + printf_filtered (" "); + else + printf_filtered ("library \"%s\" ", b->dll_pathname); + break; + + case bp_catch_fork: + case bp_catch_vfork: + /* Field 4, the address, is omitted (which makes the columns + not line up too nicely with the headers, but the effect + is relatively readable). */ + annotate_field (5); + if (b->forked_inferior_pid != 0) + printf_filtered ("process %d ", b->forked_inferior_pid); + break; + + case bp_catch_exec: + /* Field 4, the address, is omitted (which makes the columns + not line up too nicely with the headers, but the effect + is relatively readable). */ + annotate_field (5); + if (b->exec_pathname != NULL) + printf_filtered ("program \"%s\" ", b->exec_pathname); + break; + case bp_catch_catch: + /* Field 4, the address, is omitted (which makes the columns + not line up too nicely with the headers, but the effect + is relatively readable). */ + annotate_field (5); + printf_filtered ("exception catch "); + break; + case bp_catch_throw: + /* Field 4, the address, is omitted (which makes the columns + not line up too nicely with the headers, but the effect + is relatively readable). */ + annotate_field (5); + printf_filtered ("exception throw "); + break; case bp_breakpoint: case bp_hardware_breakpoint: @@ -1885,6 +2786,9 @@ breakpoint_1 (bnum, allflag) break; } + if (b->thread != -1) + printf_filtered (" thread %d", b->thread ); + printf_filtered ("\n"); if (b->frame) @@ -1914,9 +2818,12 @@ breakpoint_1 (bnum, allflag) if (show_breakpoint_hit_counts && b->hit_count) { /* FIXME should make an annotation for this */ - - printf_filtered ("\tbreakpoint already hit %d time%s\n", - b->hit_count, (b->hit_count == 1 ? "" : "s")); + if (ep_is_catchpoint (b)) + printf_filtered ("\tcatchpoint"); + else + printf_filtered ("\tbreakpoint"); + printf_filtered (" already hit %d time%s\n", + b->hit_count, (b->hit_count == 1 ? "" : "s")); } if (b->ignore_count) @@ -1971,7 +2878,7 @@ breakpoints_info (bnum_exp, from_tty) #if MAINTENANCE_CMDS /* ARGSUSED */ -static void +void maintenance_info_breakpoints (bnum_exp, from_tty) char *bnum_exp; int from_tty; @@ -2013,7 +2920,7 @@ describe_other_breakpoints (pc, section) printf_filtered ("%d%s%s ", b->number, - ((b->enable == disabled || b->enable == shlib_disabled) + ((b->enable == disabled || b->enable == shlib_disabled || b->enable == call_disabled) ? " (disabled)" : ""), (others > 1) ? "," : ((others == 1) ? " and" : "")); } @@ -2057,6 +2964,7 @@ check_duplicates (address, section) ALL_BREAKPOINTS (b) if (b->enable != disabled && b->enable != shlib_disabled + && b->enable != call_disabled && b->address == address && (overlay_debugging == 0 || b->section == section)) { @@ -2100,6 +3008,10 @@ set_raw_breakpoint (sal) b->ignore_count = 0; b->commands = NULL; b->frame = 0; + b->dll_pathname = NULL; + b->triggered_dll_pathname = NULL; + b->forked_inferior_pid = 0; + b->exec_pathname = NULL; /* Add this breakpoint to the end of the chain so that a list of breakpoints will come out in order @@ -2214,26 +3126,244 @@ create_solib_event_breakpoint (address) b->type = bp_shlib_event; } +void +disable_breakpoints_in_shlibs () +{ + struct breakpoint * b; + int disabled_shlib_breaks = 0; + + /* See also: insert_breakpoints, under DISABLE_UNSETTABLE_BREAK. */ + ALL_BREAKPOINTS (b) + { +#if defined (PC_SOLIB) + if (((b->type == bp_breakpoint) || + (b->type == bp_hardware_breakpoint)) && + (b->enable != shlib_disabled) && + (b->enable != call_disabled) && + ! b->duplicate && + PC_SOLIB (b->address)) + { + b->enable = shlib_disabled; + if (!disabled_shlib_breaks) + { + target_terminal_ours_for_output (); + printf_filtered ("Temporarily disabling shared library breakpoints:\n"); + } + disabled_shlib_breaks = 1; + printf_filtered ("%d ", b->number); + } +#endif + } + if (disabled_shlib_breaks) + printf_filtered ("\n"); +} + /* Try to reenable any breakpoints in shared libraries. */ void re_enable_breakpoints_in_shlibs () { struct breakpoint *b; - ALL_BREAKPOINTS (b) - if (b->enable == shlib_disabled) - { - char buf[1]; + ALL_BREAKPOINTS (b) + if (b->enable == shlib_disabled) + { + char buf[1]; + + /* Do not reenable the breakpoint if the shared library + is still not mapped in. */ + if (target_read_memory (b->address, buf, 1) == 0) + b->enable = enabled; + } +} + +#endif + +static void +create_solib_load_unload_event_breakpoint (hookname, tempflag, dll_pathname, cond_string, bp_kind) + char * hookname; + int tempflag; + char * dll_pathname; + char * cond_string; + enum bptype bp_kind; +{ + struct breakpoint * b; + struct symtabs_and_lines sals; + struct symtab_and_line sal; + struct cleanup * old_chain; + struct cleanup * canonical_strings_chain = NULL; + int i; + char * addr_start = hookname; + char * addr_end = NULL; + char ** canonical = (char **) NULL; + int thread = -1; /* All threads. */ + + /* Set a breakpoint on the specified hook. */ + sals = decode_line_1 (&hookname, 1, (struct symtab *) NULL, 0, &canonical); + addr_end = hookname; + + if (sals.nelts == 0) + { + warning ("Unable to set a breakpoint on dynamic linker callback."); + warning ("Suggest linking with /opt/langtools/lib/end.o."); + warning ("GDB will be unable to track shl_load/shl_unload calls"); + return; + } + if (sals.nelts != 1) + { + warning ("Unable to set a unique breakpoint on dynamic linker callback."); + warning ("GDB will be unable to track shl_load/shl_unload calls"); + return; + } + + /* Make sure that all storage allocated in decode_line_1 gets freed in case + the following errors out. */ + old_chain = make_cleanup (free, sals.sals); + if (canonical != (char **)NULL) + { + make_cleanup (free, canonical); + canonical_strings_chain = make_cleanup (null_cleanup, 0); + if (canonical[0] != NULL) + make_cleanup (free, canonical[0]); + } + + resolve_sal_pc (&sals.sals[0]); + + /* Remove the canonical strings from the cleanup, they are needed below. */ + if (canonical != (char **)NULL) + discard_cleanups (canonical_strings_chain); + + b = set_raw_breakpoint (sals.sals[0]); + set_breakpoint_count (breakpoint_count + 1); + b->number = breakpoint_count; + b->cond = NULL; + b->cond_string = (cond_string == NULL) ? NULL : savestring (cond_string, strlen (cond_string)); + b->thread = thread; + + if (canonical != (char **)NULL && canonical[0] != NULL) + b->addr_string = canonical[0]; + else if (addr_start) + b->addr_string = savestring (addr_start, addr_end - addr_start); + + b->enable = enabled; + b->disposition = tempflag ? del : donttouch; + + if (dll_pathname == NULL) + b->dll_pathname = NULL; + else + { + b->dll_pathname = (char *) xmalloc (strlen (dll_pathname) + 1); + strcpy (b->dll_pathname, dll_pathname); + } + b->type = bp_kind; + + mention (b); + do_cleanups (old_chain); +} + +void +create_solib_load_event_breakpoint (hookname, tempflag, dll_pathname, cond_string) + char * hookname; + int tempflag; + char * dll_pathname; + char * cond_string; +{ + create_solib_load_unload_event_breakpoint (hookname, + tempflag, + dll_pathname, + cond_string, + bp_catch_load); +} + +void +create_solib_unload_event_breakpoint (hookname, tempflag, dll_pathname, cond_string) + char * hookname; + int tempflag; + char * dll_pathname; + char * cond_string; +{ + create_solib_load_unload_event_breakpoint (hookname, + tempflag, + dll_pathname, + cond_string, + bp_catch_unload); +} + +static void +create_fork_vfork_event_catchpoint (tempflag, cond_string, bp_kind) + int tempflag; + char * cond_string; + enum bptype bp_kind; +{ + struct symtab_and_line sal; + struct breakpoint * b; + int thread = -1; /* All threads. */ + + INIT_SAL(&sal); + sal.pc = 0; + sal.symtab = NULL; + sal.line = 0; + + b = set_raw_breakpoint (sal); + set_breakpoint_count (breakpoint_count + 1); + b->number = breakpoint_count; + b->cond = NULL; + b->cond_string = (cond_string == NULL) ? NULL : savestring (cond_string, strlen (cond_string)); + b->thread = thread; + b->addr_string = NULL; + b->enable = enabled; + b->disposition = tempflag ? del : donttouch; + b->forked_inferior_pid = 0; + + b->type = bp_kind; + + mention (b); +} + +void +create_fork_event_catchpoint (tempflag, cond_string) + int tempflag; + char * cond_string; +{ + create_fork_vfork_event_catchpoint (tempflag, cond_string, bp_catch_fork); +} + +void +create_vfork_event_catchpoint (tempflag, cond_string) + int tempflag; + char * cond_string; +{ + create_fork_vfork_event_catchpoint (tempflag, cond_string, bp_catch_vfork); +} + +void +create_exec_event_catchpoint (tempflag, cond_string) + int tempflag; + char * cond_string; +{ + struct symtab_and_line sal; + struct breakpoint * b; + int thread = -1; /* All threads. */ + + INIT_SAL(&sal); + sal.pc = 0; + sal.symtab = NULL; + sal.line = 0; + + b = set_raw_breakpoint (sal); + set_breakpoint_count (breakpoint_count + 1); + b->number = breakpoint_count; + b->cond = NULL; + b->cond_string = (cond_string == NULL) ? NULL : savestring (cond_string, strlen (cond_string)); + b->thread = thread; + b->addr_string = NULL; + b->enable = enabled; + b->disposition = tempflag ? del : donttouch; + + b->type = bp_catch_exec; - /* Do not reenable the breakpoint if the shared library - is still not mapped in. */ - if (target_read_memory (b->address, buf, 1) == 0) - b->enable = enabled; - } + mention (b); } -#endif - static int hw_breakpoint_used_count() { @@ -2277,8 +3407,7 @@ hw_watchpoint_used_count(type, other_type_used) breakpoint at the target of the jmp_buf. FIXME - This ought to be done by setting a temporary breakpoint that gets - deleted automatically... -*/ + deleted automatically... */ void set_longjmp_resume_breakpoint(pc, frame) @@ -2301,6 +3430,47 @@ set_longjmp_resume_breakpoint(pc, frame) } } +void +disable_watchpoints_before_interactive_call_start () +{ + struct breakpoint * b; + + ALL_BREAKPOINTS (b) + { + if (((b->type == bp_watchpoint) + || (b->type == bp_hardware_watchpoint) + || (b->type == bp_read_watchpoint) + || (b->type == bp_access_watchpoint) + || ep_is_exception_catchpoint (b)) + && (b->enable == enabled)) + { + b->enable = call_disabled; + check_duplicates (b->address, b->section); + } + } +} + +void +enable_watchpoints_after_interactive_call_stop () +{ + struct breakpoint * b; + + ALL_BREAKPOINTS (b) + { + if (((b->type == bp_watchpoint) + || (b->type == bp_hardware_watchpoint) + || (b->type == bp_read_watchpoint) + || (b->type == bp_access_watchpoint) + || ep_is_exception_catchpoint (b)) + && (b->enable == call_disabled)) + { + b->enable = enabled; + check_duplicates (b->address, b->section); + } + } +} + + /* Set a breakpoint that will evaporate an end of command at address specified by SAL. Restrict it to frame FRAME if FRAME is nonzero. */ @@ -2346,6 +3516,9 @@ mention (b) switch (b->type) { + case bp_none: + printf_filtered ("(apparently deleted?) Eventpoint %d: ", b->number); + break; case bp_watchpoint: printf_filtered ("Watchpoint %d: ", b->number); print_expression (b->exp, gdb_stdout); @@ -2359,7 +3532,7 @@ mention (b) print_expression (b->exp, gdb_stdout); break; case bp_access_watchpoint: - printf_filtered ("Hardware access(read/write) watchpoint %d: ",b->number); + printf_filtered ("Hardware access (read/write) watchpoint %d: ",b->number); print_expression (b->exp, gdb_stdout); break; case bp_breakpoint: @@ -2370,6 +3543,30 @@ mention (b) printf_filtered ("Hardware assisted breakpoint %d", b->number); say_where = 1; break; + case bp_catch_load: + case bp_catch_unload: + printf_filtered ("Catchpoint %d (%s %s)", + b->number, + (b->type == bp_catch_load) ? "load" : "unload", + (b->dll_pathname != NULL) ? b->dll_pathname : ""); + break; + case bp_catch_fork: + case bp_catch_vfork: + printf_filtered ("Catchpoint %d (%s)", + b->number, + (b->type == bp_catch_fork) ? "fork" : "vfork"); + break; + case bp_catch_exec: + printf_filtered ("Catchpoint %d (exec)", + b->number); + break; + case bp_catch_catch: + case bp_catch_throw: + printf_filtered ("Catchpoint %d (%s)", + b->number, + (b->type == bp_catch_catch) ? "catch" : "throw"); + break; + case bp_until: case bp_finish: case bp_longjmp: @@ -2391,6 +3588,8 @@ mention (b) if (b->source_file) printf_filtered (": file %s, line %d.", b->source_file, b->line_number); + TUIDO(((TuiOpaqueFuncPtr)tui_vAllSetHasBreakAt, b, 1)); + TUIDO(((TuiOpaqueFuncPtr)tuiUpdateAllExecInfos)); } printf_filtered ("\n"); } @@ -2497,6 +3696,24 @@ break_command_1 (arg, flag, from_tty) int toklen; resolve_sal_pc (&sals.sals[i]); + + /* It's possible for the PC to be nonzero, but still an illegal + value on some targets. + + For example, on HP-UX if you start gdb, and before running the + inferior you try to set a breakpoint on a shared library function + "foo" where the inferior doesn't call "foo" directly but does + pass its address to another function call, then we do find a + minimal symbol for the "foo", but it's address is invalid. + (Appears to be an index into a table that the loader sets up + when the inferior is run.) + + Give the target a chance to bless sals.sals[i].pc before we + try to make a breakpoint for it. */ + if (PC_REQUIRES_RUN_BEFORE_USE(sals.sals[i].pc)) + { + error ("Cannot break on %s without a running program.", addr_start); + } tok = arg; @@ -2588,6 +3805,174 @@ break_command_1 (arg, flag, from_tty) do_cleanups (old_chain); } +static void +break_at_finish_at_depth_command_1 (arg, flag, from_tty) + char *arg; + int flag; + int from_tty; +{ + struct frame_info *frame; + CORE_ADDR low, high, selected_pc = 0; + char *extra_args, *level_arg, *addr_string; + int extra_args_len = 0, if_arg = 0; + + if (!arg || + (arg[0] == 'i' && arg[1] == 'f' && (arg[2] == ' ' || arg[2] == '\t'))) + { + + if (default_breakpoint_valid) + { + if (selected_frame) + { + selected_pc = selected_frame->pc; + if (arg) + if_arg = 1; + } + else + error ("No selected frame."); + } + else + error ("No default breakpoint address now."); + } + else + { + extra_args = strchr (arg, ' '); + if (extra_args) + { + extra_args++; + extra_args_len = strlen (extra_args); + level_arg = (char *) xmalloc (extra_args - arg); + strncpy (level_arg, arg, extra_args - arg - 1); + level_arg[extra_args - arg - 1] = '\0'; + } + else + { + level_arg = (char *) xmalloc (strlen (arg) + 1); + strcpy (level_arg, arg); + } + + frame = parse_frame_specification (level_arg); + if (frame) + selected_pc = frame->pc; + else + selected_pc = 0; + } + if (if_arg) + { + extra_args = arg; + extra_args_len = strlen (arg); + } + + if (selected_pc) + { + if (find_pc_partial_function(selected_pc, (char **)NULL, &low, &high)) + { + addr_string = (char *) xmalloc (26 + extra_args_len); + if (extra_args_len) + sprintf (addr_string, "*0x%x %s", high, extra_args); + else + sprintf (addr_string, "*0x%x", high); + break_command_1 (addr_string, flag, from_tty); + free (addr_string); + } + else + error ("No function contains the specified address"); + } + else + error ("Unable to set breakpoint at procedure exit"); +} + + +static void +break_at_finish_command_1 (arg, flag, from_tty) + char *arg; + int flag; + int from_tty; +{ + char *addr_string, *break_string, *beg_addr_string; + CORE_ADDR low, high; + struct symtabs_and_lines sals; + struct symtab_and_line sal; + struct cleanup *old_chain; + char *extra_args; + int extra_args_len = 0; + int i, if_arg = 0; + + if (!arg || + (arg[0] == 'i' && arg[1] == 'f' && (arg[2] == ' ' || arg[2] == '\t'))) + { + if (default_breakpoint_valid) + { + if (selected_frame) + { + addr_string = (char *) xmalloc (15); + sprintf (addr_string, "*0x%x", selected_frame->pc); + if (arg) + if_arg = 1; + } + else + error ("No selected frame."); + } + else + error ("No default breakpoint address now."); + } + else + { + addr_string = (char *) xmalloc (strlen (arg) + 1); + strcpy (addr_string, arg); + } + + if (if_arg) + { + extra_args = arg; + extra_args_len = strlen (arg); + } + else + if (arg) + { + /* get the stuff after the function name or address */ + extra_args = strchr (arg, ' '); + if (extra_args) + { + extra_args++; + extra_args_len = strlen (extra_args); + } + } + + sals.sals = NULL; + sals.nelts = 0; + + beg_addr_string = addr_string; + sals = decode_line_1 (&addr_string, 1, (struct symtab *)NULL, 0, + (char ***)NULL); + + free (beg_addr_string); + old_chain = make_cleanup (free, sals.sals); + for (i = 0; (i < sals.nelts); i++) + { + sal = sals.sals[i]; + if (find_pc_partial_function (sal.pc, (char **)NULL, &low, &high)) + { + break_string = (char *) xmalloc (extra_args_len + 26); + if (extra_args_len) + sprintf (break_string, "*0x%x %s", high, extra_args); + else + sprintf (break_string, "*0x%x", high); + break_command_1 (break_string, flag, from_tty); + free(break_string); + } + else + error ("No function contains the specified address"); + } + if (sals.nelts > 1) + { + printf_filtered ("Multiple breakpoints were set.\n"); + printf_filtered ("Use the \"delete\" command to delete unwanted breakpoints.\n"); + } + do_cleanups(old_chain); +} + + /* Helper function for break_command_1 and disassemble_command. */ void @@ -2646,7 +4031,23 @@ break_command (arg, from_tty) break_command_1 (arg, 0, from_tty); } -static void +void +break_at_finish_command (arg, from_tty) + char *arg; + int from_tty; +{ + break_at_finish_command_1 (arg, 0, from_tty); +} + +void +break_at_finish_at_depth_command (arg, from_tty) + char *arg; + int from_tty; +{ + break_at_finish_at_depth_command_1 (arg, 0, from_tty); +} + +void tbreak_command (arg, from_tty) char *arg; int from_tty; @@ -2654,6 +4055,14 @@ tbreak_command (arg, from_tty) break_command_1 (arg, BP_TEMPFLAG, from_tty); } +void +tbreak_at_finish_command (arg, from_tty) + char *arg; + int from_tty; +{ + break_at_finish_command_1 (arg, BP_TEMPFLAG, from_tty); +} + static void hbreak_command (arg, from_tty) char *arg; @@ -2670,9 +4079,87 @@ thbreak_command (arg, from_tty) break_command_1 (arg, (BP_TEMPFLAG | BP_HARDWAREFLAG), from_tty); } +static void +stop_command (arg, from_tty) + char *arg; + int from_tty; +{ + printf_filtered ("Specify the type of breakpoint to set.\n\ +Usage: stop in \n\ + stop at \n"); +} + +static void +stopin_command (arg, from_tty) + char *arg; + int from_tty; +{ + int badInput = 0; + + if (arg == (char *)NULL) + badInput = 1; + else if (*arg != '*') + { + char *argptr = arg; + int hasColon = 0; + + /* look for a ':'. If this is a line number specification, then say + it is bad, otherwise, it should be an address or function/method + name */ + while (*argptr && !hasColon) + { + hasColon = (*argptr == ':'); + argptr++; + } + + if (hasColon) + badInput = (*argptr != ':'); /* Not a class::method */ + else + badInput = isdigit(*arg); /* a simple line number */ + } + + if (badInput) + printf_filtered("Usage: stop in \n"); + else + break_command_1 (arg, 0, from_tty); +} + +static void +stopat_command (arg, from_tty) + char *arg; + int from_tty; +{ + int badInput = 0; + + if (arg == (char *)NULL || *arg == '*') /* no line number */ + badInput = 1; + else + { + char *argptr = arg; + int hasColon = 0; + + /* look for a ':'. If there is a '::' then get out, otherwise + it is probably a line number. */ + while (*argptr && !hasColon) + { + hasColon = (*argptr == ':'); + argptr++; + } + + if (hasColon) + badInput = (*argptr == ':'); /* we have class::method */ + else + badInput = !isdigit(*arg); /* not a line number */ + } + + if (badInput) + printf_filtered("Usage: stop at \n"); + else + break_command_1 (arg, 0, from_tty); +} + /* ARGSUSED */ -/* accessflag: 0: watch write, 1: watch read, 2: watch access(read or write) -*/ +/* accessflag: 0: watch write, 1: watch read, 2: watch access(read or write) */ static void watch_command_1 (arg, accessflag, from_tty) char *arg; @@ -2745,6 +4232,28 @@ watch_command_1 (arg, accessflag, from_tty) if (target_resources_ok < 0 && bp_type != bp_hardware_watchpoint) error ("Target resources have been allocated for other types of watchpoints."); } + +#if defined(HPUXHPPA) + /* ??rehrauer: DTS #CHFts23014 notes that on HP-UX if you set a h/w + watchpoint before the "run" command, the inferior dies with a e.g., + SIGILL once you start it. I initially believed this was due to a + bad interaction between page protection traps and the initial + startup sequence by the dynamic linker. + + However, I tried avoiding that by having HP-UX's implementation of + TARGET_CAN_USE_HW_WATCHPOINT return FALSE if there was no inferior_pid + yet, which forced slow watches before a "run" or "attach", and it + still fails somewhere in the startup code. + + Until I figure out what's happening, I'm disallowing watches altogether + before the "run" or "attach" command. We'll tell the user they must + set watches after getting the program started. */ + if (! target_has_execution) + { + warning ("can't do that without a running program; try \"break main\", \"run\" first"); + return; + } +#endif /* HPUXHPPA */ /* Now set up the breakpoint. */ b = set_raw_breakpoint (sal); @@ -2818,11 +4327,20 @@ watch_command_1 (arg, accessflag, from_tty) in hardware. If the watchpoint can not be handled in hardware return zero. */ +#if !defined(TARGET_REGION_SIZE_OK_FOR_HW_WATCHPOINT) +#define TARGET_REGION_SIZE_OK_FOR_HW_WATCHPOINT(byte_size) \ + ((byte_size) <= (REGISTER_SIZE)) +#endif + static int can_use_hardware_watchpoint (v) struct value *v; { int found_memory_cnt = 0; + + /* Did the user specifically forbid us to use hardware watchpoints? */ + if (! can_use_hw_watchpoints) + return 0; /* Make sure all the intermediate values are in memory. Also make sure we found at least one memory expression. Guards against watch 0x12345, @@ -2832,7 +4350,7 @@ can_use_hardware_watchpoint (v) { if (v->lval == lval_memory) { - if (TYPE_LENGTH (VALUE_TYPE (v)) <= REGISTER_SIZE) + if (TARGET_REGION_SIZE_OK_FOR_HW_WATCHPOINT (TYPE_LENGTH (VALUE_TYPE (v)))) found_memory_cnt++; } else if (v->lval != not_lval && v->modifiable == 0) @@ -2952,7 +4470,10 @@ struct sal_chain struct symtab_and_line sal; }; -#if 0 +/* Not really used -- invocation in handle_gnu_4_16_catch_command + had been commented out in the v.4.16 sources, and stays + disabled there now because "catch NAME" syntax isn't allowed. + pai/1997-07-11 */ /* This isn't used; I don't know what it was for. */ /* For each catch clause identified in ARGS, run FUNCTION with that clause as an argument. */ @@ -3012,7 +4533,6 @@ map_catch_names (args, function) while (*p == ' ' || *p == '\t') p++; } } -#endif /* 0 */ /* This shares a lot of code with `print_frame_label_vars' from stack.c. */ @@ -3101,37 +4621,420 @@ get_catch_sals (this_level_only) if (sal_chain && this_level_only) break; - /* After handling the function's top-level block, stop. - Don't continue to its superblock, the block of - per-file symbols. */ - if (BLOCK_FUNCTION (block)) - break; - block = BLOCK_SUPERBLOCK (block); + /* After handling the function's top-level block, stop. + Don't continue to its superblock, the block of + per-file symbols. */ + if (BLOCK_FUNCTION (block)) + break; + block = BLOCK_SUPERBLOCK (block); + } + + if (sal_chain) + { + struct sal_chain *tmp_chain; + + /* Count the number of entries. */ + for (index = 0, tmp_chain = sal_chain; tmp_chain; + tmp_chain = tmp_chain->next) + index++; + + sals.nelts = index; + sals.sals = (struct symtab_and_line *) + xmalloc (index * sizeof (struct symtab_and_line)); + for (index = 0; sal_chain; sal_chain = sal_chain->next, index++) + sals.sals[index] = sal_chain->sal; + } + + return sals; +} + +static void +ep_skip_leading_whitespace (s) + char ** s; +{ + if ((s == NULL) || (*s == NULL)) + return; + while (isspace(**s)) + *s += 1; +} + +/* This function examines a string, and attempts to find a token + that might be an event name in the leading characters. If a + possible match is found, a pointer to the last character of + the token is returned. Else, NULL is returned. */ +static char * +ep_find_event_name_end (arg) + char * arg; +{ + char * s = arg; + char * event_name_end = NULL; + + /* If we could depend upon the presense of strrpbrk, we'd use that... */ + if (arg == NULL) + return NULL; + + /* We break out of the loop when we find a token delimiter. + Basically, we're looking for alphanumerics and underscores; + anything else delimites the token. */ + while (*s != '\0') + { + if (! isalnum(*s) && (*s != '_')) + break; + event_name_end = s; + s++; + } + + return event_name_end; +} + + +/* This function attempts to parse an optional "if " clause + from the arg string. If one is not found, it returns NULL. + + Else, it returns a pointer to the condition string. (It does not + attempt to evaluate the string against a particular block.) And, + it updates arg to point to the first character following the parsed + if clause in the arg string. */ +static char * +ep_parse_optional_if_clause (arg) + char ** arg; +{ + char * cond_string; + + if (((*arg)[0] != 'i') || ((*arg)[1] != 'f') || !isspace((*arg)[2])) + return NULL; + + /* Skip the "if" keyword. */ + (*arg) += 2; + + /* Skip any extra leading whitespace, and record the start of the + condition string. */ + ep_skip_leading_whitespace (arg); + cond_string = *arg; + + /* Assume that the condition occupies the remainder of the arg string. */ + (*arg) += strlen (cond_string); + + return cond_string; +} + +/* This function attempts to parse an optional filename from the arg + string. If one is not found, it returns NULL. + + Else, it returns a pointer to the parsed filename. (This function + makes no attempt to verify that a file of that name exists, or is + accessible.) And, it updates arg to point to the first character + following the parsed filename in the arg string. + + Note that clients needing to preserve the returned filename for + future access should copy it to their own buffers. */ +static char * +ep_parse_optional_filename (arg) + char ** arg; +{ + static char filename [1024]; + char * arg_p = *arg; + int i; + char c; + + if ((*arg_p == '\0') || isspace (*arg_p)) + return NULL; + + for (i=0; ; i++) + { + c = *arg_p; + if (isspace (c)) + c = '\0'; + filename[i] = c; + if (c == '\0') + break; + arg_p++; + } + *arg = arg_p; + + return filename; +} + +/* Commands to deal with catching events, such as signals, exceptions, + process start/exit, etc. */ + +typedef enum {catch_fork, catch_vfork} catch_fork_kind; + +static void +catch_fork_command_1 (fork_kind, arg, tempflag, from_tty) + catch_fork_kind fork_kind; + char * arg; + int tempflag; + int from_tty; +{ + char * cond_string = NULL; + + ep_skip_leading_whitespace (&arg); + + /* The allowed syntax is: + catch [v]fork + catch [v]fork if + + First, check if there's an if clause. */ + cond_string = ep_parse_optional_if_clause (&arg); + + if ((*arg != '\0') && !isspace (*arg)) + error ("Junk at end of arguments."); + + /* If this target supports it, create a fork or vfork catchpoint + and enable reporting of such events. */ + switch (fork_kind) { + case catch_fork : + create_fork_event_catchpoint (tempflag, cond_string); + break; + case catch_vfork : + create_vfork_event_catchpoint (tempflag, cond_string); + break; + default : + error ("unsupported or unknown fork kind; cannot catch it"); + break; + } +} + +static void +catch_exec_command_1 (arg, tempflag, from_tty) + char * arg; + int tempflag; + int from_tty; +{ + char * cond_string = NULL; + + ep_skip_leading_whitespace (&arg); + + /* The allowed syntax is: + catch exec + catch exec if + + First, check if there's an if clause. */ + cond_string = ep_parse_optional_if_clause (&arg); + + if ((*arg != '\0') && !isspace (*arg)) + error ("Junk at end of arguments."); + + /* If this target supports it, create an exec catchpoint + and enable reporting of such events. */ + create_exec_event_catchpoint (tempflag, cond_string); +} + +#if defined(SOLIB_ADD) +static void +catch_load_command_1 (arg, tempflag, from_tty) + char * arg; + int tempflag; + int from_tty; +{ + char * dll_pathname = NULL; + char * cond_string = NULL; + + ep_skip_leading_whitespace (&arg); + + /* The allowed syntax is: + catch load + catch load if + catch load + catch load if + + The user is not allowed to specify the after an + if clause. + + We'll ignore the pathological case of a file named "if". + + First, check if there's an if clause. If so, then there + cannot be a filename. */ + cond_string = ep_parse_optional_if_clause (&arg); + + /* If there was an if clause, then there cannot be a filename. + Else, there might be a filename and an if clause. */ + if (cond_string == NULL) + { + dll_pathname = ep_parse_optional_filename (&arg); + ep_skip_leading_whitespace (&arg); + cond_string = ep_parse_optional_if_clause (&arg); + } + + if ((*arg != '\0') && !isspace (*arg)) + error ("Junk at end of arguments."); + + /* Create a load breakpoint that only triggers when a load of + the specified dll (or any dll, if no pathname was specified) + occurs. */ + SOLIB_CREATE_CATCH_LOAD_HOOK (inferior_pid, tempflag, dll_pathname, cond_string); +} + +static void +catch_unload_command_1 (arg, tempflag, from_tty) + char * arg; + int tempflag; + int from_tty; +{ + char * dll_pathname = NULL; + char * cond_string = NULL; + + ep_skip_leading_whitespace (&arg); + + /* The allowed syntax is: + catch unload + catch unload if + catch unload + catch unload if + + The user is not allowed to specify the after an + if clause. + + We'll ignore the pathological case of a file named "if". + + First, check if there's an if clause. If so, then there + cannot be a filename. */ + cond_string = ep_parse_optional_if_clause (&arg); + + /* If there was an if clause, then there cannot be a filename. + Else, there might be a filename and an if clause. */ + if (cond_string == NULL) + { + dll_pathname = ep_parse_optional_filename (&arg); + ep_skip_leading_whitespace (&arg); + cond_string = ep_parse_optional_if_clause (&arg); } + + if ((*arg != '\0') && !isspace (*arg)) + error ("Junk at end of arguments."); + + /* Create an unload breakpoint that only triggers when an unload of + the specified dll (or any dll, if no pathname was specified) + occurs. */ + SOLIB_CREATE_CATCH_UNLOAD_HOOK (inferior_pid, tempflag, dll_pathname, cond_string); +} +#endif /* SOLIB_ADD */ - if (sal_chain) +/* Commands to deal with catching exceptions. */ + +/* Set a breakpoint at the specified callback routine for an + exception event callback */ + +static void +create_exception_catchpoint (tempflag, cond_string, ex_event, sal) + int tempflag; + char * cond_string; + enum exception_event_kind ex_event; + struct symtab_and_line * sal; +{ + struct breakpoint * b; + int i; + int thread = -1; /* All threads. */ + + if (!sal) /* no exception support? */ + return; + + b = set_raw_breakpoint (*sal); + set_breakpoint_count (breakpoint_count + 1); + b->number = breakpoint_count; + b->cond = NULL; + b->cond_string = (cond_string == NULL) ? NULL : savestring (cond_string, strlen (cond_string)); + b->thread = thread; + b->addr_string = NULL; + b->enable = enabled; + b->disposition = tempflag ? del : donttouch; + switch (ex_event) { - struct sal_chain *tmp_chain; + case EX_EVENT_THROW: + b->type = bp_catch_throw; + break; + case EX_EVENT_CATCH: + b->type = bp_catch_catch; + break; + default: /* error condition */ + b->type = bp_none; + b->enable = disabled; + error ("Internal error -- invalid catchpoint kind"); + } + mention (b); +} - /* Count the number of entries. */ - for (index = 0, tmp_chain = sal_chain; tmp_chain; - tmp_chain = tmp_chain->next) - index++; +/* Deal with "catch catch" and "catch throw" commands */ - sals.nelts = index; - sals.sals = (struct symtab_and_line *) - xmalloc (index * sizeof (struct symtab_and_line)); - for (index = 0; sal_chain; sal_chain = sal_chain->next, index++) - sals.sals[index] = sal_chain->sal; +static void +catch_exception_command_1 (ex_event, arg, tempflag, from_tty) + enum exception_event_kind ex_event; + char * arg; + int tempflag; + int from_tty; +{ + char * cond_string = NULL; + struct symtab_and_line * sal = NULL; + + ep_skip_leading_whitespace (&arg); + + cond_string = ep_parse_optional_if_clause (&arg); + + if ((*arg != '\0') && !isspace (*arg)) + error ("Junk at end of arguments."); + + if ((ex_event != EX_EVENT_THROW) && + (ex_event != EX_EVENT_CATCH)) + error ("Unsupported or unknown exception event; cannot catch it"); + + /* See if we can find a callback routine */ + sal = target_enable_exception_callback (ex_event, 1); + + if (sal) + { + /* We have callbacks from the runtime system for exceptions. + Set a breakpoint on the sal found, if no errors */ + if (sal != (struct symtab_and_line *) -1) + create_exception_catchpoint (tempflag, cond_string, ex_event, sal); + else + return; /* something went wrong with setting up callbacks */ + } + else + { + /* No callbacks from runtime system for exceptions. + Try GNU C++ exception breakpoints using labels in debug info. */ + if (ex_event == EX_EVENT_CATCH) + { + handle_gnu_4_16_catch_command (arg, tempflag, from_tty); + } + else if (ex_event == EX_EVENT_THROW) + { + /* Set a breakpoint on __raise_exception () */ + + fprintf_filtered (gdb_stderr, "Unsupported with this platform/compiler combination.\n"); + fprintf_filtered (gdb_stderr, "Perhaps you can achieve the effect you want by setting\n"); + fprintf_filtered (gdb_stderr, "a breakpoint on __raise_exception().\n"); + } } +} - return sals; +/* Cover routine to allow wrapping target_enable_exception_catchpoints + inside a catch_errors */ + +static struct symtab_and_line * +cover_target_enable_exception_callback (args) + args_for_catchpoint_enable * args; +{ + target_enable_exception_callback (args->kind, args->enable); } -/* Commands to deal with catching exceptions. */ + + +/* This is the original v.4.16 and earlier version of the + catch_command_1() function. Now that other flavours of "catch" + have been introduced, and since exception handling can be handled + in other ways (through target ops) also, this is used only for the + GNU C++ exception handling system. + Note: Only the "catch" flavour of GDB 4.16 is handled here. The + "catch NAME" is now no longer allowed in catch_command_1(). Also, + there was no code in GDB 4.16 for "catch throw". + + Called from catch_exception_command_1 () */ + static void -catch_command_1 (arg, tempflag, from_tty) +handle_gnu_4_16_catch_command (arg, tempflag, from_tty) char *arg; int tempflag; int from_tty; @@ -3161,7 +5064,13 @@ catch_command_1 (arg, tempflag, from_tty) { /* Grab selected catch clauses. */ error ("catch NAME not implemented"); + #if 0 + /* Not sure why this code has been disabled. I'm leaving + it disabled. We can never come here now anyway + since we don't allow the "catch NAME" syntax. + pai/1997-07-11 */ + /* This isn't used; I don't know what it was for. */ sals = map_catch_names (arg, catch_breakpoint); #endif @@ -3197,7 +5106,13 @@ catch_command_1 (arg, tempflag, from_tty) b = set_raw_breakpoint (sal); set_breakpoint_count (breakpoint_count + 1); b->number = breakpoint_count; - b->type = bp_breakpoint; + b->type = bp_breakpoint; /* Important -- this is an ordinary breakpoint. + For platforms with callback support for exceptions, + create_exception_catchpoint() will create special + bp types (bp_catch_catch and bp_catch_throw), and + there is code in insert_breakpoints() and elsewhere + that depends on that. */ + b->cond = cond; b->enable = enabled; b->disposition = tempflag ? del : donttouch; @@ -3213,6 +5128,156 @@ catch_command_1 (arg, tempflag, from_tty) free ((PTR)sals.sals); } +#if 0 +/* This creates a temporary internal breakpoint + just to placate infrun */ +static struct breakpoint * +create_temp_exception_breakpoint (pc) + CORE_ADDR pc; +{ + struct symtab_and_line sal; + struct breakpoint *b; + + INIT_SAL(&sal); + sal.pc = pc; + sal.symtab = NULL; + sal.line = 0; + + b = set_raw_breakpoint (sal); + if (!b) + error ("Internal error -- couldn't set temp exception breakpoint"); + + b->type = bp_breakpoint; + b->disposition = del; + b->enable = enabled; + b->silent = 1; + b->number = internal_breakpoint_number--; + return b; +} +#endif + +static void +catch_command_1 (arg, tempflag, from_tty) + char *arg; + int tempflag; + int from_tty; +{ + + /* The first argument may be an event name, such as "start" or "load". + If so, then handle it as such. If it doesn't match an event name, + then attempt to interpret it as an exception name. (This latter is + the v4.16-and-earlier GDB meaning of the "catch" command.) + + First, try to find the bounds of what might be an event name. */ + char * arg1_start = arg; + char * arg1_end; + int arg1_length; + + if (arg1_start == NULL) + { + /* Old behaviour was to use pre-v-4.16 syntax */ + /* catch_throw_command_1 (arg1_start, tempflag, from_tty); */ + /* return; */ + /* Now, this is not allowed */ + error ("Catch requires an event name"); + + } + arg1_end = ep_find_event_name_end (arg1_start); + if (arg1_end == NULL) + error ("catch requires an event"); + arg1_length = arg1_end + 1 - arg1_start; + + /* Try to match what we found against known event names. */ + if (strncmp (arg1_start, "signal", arg1_length) == 0) + { + error ("Catch of signal not yet implemented"); + } + else if (strncmp (arg1_start, "catch", arg1_length) == 0) + { + catch_exception_command_1 (EX_EVENT_CATCH, arg1_end+1, tempflag, from_tty); + } + else if (strncmp (arg1_start, "throw", arg1_length) == 0) + { + catch_exception_command_1 (EX_EVENT_THROW, arg1_end+1, tempflag, from_tty); + } + else if (strncmp (arg1_start, "thread_start", arg1_length) == 0) + { + error ("Catch of thread_start not yet implemented"); + } + else if (strncmp (arg1_start, "thread_exit", arg1_length) == 0) + { + error ("Catch of thread_exit not yet implemented"); + } + else if (strncmp (arg1_start, "thread_join", arg1_length) == 0) + { + error ("Catch of thread_join not yet implemented"); + } + else if (strncmp (arg1_start, "start", arg1_length) == 0) + { + error ("Catch of start not yet implemented"); + } + else if (strncmp (arg1_start, "exit", arg1_length) == 0) + { + error ("Catch of exit not yet implemented"); + } + else if (strncmp (arg1_start, "fork", arg1_length) == 0) + { +#if defined(CHILD_INSERT_FORK_CATCHPOINT) + catch_fork_command_1 (catch_fork, arg1_end+1, tempflag, from_tty); +#else + error ("Catch of fork not yet implemented"); +#endif + } + else if (strncmp (arg1_start, "vfork", arg1_length) == 0) + { +#if defined(CHILD_INSERT_VFORK_CATCHPOINT) + catch_fork_command_1 (catch_vfork, arg1_end+1, tempflag, from_tty); +#else + error ("Catch of vfork not yet implemented"); +#endif + } + else if (strncmp (arg1_start, "exec", arg1_length) == 0) + { +#if defined(CHILD_INSERT_EXEC_CATCHPOINT) + catch_exec_command_1 (arg1_end+1, tempflag, from_tty); +#else + error ("Catch of exec not yet implemented"); +#endif + } + else if (strncmp (arg1_start, "load", arg1_length) == 0) + { +#if defined(SOLIB_ADD) + catch_load_command_1 (arg1_end+1, tempflag, from_tty); +#else + error ("Catch of load not implemented"); +#endif + } + else if (strncmp (arg1_start, "unload", arg1_length) == 0) + { +#if defined(SOLIB_ADD) + catch_unload_command_1 (arg1_end+1, tempflag, from_tty); +#else + error ("Catch of load not implemented"); +#endif + } + else if (strncmp (arg1_start, "stop", arg1_length) == 0) + { + error ("Catch of stop not yet implemented"); + } + + /* This doesn't appear to be an event name */ + + else + { + /* Pre-v.4.16 behaviour was to treat the argument + as the name of an exception */ + /* catch_throw_command_1 (arg1_start, tempflag, from_tty); */ + /* Now this is not allowed */ + error ("Unknown event kind specified for catch"); + + } +} + /* Used by the gui, could be made a worker for other things. */ struct breakpoint * @@ -3264,12 +5329,23 @@ catch_command (arg, from_tty) catch_command_1 (arg, 0, from_tty); } + +static void +tcatch_command (arg, from_tty) + char *arg; + int from_tty; +{ + catch_command_1 (arg, 1, from_tty); +} + + static void clear_command (arg, from_tty) char *arg; int from_tty; { register struct breakpoint *b, *b1; + int default_match; struct symtabs_and_lines sals; struct symtab_and_line sal; register struct breakpoint *found; @@ -3278,6 +5354,7 @@ clear_command (arg, from_tty) if (arg) { sals = decode_line_spec (arg, 1); + default_match = 0; } else { @@ -3286,30 +5363,59 @@ clear_command (arg, from_tty) INIT_SAL (&sal); /* initialize to zeroes */ sal.line = default_breakpoint_line; sal.symtab = default_breakpoint_symtab; + sal.pc = default_breakpoint_address; if (sal.symtab == 0) error ("No source file specified."); sals.sals[0] = sal; sals.nelts = 1; + + default_match = 1; } + /* For each line spec given, delete bps which correspond + to it. We do this in two loops: the first loop looks at + the initial bp(s) in the chain which should be deleted, + the second goes down the rest of the chain looking ahead + one so it can take those bps off the chain without messing + up the chain. */ + + for (i = 0; i < sals.nelts; i++) { /* If exact pc given, clear bpts at that pc. - But if sal.pc is zero, clear all bpts on specified line. */ + If line given (pc == 0), clear all bpts on specified line. + If defaulting, clear all bpts on default line + or at default pc. + + defaulting sal.pc != 0 tests to do + + 0 1 pc + 1 1 pc _and_ line + 0 0 line + 1 0 */ + sal = sals.sals[i]; found = (struct breakpoint *) 0; + while (breakpoint_chain - && (sal.pc - ? (breakpoint_chain->address == sal.pc && - (overlay_debugging == 0 || - breakpoint_chain->section == sal.section)) - : (breakpoint_chain->source_file != NULL - && sal.symtab != NULL - && STREQ (breakpoint_chain->source_file, - sal.symtab->filename) - && breakpoint_chain->line_number == sal.line))) + /* Why don't we check here that this is not + a watchpoint, etc., as we do below? + I can't make it fail, but don't know + what's stopping the failure: a watchpoint + of the same address as "sal.pc" should + wind up being deleted. */ + + && ( ((sal.pc && (breakpoint_chain->address == sal.pc)) && + (overlay_debugging == 0 || + breakpoint_chain->section == sal.section)) + || ((default_match || (0 == sal.pc)) + && breakpoint_chain->source_file != NULL + && sal.symtab != NULL + && STREQ (breakpoint_chain->source_file, sal.symtab->filename) + && breakpoint_chain->line_number == sal.line))) + { b1 = breakpoint_chain; breakpoint_chain = b1->next; @@ -3318,19 +5424,23 @@ clear_command (arg, from_tty) } ALL_BREAKPOINTS (b) - while (b->next - && b->next->type != bp_watchpoint - && b->next->type != bp_hardware_watchpoint - && b->next->type != bp_read_watchpoint - && b->next->type != bp_access_watchpoint - && (sal.pc - ? (b->next->address == sal.pc && - (overlay_debugging == 0 || - b->next->section == sal.section)) - : (b->next->source_file != NULL - && sal.symtab != NULL - && STREQ (b->next->source_file, sal.symtab->filename) - && b->next->line_number == sal.line))) + + while (b->next + && b->next->type != bp_none + && b->next->type != bp_watchpoint + && b->next->type != bp_hardware_watchpoint + && b->next->type != bp_read_watchpoint + && b->next->type != bp_access_watchpoint + && ( ((sal.pc && (b->next->address == sal.pc)) && + (overlay_debugging == 0 || + b->next->section == sal.section)) + || ((default_match || (0 == sal.pc)) + && b->next->source_file != NULL + && sal.symtab != NULL + && STREQ (b->next->source_file, sal.symtab->filename) + && b->next->line_number == sal.line))) + + { b1 = b->next; b->next = b1->next; @@ -3392,15 +5502,56 @@ delete_breakpoint (bpt) register struct breakpoint *b; register bpstat bs; + if (bpt == NULL) + error ("Internal error (attempted to delete a NULL breakpoint)"); + + + /* Has this bp already been deleted? This can happen because multiple + lists can hold pointers to bp's. bpstat lists are especial culprits. + + One example of this happening is a watchpoint's scope bp. When the + scope bp triggers, we notice that the watchpoint is out of scope, and + delete it. We also delete its scope bp. But the scope bp is marked + "auto-deleting", and is already on a bpstat. That bpstat is then + checked for auto-deleting bp's, which are deleted. + + A real solution to this problem might involve reference counts in bp's, + and/or giving them pointers back to their referencing bpstat's, and + teaching delete_breakpoint to only free a bp's storage when no more + references were extent. A cheaper bandaid was chosen. */ + if (bpt->type == bp_none) + return; + if (delete_breakpoint_hook) delete_breakpoint_hook (bpt); if (bpt->inserted) - remove_breakpoint (bpt); + remove_breakpoint (bpt, mark_uninserted); if (breakpoint_chain == bpt) breakpoint_chain = bpt->next; + /* If we have callback-style exception catchpoints, don't go through + the adjustments to the C++ runtime library etc. if the inferior + isn't actually running. target_enable_exception_callback for a + null target ops vector gives an undesirable error message, so we + check here and avoid it. Since currently (1997-09-17) only HP-UX aCC's + exceptions are supported in this way, it's OK for now. FIXME */ + if (ep_is_exception_catchpoint (bpt) && target_has_execution) + { + static char message1[] = "Error in deleting catchpoint %d:\n"; + static char message[sizeof (message1) + 30]; + args_for_catchpoint_enable args; + + sprintf (message, message1, bpt->number); /* Format possible error msg */ + args.kind = bpt->type == bp_catch_catch ? EX_EVENT_CATCH : EX_EVENT_THROW; + args.enable = 0; + (void) catch_errors ((int (*) PARAMS ((char *))) cover_target_enable_exception_callback, + (char *) &args, + message, RETURN_MASK_ALL); + } + + ALL_BREAKPOINTS (b) if (b->next == bpt) { @@ -3408,20 +5559,44 @@ delete_breakpoint (bpt) break; } + /* Before turning off the visuals for the bp, check to see that + there are no other bps at the same address. */ + if (tui_version) + { + int clearIt; + + ALL_BREAKPOINTS (b) + { + clearIt = (b->address != bpt->address); + if (!clearIt) + break; + } + + if (clearIt) + { + TUIDO(((TuiOpaqueFuncPtr)tui_vAllSetHasBreakAt, bpt, 0)); + TUIDO(((TuiOpaqueFuncPtr)tuiUpdateAllExecInfos)); + } + } + check_duplicates (bpt->address, bpt->section); /* If this breakpoint was inserted, and there is another breakpoint at the same address, we need to insert the other breakpoint. */ if (bpt->inserted && bpt->type != bp_hardware_watchpoint && bpt->type != bp_read_watchpoint - && bpt->type != bp_access_watchpoint) + && bpt->type != bp_access_watchpoint + && bpt->type != bp_catch_fork + && bpt->type != bp_catch_vfork + && bpt->type != bp_catch_exec) { ALL_BREAKPOINTS (b) if (b->address == bpt->address && b->section == bpt->section && !b->duplicate && b->enable != disabled - && b->enable != shlib_disabled) + && b->enable != shlib_disabled + && b->enable != call_disabled) { int val; val = target_insert_breakpoint (b->address, b->shadow_contents); @@ -3451,13 +5626,33 @@ delete_breakpoint (bpt) value_free (bpt->val); if (bpt->source_file != NULL) free (bpt->source_file); + if (bpt->dll_pathname != NULL) + free (bpt->dll_pathname); + if (bpt->triggered_dll_pathname != NULL) + free (bpt->triggered_dll_pathname); + if (bpt->exec_pathname != NULL) + free (bpt->exec_pathname); /* Be sure no bpstat's are pointing at it after it's been freed. */ /* FIXME, how can we find all bpstat's? We just check stop_bpstat for now. */ for (bs = stop_bpstat; bs; bs = bs->next) if (bs->breakpoint_at == bpt) - bs->breakpoint_at = NULL; + { + bs->breakpoint_at = NULL; + + /* we'd call bpstat_clear_actions, but that free's stuff and due + to the multiple pointers pointing to one item with no + reference counts found anywhere through out the bpstat's (how + do you spell fragile?), we don't want to free things twice -- + better a memory leak than a corrupt malloc pool! */ + bs->commands = NULL; + bs->old_val = NULL; + } + /* On the chance that someone will soon try again to delete this same + bp, we mark it as deleted before freeing its storage. */ + bpt->type = bp_none; + free ((PTR)bpt); } @@ -3477,7 +5672,9 @@ delete_command (arg, from_tty) have to be deleted with an explicit breakpoint number argument. */ ALL_BREAKPOINTS (b) { - if (b->type != bp_call_dummy && b->number >= 0) + if (b->type != bp_call_dummy && + b->type != bp_shlib_event && + b->number >= 0) breaks_to_delete = 1; } @@ -3487,7 +5684,9 @@ delete_command (arg, from_tty) { ALL_BREAKPOINTS_SAFE (b, temp) { - if (b->type != bp_call_dummy && b->number >= 0) + if (b->type != bp_call_dummy && + b->type != bp_shlib_event && + b->number >= 0) delete_breakpoint (b); } } @@ -3513,8 +5712,13 @@ breakpoint_re_set_one (bint) switch (b->type) { + case bp_none: + warning ("attempted to reset apparently deleted breakpoint #%d?\n", b->number); + return 0; case bp_breakpoint: case bp_hardware_breakpoint: + case bp_catch_load: + case bp_catch_unload: if (b->addr_string == NULL) { /* Anything without a string can't be re-set. */ @@ -3568,7 +5772,10 @@ breakpoint_re_set_one (bint) strlen (sals.sals[i].symtab->filename)); b->line_number = sals.sals[i].line; b->address = sals.sals[i].pc; - check_duplicates (b->address, b->section); + + /* Used to check for duplicates here, but that can + cause trouble, as it doesn't check for disable + breakpoints. */ mention (b); @@ -3578,6 +5785,12 @@ breakpoint_re_set_one (bint) } b->section = sals.sals[i].section; b->enable = save_enable; /* Restore it, this worked. */ + + + /* Now that this is re-enabled, check_duplicates + can be used. */ + check_duplicates (b->address, b->section); + } free ((PTR)sals.sals); break; @@ -3618,7 +5831,17 @@ breakpoint_re_set_one (bint) mention (b); value_free_to_mark (mark); break; - + case bp_catch_catch: + case bp_catch_throw: + break; + /* We needn't really do anything to reset these, since the mask + that requests them is unaffected by e.g., new libraries being + loaded. */ + case bp_catch_fork: + case bp_catch_vfork: + case bp_catch_exec: + break; + default: printf_filtered ("Deleting unknown breakpoint type %d\n", b->type); /* fall through */ @@ -3663,7 +5886,7 @@ breakpoint_re_set () ALL_BREAKPOINTS_SAFE (b, temp) { sprintf (message, message1, b->number); /* Format possible error msg */ - catch_errors (breakpoint_re_set_one, (char *) b, message, + catch_errors ((int (*) PARAMS ((char *))) breakpoint_re_set_one, (char *) b, message, RETURN_MASK_ALL); } set_language (save_language); @@ -3689,6 +5912,21 @@ breakpoint_re_set () If from_tty is nonzero, it prints a message to that effect, which ends with a period (no newline). */ +/* Reset the thread number of this breakpoint: + + - If the breakpoint is for all threads, leave it as-is. + - Else, reset it to the current thread for inferior_pid. */ +void +breakpoint_re_set_thread (b) + struct breakpoint * b; +{ + if (b->thread != -1) + { + if (in_thread_list (inferior_pid)) + b->thread = pid_to_thread_id (inferior_pid); + } +} + void set_ignore_count (bptnum, count, from_tty) int bptnum, count, from_tty; @@ -3821,7 +6059,17 @@ disable_command (args, from_tty) ALL_BREAKPOINTS (bpt) switch (bpt->type) { + case bp_none: + warning ("attempted to disable apparently deleted breakpoint #%d?\n", bpt->number); + continue; case bp_breakpoint: + case bp_catch_load: + case bp_catch_unload: + case bp_catch_fork: + case bp_catch_vfork: + case bp_catch_exec: + case bp_catch_catch: + case bp_catch_throw: case bp_hardware_breakpoint: case bp_watchpoint: case bp_hardware_watchpoint: @@ -3868,7 +6116,12 @@ do_enable_breakpoint (bpt, disposition) if (bpt->exp_valid_block != NULL) { struct frame_info *fr = - find_frame_addr_in_frame_chain (bpt->watchpoint_frame); + + /* Ensure that we have the current frame. Else, this + next query may pessimistically be answered as, "No, + not within current scope". */ + get_current_frame (); + fr = find_frame_addr_in_frame_chain (bpt->watchpoint_frame); if (fr == NULL) { printf_filtered ("\ @@ -3915,7 +6168,7 @@ have been allocated for other watchpoints.\n", bpt->number); } if (save_selected_frame_level >= 0) - select_frame (save_selected_frame, save_selected_frame_level); + select_and_print_frame (save_selected_frame, save_selected_frame_level); value_free_to_mark (mark); } if (modify_breakpoint_hook) @@ -3944,7 +6197,17 @@ enable_command (args, from_tty) ALL_BREAKPOINTS (bpt) switch (bpt->type) { + case bp_none: + warning ("attempted to enable apparently deleted breakpoint #%d?\n", bpt->number); + continue; case bp_breakpoint: + case bp_catch_load: + case bp_catch_unload: + case bp_catch_fork: + case bp_catch_vfork: + case bp_catch_exec: + case bp_catch_catch: + case bp_catch_throw: case bp_hardware_breakpoint: case bp_watchpoint: case bp_hardware_watchpoint: @@ -4015,6 +6278,8 @@ decode_line_spec_1 (string, funfirstline) void _initialize_breakpoint () { + struct cmd_list_element *c; + breakpoint_chain = 0; /* Don't bother to call set_breakpoint_count. $bpnum isn't useful before a breakpoint is set. */ @@ -4023,6 +6288,8 @@ _initialize_breakpoint () add_com ("ignore", class_breakpoint, ignore_command, "Set ignore-count of breakpoint number N to COUNT.\n\ Usage is `ignore N COUNT'."); + if (xdb_commands) + add_com_alias("bc", "ignore", class_breakpoint, 1); add_com ("commands", class_breakpoint, commands_command, "Set commands to be executed when a breakpoint is hit.\n\ @@ -4043,6 +6310,9 @@ expression to be evaluated whenever breakpoint N is reached. "); Like \"break\" except the breakpoint is only temporary,\n\ so it will be deleted when hit. Equivalent to \"break\" followed\n\ by using \"enable delete\" on the breakpoint number."); + add_com("txbreak", class_breakpoint, tbreak_at_finish_command, + "Set temporary breakpoint at procedure exit. Either there should\n\ +be no argument or the argument must be a depth.\n"); add_com ("hbreak", class_breakpoint, hbreak_command, "Set a hardware assisted breakpoint. Args like \"break\" command.\n\ @@ -4061,6 +6331,13 @@ With no subcommand, breakpoints are enabled until you command otherwise.\n\ This is used to cancel the effect of the \"disable\" command.\n\ With a subcommand you can enable temporarily.", &enablelist, "enable ", 1, &cmdlist); + if (xdb_commands) + add_com("ab", class_breakpoint, enable_command, + "Enable some breakpoints.\n\ +Give breakpoint numbers (separated by spaces) as arguments.\n\ +With no subcommand, breakpoints are enabled until you command otherwise.\n\ +This is used to cancel the effect of the \"disable\" command.\n\ +With a subcommand you can enable temporarily."); add_com_alias ("en", "enable", class_breakpoint, 1); @@ -4099,6 +6376,12 @@ A disabled breakpoint is not forgotten, but has no effect until reenabled.", &disablelist, "disable ", 1, &cmdlist); add_com_alias ("dis", "disable", class_breakpoint, 1); add_com_alias ("disa", "disable", class_breakpoint, 1); + if (xdb_commands) + add_com("sb", class_breakpoint, disable_command, + "Disable some breakpoints.\n\ +Arguments are breakpoint numbers with spaces in between.\n\ +To disable all breakpoints, give no argument.\n\ +A disabled breakpoint is not forgotten, but has no effect until reenabled."); add_cmd ("breakpoints", class_alias, disable_command, "Disable some breakpoints.\n\ @@ -4117,6 +6400,11 @@ Also a prefix command for deletion of other GDB objects.\n\ The \"unset\" command is also an alias for \"delete\".", &deletelist, "delete ", 1, &cmdlist); add_com_alias ("d", "delete", class_breakpoint, 1); + if (xdb_commands) + add_com ("db", class_breakpoint, delete_command, + "Delete some breakpoints.\n\ +Arguments are breakpoint numbers with spaces in between.\n\ +To delete all breakpoints, give no argument.\n"); add_cmd ("breakpoints", class_alias, delete_command, "Delete some breakpoints or auto-display expressions.\n\ @@ -4153,6 +6441,56 @@ Do \"help breakpoints\" for info on other commands dealing with breakpoints.", N add_com_alias ("bre", "break", class_run, 1); add_com_alias ("brea", "break", class_run, 1); + add_com("xbreak", class_breakpoint, break_at_finish_command, + concat("Set breakpoint at procedure exit. \n\ +Argument may be function name, or \"*\" and an address.\n\ +If function is specified, break at end of code for that function.\n\ +If an address is specified, break at the end of the function that contains \n\ +that exact address.\n", +"With no arg, uses current execution address of selected stack frame.\n\ +This is useful for breaking on return to a stack frame.\n\ +\n\ +Multiple breakpoints at one place are permitted, and useful if conditional.\n\ +\n\ +Do \"help breakpoints\" for info on other commands dealing with breakpoints.", NULL)); + add_com_alias ("xb", "xbreak", class_breakpoint, 1); + add_com_alias ("xbr", "xbreak", class_breakpoint, 1); + add_com_alias ("xbre", "xbreak", class_breakpoint, 1); + add_com_alias ("xbrea", "xbreak", class_breakpoint, 1); + + if (xdb_commands) + { + add_com_alias ("ba", "break", class_breakpoint, 1); + add_com_alias ("bu", "ubreak", class_breakpoint, 1); + add_com ("bx", class_breakpoint, break_at_finish_at_depth_command, + "Set breakpoint at procedure exit. Either there should\n\ +be no argument or the argument must be a depth.\n"); + } + + if (dbx_commands) + { + add_abbrev_prefix_cmd("stop", class_breakpoint, stop_command, + "Break in function/address or break at a line in the current file.", + &stoplist, "stop ", 1, &cmdlist); + add_cmd("in", class_breakpoint, stopin_command, + "Break in function or address.\n", &stoplist); + add_cmd("at", class_breakpoint, stopat_command, + "Break at a line in the current file.\n", &stoplist); + add_com("status", class_info, breakpoints_info, + concat ("Status of user-settable breakpoints, or breakpoint number NUMBER.\n\ +The \"Type\" column indicates one of:\n\ +\tbreakpoint - normal breakpoint\n\ +\twatchpoint - watchpoint\n\ +The \"Disp\" column contains one of \"keep\", \"del\", or \"dis\" to indicate\n\ +the disposition of the breakpoint after it gets hit. \"dis\" means that the\n\ +breakpoint will be disabled. The \"Address\" and \"What\" columns indicate the\n\ +address and file/line number respectively.\n\n", +"Convenience variable \"$_\" and default examine address for \"x\"\n\ +are set to the address of the last breakpoint listed.\n\n\ +Convenience variable \"$bpnum\" contains the number of the last\n\ +breakpoint set.", NULL)); + } + add_info ("breakpoints", breakpoints_info, concat ("Status of user-settable breakpoints, or breakpoint number NUMBER.\n\ The \"Type\" column indicates one of:\n\ @@ -4165,6 +6503,21 @@ address and file/line number respectively.\n\n", "Convenience variable \"$_\" and default examine address for \"x\"\n\ are set to the address of the last breakpoint listed.\n\n\ Convenience variable \"$bpnum\" contains the number of the last\n\ +breakpoint set.", NULL)); + + if (xdb_commands) + add_com("lb", class_breakpoint, breakpoints_info, + concat ("Status of user-settable breakpoints, or breakpoint number NUMBER.\n\ +The \"Type\" column indicates one of:\n\ +\tbreakpoint - normal breakpoint\n\ +\twatchpoint - watchpoint\n\ +The \"Disp\" column contains one of \"keep\", \"del\", or \"dis\" to indicate\n\ +the disposition of the breakpoint after it gets hit. \"dis\" means that the\n\ +breakpoint will be disabled. The \"Address\" and \"What\" columns indicate the\n\ +address and file/line number respectively.\n\n", +"Convenience variable \"$_\" and default examine address for \"x\"\n\ +are set to the address of the last breakpoint listed.\n\n\ +Convenience variable \"$bpnum\" contains the number of the last\n\ breakpoint set.", NULL)); #if MAINTENANCE_CMDS @@ -4191,18 +6544,49 @@ breakpoint set.", NULL), #endif /* MAINTENANCE_CMDS */ add_com ("catch", class_breakpoint, catch_command, - "Set breakpoints to catch exceptions that are raised.\n\ -Argument may be a single exception to catch, multiple exceptions\n\ -to catch, or the default exception \"default\". If no arguments\n\ -are given, breakpoints are set at all exception handlers catch clauses\n\ -within the current scope.\n\ -\n\ -A condition specified for the catch applies to all breakpoints set\n\ -with this command\n\ + "Set catchpoints to catch events.\n\ +Raised signals may be caught:\n\ +\tcatch signal - all signals\n\ +\tcatch signal - a particular signal\n\ +Raised exceptions may be caught:\n\ +\tcatch throw - all exceptions, when thrown\n\ +\tcatch throw - a particular exception, when thrown\n\ +\tcatch catch - all exceptions, when caught\n\ +\tcatch catch - a particular exception, when caught\n\ +Thread or process events may be caught:\n\ +\tcatch thread_start - any threads, just after creation\n\ +\tcatch thread_exit - any threads, just before expiration\n\ +\tcatch thread_join - any threads, just after joins\n\ +Process events may be caught:\n\ +\tcatch start - any processes, just after creation\n\ +\tcatch exit - any processes, just before expiration\n\ +\tcatch fork - calls to fork()\n\ +\tcatch vfork - calls to vfork()\n\ +\tcatch exec - calls to exec()\n\ +Dynamically-linked library events may be caught:\n\ +\tcatch load - loads of any library\n\ +\tcatch load - loads of a particular library\n\ +\tcatch unload - unloads of any library\n\ +\tcatch unload - unloads of a particular library\n\ +The act of your program's execution stopping may also be caught:\n\ +\tcatch stop\n\n\ +C++ exceptions may be caught:\n\ +\tcatch throw - all exceptions, when thrown\n\ +\tcatch catch - all exceptions, when caught\n\ \n\ +Do \"help set follow-fork-mode\" for info on debugging your program\n\ +after a fork or vfork is caught.\n\n\ Do \"help breakpoints\" for info on other commands dealing with breakpoints."); + + add_com ("tcatch", class_breakpoint, tcatch_command, + "Set temporary catchpoints to catch events.\n\ +Args like \"catch\" command.\n\ +Like \"catch\" except the catchpoint is only temporary,\n\ +so it will be deleted when hit. Equivalent to \"catch\" followed\n\ +by using \"enable delete\" on the catchpoint number."); + +add_com ("watch", class_breakpoint, watch_command, - add_com ("watch", class_breakpoint, watch_command, "Set a watchpoint for an expression.\n\ A watchpoint stops execution of your program whenever the value of\n\ an expression changes."); @@ -4220,4 +6604,16 @@ an expression is either read or written."); add_info ("watchpoints", breakpoints_info, "Synonym for ``info breakpoints''."); + + c = add_set_cmd ("can-use-hw-watchpoints", class_support, var_zinteger, + (char *) &can_use_hw_watchpoints, + "Set debugger's willingness to use watchpoint hardware.\n\ +If zero, gdb will not use hardware for new watchpoints, even if\n\ +such is available. (However, any hardware watchpoints that were\n\ +created before setting this to nonzero, will continue to use watchpoint\n\ +hardware.)", + &setlist); + add_show_from_set (c, &showlist); + + can_use_hw_watchpoints = 1; } diff --git a/gdb/breakpoint.h b/gdb/breakpoint.h index 0aa42f59d1d..0b6fff5e70d 100644 --- a/gdb/breakpoint.h +++ b/gdb/breakpoint.h @@ -1,5 +1,5 @@ /* Data structures associated with breakpoints in GDB. - Copyright (C) 1992, 1993, 1994, 1995, 1996 Free Software Foundation, Inc. + Copyright (C) 1992, 93, 94, 95, 96, 1998 Free Software Foundation, Inc. This file is part of GDB. @@ -38,6 +38,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ possible like a single-step to wait_for_inferior). */ enum bptype { + bp_none = 0, /* Eventpoint has been deleted. */ bp_breakpoint, /* Normal breakpoint */ bp_hardware_breakpoint, /* Hardware assisted breakpoint */ bp_until, /* used by until command */ @@ -87,12 +88,50 @@ enum bptype { when these significant events occur. GDB can then re-examine the dynamic linker's data structures to discover any newly loaded dynamic libraries. */ - bp_shlib_event + bp_shlib_event, + + /* These breakpoints are used to implement the "catch load" command + on platforms whose dynamic linkers support such functionality. */ + bp_catch_load, + + /* These breakpoints are used to implement the "catch unload" command + on platforms whose dynamic linkers support such functionality. */ + bp_catch_unload, + + /* These are not really breakpoints, but are catchpoints that + implement the "catch fork", "catch vfork" and "catch exec" commands + on platforms whose kernel support such functionality. (I.e., + kernels which can raise an event when a fork or exec occurs, as + opposed to the debugger setting breakpoints on functions named + "fork" or "exec".) */ + bp_catch_fork, + bp_catch_vfork, + bp_catch_exec, + + /* These are catchpoints to implement "catch catch" and "catch throw" + commands for C++ exception handling. */ + bp_catch_catch, + bp_catch_throw, + + }; /* States of enablement of breakpoint. */ -enum enable { disabled, enabled, shlib_disabled}; +enum enable { + disabled, /* The eventpoint is inactive, and cannot trigger. */ + enabled, /* The eventpoint is active, and can trigger. */ + shlib_disabled, /* The eventpoint's address is within an unloaded solib. + The eventpoint will be automatically enabled & reset + when that solib is loaded. */ + call_disabled /* The eventpoint has been disabled while a call into + the inferior is "in flight", because some eventpoints + interfere with the implementation of a call on some + targets. The eventpoint will be automatically enabled + & reset when the call "lands" (either completes, or + stops at another eventpoint). */ +}; + /* Disposition of breakpoint. Ie: what to do after hitting it. */ @@ -205,6 +244,24 @@ struct breakpoint aborting, so you can back up to just before the abort. */ int hit_count; + /* Filename of a dynamically-linked library (dll), used for bp_catch_load + and bp_catch_unload (malloc'd), or NULL if any library is significant. */ + char * dll_pathname; + + /* Filename of a dll whose state change (e.g., load or unload) + triggered this catchpoint. This field is only vaid immediately + after this catchpoint has triggered. */ + char * triggered_dll_pathname; + + /* Process id of a child process whose forking triggered this catchpoint. + This field is only vaid immediately after this catchpoint has triggered. */ + int forked_inferior_pid; + + /* Filename of a program whose exec triggered this catchpoint. This + field is only vaid immediately after this catchpoint has triggered. */ + char * exec_pathname; + + asection *section; }; /* The following stuff is an abstract data type "bpstat" ("breakpoint status"). @@ -275,6 +332,10 @@ enum bpstat_what_main_action { keep checking. */ BPSTAT_WHAT_CHECK_SHLIBS, + /* Check the dynamic linker's data structures for new libraries, then + resume out of the dynamic linker's callback, stop and print. */ + BPSTAT_WHAT_CHECK_SHLIBS_RESUME_FROM_HOOK, + /* This is just used to keep track of how many enums there are. */ BPSTAT_WHAT_LAST }; @@ -295,6 +356,18 @@ struct bpstat_what bpstat_what PARAMS ((bpstat)); /* Find the bpstat associated with a breakpoint. NULL otherwise. */ bpstat bpstat_find_breakpoint PARAMS ((bpstat, struct breakpoint *)); +/* Find a step_resume breakpoint associated with this bpstat. + (If there are multiple step_resume bp's on the list, this function + will arbitrarily pick one.) + + It is an error to use this function if BPSTAT doesn't contain a + step_resume breakpoint. + + See wait_for_inferior's use of this function. + */ +extern struct breakpoint * +bpstat_find_step_resume_breakpoint PARAMS ((bpstat)); + /* Nonzero if a signal that we got in wait() was due to circumstances explained by the BS. */ /* Currently that is true if we have hit a breakpoint, or if there is @@ -306,6 +379,9 @@ bpstat bpstat_find_breakpoint PARAMS ((bpstat, struct breakpoint *)); just to things like whether watchpoints are set. */ extern int bpstat_should_step PARAMS ((void)); +/* Nonzero if there are enabled hardware watchpoints. */ +extern int bpstat_have_active_hw_watchpoints PARAMS ((void)); + /* Print a message indicating what happened. Returns nonzero to say that only the source line should be printed after this (zero return means print the frame as well as the source line). */ @@ -326,6 +402,12 @@ extern void bpstat_do_actions PARAMS ((bpstat *)); /* Modify BS so that the actions will not be performed. */ extern void bpstat_clear_actions PARAMS ((bpstat)); +/* Given a bpstat that records zero or more triggered eventpoints, this + function returns another bpstat which contains only the catchpoints + on that first list, if any. + */ +extern void bpstat_get_triggered_catchpoints PARAMS ((bpstat, bpstat *)); + /* Implementation: */ struct bpstats { @@ -350,6 +432,14 @@ struct bpstats bpstat_print, or -1 if it can't deal with it. */ int (*print_it) PARAMS((bpstat bs)); }; + +enum inf_context +{ + inf_starting, + inf_running, + inf_exited +}; + /* Prototypes for breakpoint-related functions. */ @@ -359,6 +449,8 @@ struct frame_info; extern int breakpoint_here_p PARAMS ((CORE_ADDR)); +extern int breakpoint_inserted_here_p PARAMS ((CORE_ADDR)); + extern int frame_in_dummy PARAMS ((struct frame_info *)); extern int breakpoint_thread_match PARAMS ((CORE_ADDR, int)); @@ -367,7 +459,8 @@ extern void until_break_command PARAMS ((char *, int)); extern void breakpoint_re_set PARAMS ((void)); -extern void clear_momentary_breakpoints PARAMS ((void)); +extern void breakpoint_re_set_thread PARAMS ((struct breakpoint *)); + extern struct breakpoint *set_momentary_breakpoint PARAMS ((struct symtab_and_line, struct frame_info *, enum bptype)); @@ -378,7 +471,7 @@ extern void set_default_breakpoint PARAMS ((int, CORE_ADDR, struct symtab *, int extern void mark_breakpoints_out PARAMS ((void)); -extern void breakpoint_init_inferior PARAMS ((void)); +extern void breakpoint_init_inferior PARAMS ((enum inf_context)); extern void delete_breakpoint PARAMS ((struct breakpoint *)); @@ -388,16 +481,80 @@ extern void breakpoint_clear_ignore_counts PARAMS ((void)); extern void break_command PARAMS ((char *, int)); +extern void tbreak_command PARAMS ((char *, int)); + extern int insert_breakpoints PARAMS ((void)); extern int remove_breakpoints PARAMS ((void)); +/* This function can be used to physically insert eventpoints from the + specified traced inferior process, without modifying the breakpoint + package's state. This can be useful for those targets which support + following the processes of a fork() or vfork() system call, when both + of the resulting two processes are to be followed. */ +extern int reattach_breakpoints PARAMS ((int)); + +/* This function can be used to update the breakpoint package's state + after an exec() system call has been executed. + + This function causes the following: + + - All eventpoints are marked "not inserted". + - All eventpoints with a symbolic address are reset such that + the symbolic address must be reevaluated before the eventpoints + can be reinserted. + - The solib breakpoints are explicitly removed from the breakpoint + list. + - A step-resume breakpoint, if any, is explicitly removed from the + breakpoint list. + - All eventpoints without a symbolic address are removed from the + breakpoint list. */ +extern void update_breakpoints_after_exec PARAMS ((void)); + +/* This function can be used to physically remove hardware breakpoints + and watchpoints from the specified traced inferior process, without + modifying the breakpoint package's state. This can be useful for + those targets which support following the processes of a fork() or + vfork() system call, when one of the resulting two processes is to + be detached and allowed to run free. + + It is an error to use this function on the process whose id is + inferior_pid. */ +extern int detach_breakpoints PARAMS ((int)); + extern void enable_longjmp_breakpoint PARAMS ((void)); extern void disable_longjmp_breakpoint PARAMS ((void)); extern void set_longjmp_resume_breakpoint PARAMS ((CORE_ADDR, struct frame_info *)); +/* These functions respectively disable or reenable all currently + enabled watchpoints. When disabled, the watchpoints are marked + call_disabled. When reenabled, they are marked enabled. + + The intended client of these functions is infcmd.c\run_stack_dummy. + + The inferior must be stopped, and all breakpoints removed, when + these functions are used. + + The need for these functions is that on some targets (e.g., HP-UX), + gdb is unable to unwind through the dummy frame that is pushed as + part of the implementation of a call command. Watchpoints can + cause the inferior to stop in places where this frame is visible, + and that can cause execution control to become very confused. + + Note that if a user sets breakpoints in an interactively call + function, the call_disabled watchpoints will have been reenabled + when the first such breakpoint is reached. However, on targets + that are unable to unwind through the call dummy frame, watches + of stack-based storage may then be deleted, because gdb will + believe that their watched storage is out of scope. (Sigh.) */ +extern void +disable_watchpoints_before_interactive_call_start PARAMS ((void)); + +extern void +enable_watchpoints_after_interactive_call_stop PARAMS ((void)); + extern void clear_breakpoint_hit_counts PARAMS ((void)); @@ -420,6 +577,28 @@ extern void create_solib_event_breakpoint PARAMS ((CORE_ADDR)); extern void remove_solib_event_breakpoints PARAMS ((void)); +extern void disable_breakpoints_in_shlibs PARAMS ((void)); + extern void re_enable_breakpoints_in_shlibs PARAMS ((void)); +extern void create_solib_load_event_breakpoint PARAMS ((char *, int, char *, char *)); + +extern void create_solib_unload_event_breakpoint PARAMS ((char *, int, char *, char *)); + +extern void create_fork_event_catchpoint PARAMS ((int, char *)); + +extern void create_vfork_event_catchpoint PARAMS ((int, char *)); + +extern void create_exec_event_catchpoint PARAMS ((int, char *)); + +/* This function returns TRUE if ep is a catchpoint. */ +extern int ep_is_catchpoint PARAMS ((struct breakpoint *)); + +/* This function returns TRUE if ep is a catchpoint of a + shared library (aka dynamically-linked library) event, + such as a library load or unload. */ +extern int ep_is_shlib_catchpoint PARAMS ((struct breakpoint *)); + +extern struct breakpoint *set_breakpoint_sal PARAMS ((struct symtab_and_line)); + #endif /* !defined (BREAKPOINT_H) */ diff --git a/gdb/buildsym.c b/gdb/buildsym.c index 7ba424eff70..f494b5417ff 100644 --- a/gdb/buildsym.c +++ b/gdb/buildsym.c @@ -244,6 +244,7 @@ finish_block (symbol, listhead, old_blocks, start, end, objfile) BLOCK_END (block) = end; /* Superblock filled in when containing block is made */ BLOCK_SUPERBLOCK (block) = NULL; + BLOCK_GCC_COMPILED (block) = processing_gcc_compilation; /* Put the block in as the value of the symbol that names it. */ @@ -276,6 +277,7 @@ finish_block (symbol, listhead, old_blocks, start, end, objfile) case LOC_UNDEF: case LOC_CONST: case LOC_STATIC: + case LOC_INDIRECT: case LOC_REGISTER: case LOC_LOCAL: case LOC_TYPEDEF: @@ -312,6 +314,7 @@ finish_block (symbol, listhead, old_blocks, start, end, objfile) case LOC_UNDEF: case LOC_CONST: case LOC_STATIC: + case LOC_INDIRECT: case LOC_REGISTER: case LOC_LOCAL: case LOC_TYPEDEF: @@ -1046,11 +1049,13 @@ push_context (desc, valu) new = &context_stack[context_stack_depth++]; new->depth = desc; new->locals = local_symbols; + new->params = param_symbols; new->old_blocks = pending_blocks; new->start_addr = valu; new->name = NULL; local_symbols = NULL; + param_symbols = NULL; return (new); } @@ -1094,6 +1099,40 @@ record_debugformat (format) current_subfile -> debugformat = savestring (format, strlen (format)); } + +/* Merge the first symbol list SRCLIST into the second symbol list + TARGETLIST by repeated calls to add_symbol_to_list(). This + procedure "frees" each link of SRCLIST by adding it to the + free_pendings list. Caller must set SRCLIST to a null list after + calling this function. + + Void return. */ + +void +merge_symbol_lists (srclist, targetlist) + struct pending ** srclist; + struct pending ** targetlist; +{ + register int i; + register struct pending * link; + + if (!srclist || !*srclist) + return; + + /* Merge in elements from current link */ + for (i=0; i < (*srclist)->nsyms; i++) + add_symbol_to_list ((*srclist)->symbol[i], targetlist); + + /* Recurse on next */ + merge_symbol_lists (&(*srclist)->next, targetlist); + + /* "Free" the current link */ + (*srclist)->next = free_pendings; + free_pendings = (*srclist); +} + + + /* Initialize anything that needs initializing when starting to read a fresh piece of a symbol file, e.g. reading in the stuff corresponding diff --git a/gdb/c-lang.c b/gdb/c-lang.c index 251b0b2c368..e7aa05574ca 100644 --- a/gdb/c-lang.c +++ b/gdb/c-lang.c @@ -245,10 +245,17 @@ c_create_fundamental_type (objfile, typeid) TARGET_CHAR_BIT / TARGET_CHAR_BIT, 0, "void", objfile); break; + case FT_BOOLEAN: + type = init_type (TYPE_CODE_BOOL, + TARGET_CHAR_BIT / TARGET_CHAR_BIT, + 0, "bool", objfile); + + break; case FT_CHAR: type = init_type (TYPE_CODE_INT, TARGET_CHAR_BIT / TARGET_CHAR_BIT, 0, "char", objfile); + TYPE_FLAGS (type) |= TYPE_FLAG_NOSIGN; break; case FT_SIGNED_CHAR: type = init_type (TYPE_CODE_INT, @@ -334,6 +341,12 @@ c_create_fundamental_type (objfile, typeid) type = init_type (TYPE_CODE_FLT, TARGET_LONG_DOUBLE_BIT / TARGET_CHAR_BIT, 0, "long double", objfile); + break; + case FT_TEMPLATE_ARG: + type = init_type (TYPE_CODE_TEMPLATE_ARG, + 0, + 0, "