From 8b93c6380e299446e645ece29bf77d26f5713529 Mon Sep 17 00:00:00 2001 From: Jason Molenda Date: Thu, 3 Feb 2000 04:14:45 +0000 Subject: [PATCH] import gdb-2000-02-02 snapshot --- gdb/ChangeLog | 29 + gdb/ChangeLog-99 | 484 ++++++- gdb/Makefile.in | 15 +- gdb/arm-tdep.c | 79 +- gdb/breakpoint.c | 373 +++++ gdb/breakpoint.h | 6 + gdb/cli-out.c | 339 +++++ gdb/cli-out.h | 27 + gdb/command.c | 102 ++ gdb/configure | 597 ++++---- gdb/configure.in | 36 + gdb/defs.h | 7 + gdb/event-top.c | 1 - gdb/gdbcmd.h | 7 + gdb/infcmd.c | 53 + gdb/infrun.c | 47 + gdb/main.c | 8 + gdb/printcmd.c | 41 + gdb/remote.c | 6 + gdb/source.c | 62 + gdb/stack.c | 104 +- gdb/symfile.c | 36 + gdb/symtab.c | 9 + gdb/testsuite/ChangeLog | 11 + gdb/testsuite/configure | 27 +- gdb/testsuite/gdb.base/ending-run.exp | 4 + gdb/testsuite/gdb.base/step-test.exp | 5 +- gdb/thread.c | 51 + gdb/top.c | 143 +- gdb/top.h | 2 + gdb/ui-out.c | 1007 ++++++++++++++ gdb/ui-out.h | 221 +++ gdb/varobj.c | 2421 +++++++++++++++++++++++++++++++++ gdb/varobj.h | 92 ++ gdb/wrapper.c | 165 +++ gdb/wrapper.h | 37 + 36 files changed, 6340 insertions(+), 314 deletions(-) create mode 100644 gdb/cli-out.c create mode 100644 gdb/cli-out.h create mode 100644 gdb/ui-out.c create mode 100644 gdb/ui-out.h create mode 100644 gdb/varobj.c create mode 100644 gdb/varobj.h create mode 100644 gdb/wrapper.c create mode 100644 gdb/wrapper.h diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 00fd900..f004ec6 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,13 @@ +2000-02-02 Fernando Nasser + + * arm-tdep.c (arm_push_arguments): Fix passing of floating point + arguments on dummy frames. + +2000-02-02 Fernando Nasser + + * arm-tdep.c (arm_pc_is_thumb_dummy): Account for large dummy frames. + (arm_pop_frame): Account fr dummy frames (as opposed to real ones). + 2000-02-01 Elena Zannoni * remote.c (getpkt_sane): New function. It is the old getpkt(), @@ -5,6 +15,11 @@ (getpkt): New function. Wrapper for getpkt_sane(), so that return value can still be ignored. +Tue Feb 1 18:47:31 2000 Andrew Cagney + + * top.c (print_gdb_version): Print ``UI_OUT'' when configured with + UI_OUT. + Tue Feb 1 00:17:12 2000 Andrew Cagney * ui-file.c, ui-file.h: Rename gdb-file.h, gdb-file.c. Rename @@ -29,6 +44,7 @@ Tue Feb 1 00:17:12 2000 Andrew Cagney target.c, target.h, top.c, top.h, typeprint.c, typeprint.h, utils.c, v850ice.c, valprint.c, valprint.h, value.h, config/pa/tm-hppa.h: Update. + * cli-out.c, cli-out.h, ui-out.c, ui-out.h, varobj.c: Update. 2000-01-31 Jason Molenda (jsm@bugshack.cygnus.com) @@ -119,6 +135,10 @@ Mon Jan 31 17:14:52 2000 Andrew Cagney 2000-01-27 Fernando Nasser + * cli-out.c (cli_filed_string): Test for NULL string. + +2000-01-27 Fernando Nasser + * infcmd.c (run_stack_dummy): Account for a random signal stopping the inferior as well as breakpoints being hit while performing an inferior function call. @@ -274,6 +294,11 @@ Thu Jan 13 23:34:17 EST 2000 Nicholas Duffek current thread, safely from within catch_errors(). (gdb_thread_select): New function. Switch threads safely. (thread_command): Use gdb_thread_select(). + Include ui-out.h. + (do_captured_list_thread_ids): New function. + (gdb_list_thread_ids): New function. + + * defs.h (gdb_thread_select, gdb_list_thread_ids): Export. 2000-01-11 Christopher Faylor @@ -329,6 +354,10 @@ Thu Jan 13 23:34:17 EST 2000 Nicholas Duffek (proc_modify_flag): add support for PR_KLC (kill on last close). (proc_[un]set_kill_on_last_close): new functions. +2000-01-07 Elena Zannoni + + * infrun.c (normal_stop): Print out thread id when we stop. + 2000-01-06 Fernando Nasser * remote.c (remote_open_1): Fix message so it does not imply a diff --git a/gdb/ChangeLog-99 b/gdb/ChangeLog-99 index 005de04..2fc778b 100644 --- a/gdb/ChangeLog-99 +++ b/gdb/ChangeLog-99 @@ -1,3 +1,10 @@ +Sun Dec 19 18:56:38 1999 Andrew Cagney + + * breakpoint.c (mention): Delete ui-out breakpoint code. Mention + calls breakpoint_create_event and that, eventually, calls + gdb_breakpoint_query which displays the breakpoint details. + (hbreak_command_wrapper, thbreak_command_wrapper): Delete. + Wed Dec 29 17:41:11 1999 Andrew Cagney * breakpoint.c (create_breakpoints, parse_breapoint_sals, @@ -70,7 +77,6 @@ Wed Dec 29 17:41:11 1999 Andrew Cagney (TARGET_REGION_SIZE_OK_FOR_HW_WATCHPOINT) define always true. * config/mips/nm-irix4.h: ditto. - 1999-12-21 Jim Blandy * Makefile.in (elf_bfd_h): Look for elf-bfd.h in BFD_SRC, not @@ -458,6 +464,22 @@ Sat Dec 11 17:52:03 1999 Andrew Cagney * breakpoint.c (print_one_breakpoint): New function. Move breakpoint print code to here. (breakpoint_1): From here. + (print_one_breakpoint): Merge in ui-out code. + (print_one_breakpoint): Add local variabls ``stb'' and + ``old_chain''. + (breakpoint_1): Use print_one_breakpoint when UI. + (print_one_breakpoint): Print breakpoint type when UI. + (breakpoint_1): Merge UI out code into non UI function. + + * ui-out.c (make_cleanup_ui_out_stream_delete): New function. Wrap + make_cleanup. + (do_stream_delete): New function. Wrap ui_out_stream_delete. + * ui-out.h (make_cleanup_ui_out_stream_delete): Declare. + +Sat Dec 11 00:12:41 1999 Andrew Cagney + + * breakpoint.c (breakpoint_1): Clone breakpoint_1 creating UI + and non-UI versions. Mon Dec 6 20:31:28 1999 Andrew Cagney @@ -616,6 +638,11 @@ Fri Dec 3 17:38:06 1999 Andrew Cagney Return size of packet or -1. (getpkt): Update. Pass in PBUFSIZ. +1999-12-02 Elena Zannoni + + * breakpoint.c (print_it_typical): Print reason for stopping in + case of bp_until. + Thu Dec 2 17:14:53 1999 Andrew Cagney * ser-pipe.c: Include for memset(). @@ -637,6 +664,11 @@ Thu Dec 2 17:14:53 1999 Andrew Cagney * valops.c (value_assign): Clarify error message. +1999-12-01 Elena Zannoni + + * stack.c (return_command_wrapper): New function, to export + return_command(). + 1999-12-01 Christopher Faylor * config/i386/tm-cygwin.h: Change tm-i386.h include back to tm-i386v.h. @@ -743,6 +775,10 @@ Thu Dec 2 17:14:53 1999 Andrew Cagney 1999-11-29 Elena Zannoni + * infrun.c (print_stop_reason): Don't print end of stepping reason + if we are in the middle of a multistep command (same condition as + in normal_stop). + * breakpoint.c (bpstat_stop_status): Don't decrease hit_count in case of a wp that has not changed. @@ -792,6 +828,14 @@ Wed Nov 24 17:07:28 1999 Andrew Cagney * Makefile.in (init.c): Add SUBDIR_INIT_FILES so that sub directories can hook in extra init files. +Wed Nov 24 11:41:01 1999 Andrew Cagney + + * ui-out.h (field_string_ftype, ui_out_field_string): Make string + parameter const. + * cli-out.c (cli_field_string): Update. + * ui-out.c (uo_field_string, ui_out_field_string, + default_field_string): Update. + 1999-11-23 Elena Zannoni * defs.h (show_load_progress): Export. @@ -799,6 +843,8 @@ Wed Nov 24 17:07:28 1999 Andrew Cagney * symfile.c (show_load_progress): New hook for download. (generic_load): Collect total size of executable to load. Call progress hook when downloading. + Add output for ui case. + (print_transfer_performance): Add output for ui case. Thu Nov 18 11:54:24 1999 Andrew Cagney @@ -813,6 +859,10 @@ Wed Nov 17 17:01:06 1999 Andrew Cagney * Makefile.in (i386-tdep.o): Update list of dependencies. +1999-11-22 Elena Zannoni + + * stack.c (print_frame_info_base): Adjust output for stepi/nexti case. + 1999-11-22 Jim Blandy * config/i386/tm-i386v.h (NUM_REGS, REGISTER_NAMES, @@ -848,6 +898,10 @@ Thu Nov 18 18:12:48 1999 Andrew Cagney (exec_file_attach), corefile.c (core_file_command, reopen_exec_file): Replace strdup with xstrdup. + * varobj.c (varobj_gen_name, c_name_of_child, c_value_of_variable, + cplus_value_of_variable): Replace strdup with xstrdup. + * ui-out.c (ui_out_table_begin): Ditto. + Mon Nov 22 12:02:47 1999 Andrew Cagney * bcache.c (print_bcache_statistics): Fix printf_filtered @@ -967,6 +1021,20 @@ Wed Nov 17 17:40:30 1999 Andrew Cagney * remote-rdi.c: Fix indentation accordingly to GNU standards. +1999-11-11 Elena Zannoni + + * breakpoint.h: Export {watch, awatch, rwatch}_command_wrapper(). + + * breakpoint.c (print_it_typical): Add output for bp_watchpoint, + bp_hardware_watchpoint, read_watchpoint, access_watchpoint cases. + (watchpoint_check): Add output for when the watchpoint goes out of + scope. + (mention): Add output for bp_watchpoint, bp_hardware_watchpoint, + read_watchpoint, access_watchpointcases. Move end of list to end + of function. + ({watch, awatch, rwatch}_command_wrapper): New functions, to + export {watch, awatch, rwatch}_command(). + Thu Oct 28 00:28:51 1999 Andrew Cagney * d10v-tdep.c (d10v_gdbarch_init): Make the d10v:ts3 the default. @@ -1058,6 +1126,8 @@ Wed Nov 10 16:47:06 1999 Andrew Cagney * corefile.c (memory_error): Use mem_fileopen instead of tui_sfileopen. Don't call error_begin. + * varobj.c (c_value_of_variable): Use mem_fileopen () and + gdb_file_xstrdup() instead of strdup and tui_sfileopen. * remote-sim.c (gdb_os_error): Rewrite using verror. Don't call error_begin. @@ -1065,6 +1135,8 @@ Wed Nov 10 14:21:43 1999 Andrew Cagney * defs.h (gdb_file_xstrdup): New function. * utils.c (gdb_file_xstrdup, do_gdb_file_xstrdup): Implement. + * ui-out.c (ui_out_stream_new): Simplify, XMALLOC doesn't return + if malloc failed. Use mem_fileopen and gdb_file_xstrdup. 1999-11-09 Stan Shebs @@ -1117,6 +1189,18 @@ Tue Nov 9 15:33:43 1999 Andrew Cagney * utils.c (floatformat_to_doublest): Fix conversion of denormals. +1999-11-08 Elena Zannoni + + * breakpoint.c (hbreak_command_wrapper): New function, to export + hbreak_command. + (thbreak_command_wrapper): New function, to export thbreak_command. + + * symtab.c (rbreak_command_wrapper): New function, to export + rbreak_command. + + * breakpoint.h (hbreak_command_wrapper, thbreak_command_wrapper, + rbreak_command_wrapper): Export. + Mon Nov 8 20:14:13 1999 Andrew Cagney * remote.c (get_memory_read_packet_size): For moment limit read @@ -1131,6 +1215,9 @@ Mon Nov 8 20:14:13 1999 Andrew Cagney Mon Nov 8 18:18:07 1999 Andrew Cagney * defs.h, utils.c (gdb_file_deallocate): Delete. + * varobj.c (varobj_get_type, c_value_of_variable): Use + make_cleanup_gdb_file_delete. + * ui-out.c (ui_out_stream_delete): Use gdb_file_delete. * corefile.c (memory_error): Use make_cleanup_gdb_file_delete. * defs.h, utils.c (gdb_file_init_astring): Delete. @@ -1139,6 +1226,8 @@ Mon Nov 8 18:18:07 1999 Andrew Cagney gdb_file_get_strbuf. (tui_file_adjust_strbuf): Rename gdb_file_adjust_strbuf. * utils.c (error_stream, error_last_message): Update. + * varobj.c (varobj_get_type, c_value_of_variable): Update. + * ui-out.c (ui_out_field_stream): Update. Mon Nov 8 16:28:00 1999 Andrew Cagney @@ -1226,6 +1315,10 @@ Sun Nov 7 18:09:54 1999 Andrew Cagney (procfs_thread_alive): Remove unused variables, conditionalize vars declarations to eliminate compiler warnings. +1999-11-05 Elena Zannoni + + * infcmd.c (print_return_value): Add output for UI. + Fri Nov 5 16:32:04 1999 Andrew Cagney * inferior.h (CALL_DUMMY_ADDRESS, CALL_DUMMY_START_OFFSET, @@ -1267,8 +1360,18 @@ Fri Nov 5 16:32:04 1999 Andrew Cagney 1999-11-04 Elena Zannoni + * breakpoint.c (print_it_typical): Print reason for stopping in + case of bp_finish. + +1999-11-04 Elena Zannoni + * infrun.c (handle_inferior_event): Add calls to print_stop_reason() for end of stepping range cases. + (print_stop_reason): Add output for END_STEPPING_RANGE, EXITED, + SIGNAL_EXITED, SIGNAL_RECEIVED cases. + + * breakpoint.c (print_it_typical): Add printing of stop reason for + bp_breakpoint case. Thu Nov 4 17:46:36 1999 Andrew Cagney @@ -1466,6 +1569,11 @@ Thu Nov 4 17:36:27 1999 Andrew Cagney be unreliable above 9600), and the EPI Jeeni seems to run at 38.4K. +1999-11-01 Elena Zannoni + + * stack.c (print_frame_info_base): Do not change printing of stack + frame info if not running with our interpreter. + 1999-11-01 Fernando Nasser From Grant Edwards : @@ -1533,6 +1641,16 @@ Thu Nov 4 17:36:27 1999 Andrew Cagney * infcmd.c: Fix typo. +1999-10-28 Elena Zannoni + + * stack.c (select_frame_command_wrapper): Fix typo. + + * infcmd.c (interrupt_target_command_wrapper): Wrapper to allow use of + static interrupt_target_command outside of file. + + * stack.c (select_frame_command_wrapper): Wrapper to allow use of + static select_frame_command outside of file. + 1999-10-28 Jim Blandy * gdbtypes.c (init_simd_type): The upper bound to @@ -1618,6 +1736,14 @@ Thu Nov 4 17:36:27 1999 Andrew Cagney * arm-tdep.c (THUMB_BE_BREAKPOINT): Change to 0xbebe. (THUMB_LE_BREAKPOINT): Change to 0xbebe. +1999-10-25 Elena Zannoni + + * stack.c (print_frame_info_base): Don't print the arguments + during a backtrace. + * stack.c (print_frame_info_base): When setting source to 0, save + and restore old value. Do this only if source is greater than + zero. + Mon Oct 25 18:22:06 1999 Andrew Cagney * remote.c: Document future of compare_sections_command. @@ -1644,6 +1770,12 @@ Sat Oct 23 16:39:34 1999 Andrew Cagney * gdbarch.h (initialize_current_architecture): Declare. * gdbarch.c (initialize_current_architecture): New function. +1999-10-22 Elena Zannoni + + * stack.c (print_frame_info_base): Check for value of source + parameter equal to 2, and print address anyway. Set source to 0 + later, to avoid printing file & line info again. + 1999-10-21 Michael Snyder * utils.c (chars_per_line): fix typo in comment. @@ -1691,6 +1823,9 @@ Sat Oct 23 16:39:34 1999 Andrew Cagney 1999-10-18 Elena Zannoni + * stack.c (print_frame_info_base): Add printing of list + begin and end. + * breakpoint.h: Change return type of field print_it of struct bpstats to enumeration print_stop_action. Define new enumeration print_stop_action. @@ -2160,6 +2295,13 @@ Thu Oct 7 19:24:05 1999 Andrew Cagney 1999-10-04 Fernando Nasser + * varobj.c (varobj_get_type): Call tui_sfileopen() instead of + deprecated gdb_file_init_astream(). + (c_value_of_variable): Ditto. + * ui-out.c (ui_out_stream_new): Ditto. + +1999-10-04 Fernando Nasser + * utils.c (tui_sfileopen): New function. Replaces gdb_file_init_astring(). * defs.h: Add prototype for the above. @@ -2402,6 +2544,7 @@ Wed Sep 29 21:27:16 1999 Jeffrey A Law (law@cygnus.com) * remote-sim.c (gdbsim_create_inferior): Ditto. * target.c (target_link): Ditto. * win32-nat.c (child_create_inferior): Ditto. + * varobj.c (varobj_create, new_root_variable): Ditto. Thu Sep 30 10:36:19 1999 Andrew Cagney @@ -2737,6 +2880,16 @@ Thu Sep 23 20:48:22 1999 Andrew Cagney than stdout, so they don't get mixed into the result stream from commands. +1999-09-23 Fernando Nasser + + * varobj.c (varobj_set_value): Fix handling of baseclasses and + correct the behavior when it is not a baseclass (both cases were + dumping core). + +1999-09-23 Fernando Nasser + + * varobj.c (varobj_update): Fix setting of child error field. + 1999-09-23 Elena Zannoni * event-loop.c (poll_timers): Use correct timeval field names, @@ -2744,6 +2897,12 @@ Thu Sep 23 20:48:22 1999 Andrew Cagney (gdb_wait_for_event): Pass a pointer to the timeout structure to select(), not the structure. +1999-09-23 Fernando Nasser + + * varobj.c (varobj_gen_name): Dynamically allocate variable object + name string. + (varobj_update): Fix creation of result list. + Wed Sep 22 10:35:32 1999 Andrew Cagney * Makefile.in (init.c): Change generated file to include "defs.h" @@ -2760,6 +2919,27 @@ Wed Sep 22 10:35:32 1999 Andrew Cagney * procfs.c (init_procinfo): move fltset initialization to caller. (do_attach, create_procinfo): initialize fltset. +1999-09-22 Fernando Nasser + + * varobj.c (_initialize_varobj): Rename varobjdebug to debugvarobj + to avoid conflict with "set var". + +1999-09-22 Fernando Nasser + + * varobj.c (varobj_get_type, c_value_of_variable): Remove + dependency on ui_out.[ch]. + +1999-09-22 Fernando Nasser + + * varobj.c (varobj_update): Fix order in which changed variables + are reported to match that of the old code. + +1999-09-22 Fernando Nasser + + * varobj.c (type_changeable): Fix for testsuite case 2.12. Do not + report as changed a structure when one of it's children has changed. + (get_type, get_type_deref): Remove uneeded initialization. + 1999-09-22 Elena Zannoni * event-loop.c, event-top.c, event-loop.h: Rerun indent. @@ -2768,6 +2948,18 @@ Wed Sep 22 10:35:32 1999 Andrew Cagney * m32r-stub.c (handle_exception): Fix typo in patch of 1999-08-26. +1999-09-21 Fernando Nasser + + * varobj.c (_initialize_varobj): Add set/show for varobjdebug. + (uninstall_variable): Test for varobjdebug before printing trace + and send it to gdb_stdlog. + +1999-09-21 Fernando Nasser + + * varobj.c (c_type_of_child): Fix missing break, improve comment + and add warning. + (c_number_of_children): Add comment. + Tue Sep 21 14:55:29 1999 Andrew Cagney From 1999-08-20 J.T. Conklin : @@ -2775,10 +2967,54 @@ Tue Sep 21 14:55:29 1999 Andrew Cagney inline as is done for the standard encoding. (remote_cisco_expand): Removed. +1999-09-20 Fernando Nasser + + * varobj.c (varobj_update): Test for illegal invocation for + non-root variable object. + +1999-09-20 Fernando Nasser + + * varobj.c (my_value_equal): Style. Eliminate side-effects. + (varobj_update): Adjust calls to reflect the above change. + +1999-09-20 Fernando Nasser + + * varobj.c (c_value_of_variable): Fix return value for struct + members when parent is a invalid pointer. + 1999-09-20 Elena Zannoni * event-loop.c: Include . +1999-09-20 Fernando Nasser + + * varobj.c (cplus_number_of_children): Coding style improvement. + (cplus_value_of_child): Ditto. + +1999-09-20 Fernando Nasser + + * varobj.c (c_name_of_child): Add missing default clause in switch + statement. + (c_type_of_child): Ditto. + (varobj_set_value): Test for NULL type. + +1999-09-20 Fernando Nasser + + * varobj.c (varobj_set_value): Wrap call to evaluate_expression. + +1999-09-20 Fernando Nasser + + * varobj.c (format_string[]): Remove unused variable(s). + (varobj_set_value): Ditto. + (c_value_of_root): Ditto. + (cplus_value_of_child): Ditto. + +1999-09-20 Fernando Nasser + + * varobj.c: Add missing header file include. + (new_variable, new_root_variable): Fix prototype and header. + (_initialize_varobj): Add prototype. + 1999-09-20 Elena Zannoni * ser-ocd.c: (ser_ocd_open, ser_ocd_raw, ser_ocd_readchar, @@ -2827,6 +3063,10 @@ Mon Sep 20 17:00:06 1999 Andrew Cagney of ``cleanup_sigint_signal_handler''. * Makefile.in (infrun.o): Add dependency on remote.h. +Mon Sep 20 16:15:29 1999 Andrew Cagney + + * ui-out.h (ui_out_test_flags): Add missing declaration. + Mon Sep 20 13:41:04 1999 Andrew Cagney * kod.c (ecos_kod_open, ecos_kod_request, ecos_kod_close, @@ -2850,6 +3090,11 @@ Mon Sep 20 12:13:27 1999 Andrew Cagney declaration. Make static. * event-top.c (rl_callback_read_char_wrapper): Ditto. +Mon Sep 20 10:54:19 1999 Andrew Cagney + + * Makefile.in (varobj.o): Disable warnings. Currently + work-in-progress. + Fri Sep 17 19:28:17 1999 Andrew Cagney * source.c: Include "source.h". @@ -2935,6 +3180,10 @@ Sat Sep 18 07:13:03 1999 Jeffrey A Law (law@cygnus.com) * hppa-tdep.c (in_solib_call_trampoline): Handle PA64 shared library trampolines. +1999-09-17 Fernando Nasser + + * wrapper.h: Add missing define brackets. + 1999-09-17 Jim Blandy * breakpoint.c (permanent_breakpoint_here_p): Delete. @@ -2957,6 +3206,24 @@ Sat Sep 18 07:13:03 1999 Jeffrey A Law (law@cygnus.com) register width; pad aggregates smaller than eight bytes on the right. +1999-09-17 Fernando Nasser + + * Makefile.in: Add entries for varobj.[cho] and wrapper.[cho]. + +1999-09-17 Fernando Nasser + + * varobj.h: New file. GDB variable objects API. + * varobj.c: New file. Implementation of the GDB variable objects + API. + +1999-09-17 Fernando Nasser + + * wrapper.h: New file. Longjump free calls to gdb internal + routines. + * wrapper.c (gdb_evaluate_expression, wrap_evaluate_expression, + gdb_value_fetch_lazy, wrap_value_fetch_lazy, gdb_value_equal, + wrap_value_equal, gdb_value_ind, wrap_value_ind): New functions. + Thu Sep 16 17:33:35 1999 Andrew Cagney * remote.c (remote_async_open_1): Use SERIAL_ASYNC to @@ -3101,8 +3368,6 @@ Tue Sep 14 14:34:28 1999 Andrew Cagney * defs.h (continuation): Make this a typedef. - * Makefile.in (gdbtk.o, gdbtk-cmds.o): Depend on $(top_h). - * Makefile.in (i386-linux-nat.o): Depend on symfile.h, not $(symfile_h); the latter has no definition. @@ -3146,8 +3411,6 @@ Tue Sep 14 14:34:28 1999 Andrew Cagney __dld_break, which contains the permanent breakpoint, when interesting things happen. Tell GDB that the breakpoint in __dld_break is permanent. - * gdbtk-cmds.c (gdb_get_breakpoint_info): Report a permanent - breakpoint as enabled. * infrun.c (SKIP_PERMANENT_BREAKPOINT): Provide default definition. (default_skip_permanent_breakpoint): New function. (resume): If we're trying to resume at a permanent breakpoint, use @@ -3319,6 +3582,12 @@ Mon Sep 13 17:51:28 1999 Andrew Cagney * remote.c (_initialize_remote): Fix the specification of the "remote" prefix to set and show commands. +1999-09-09 Fernando Nasser + + * command.c (print_doc_line): Update to use ui_out. + (do_setshow_command): Ditto. + (cmd_show_list): Ditto. + 1999-09-09 Elena Zannoni * event-loop.c (create_file_event): New function. Creates a gdb @@ -4564,6 +4833,14 @@ Sun Aug 8 12:06:47 1999 Fred Fish Also move Z packet support OUTSIDE of REMOTE_BREAKPOINT ifdef, since this is not set for all targets that support the Z packet. +Sun Aug 8 17:24:09 1999 Andrew Cagney + + * ui-out.c (ui_out_table_begin, ui_out_table_body, + ui_out_table_end, ui_out_table_header, ui_out_list_begin, + ui_out_list_end, ui_out_stream_new, verify_field_proper_position, + verify_field_alignment): Replace incorrect calls to error with + calls to internal_error. + Fri Aug 6 17:17:28 1999 Andrew Cagney * defs.h (fatal): Delete declaration. @@ -4786,6 +5063,14 @@ Wed Aug 4 10:42:58 1999 Fred Fish an array of 5 internal_auxent to leave room for bfd to write n_numaux entries. Change code to use the first one. +Wed Aug 4 19:58:15 1999 Andrew Cagney + + * ui-out.h (cli_out_new): Move declaration from here. + * cli-out.h: To here. New file. + * Makefile.in (ui-out.o): Add missing dependencies. + (cli-out.o): Ditto. + * top.c, cli-out.c: #include "cli-out.h". + 1999-08-02 Stan Shebs * c-valprint.c (c_val_print): When printing decimal equivalent @@ -4979,6 +5264,10 @@ Mon Jul 26 17:13:39 1999 Andrew Cagney * NEWS: Mention the new configs. +1999-07-15 Fernando Nasser + + * ui-out.c (struct ui_out): Remove deprecated fields. + 1999-07-15 Fernando Nasser * target.c (target_preopen): Prevent query when not from_tty. @@ -4988,6 +5277,16 @@ Mon Jul 26 17:13:39 1999 Andrew Cagney * event-loop.c: Fix typo in comment. +1999-07-15 Fernando Nasser + + * breakpoint.c (breakpoint_1): Fix output when no breakpoins are + found. + +1999-07-15 Elena Zannoni + + * event-top.c (display_gdb_prompt): Don't do anything if we are + running under the interpreter. + Wed Jul 14 17:29:31 1999 Andrew Cagney * ser-pipe.c (struct pipe_state): Define. @@ -5416,6 +5715,11 @@ Wed Jun 30 15:45:48 1999 Jeffrey A Law (law@cygnus.com) * main.c: Turn on async by default by setting async_p to 1. +Wed Jun 23 20:39:24 1999 Andrew Cagney + + * main.c (main): Recognize --ui. Will eventually replace + --interpreter. + Wed Jun 23 15:44:39 1999 Andrew Cagney From Jimmy Guo : @@ -5488,6 +5792,22 @@ Wed Jun 23 15:30:46 1999 Andrew Cagney is NULL, call find_proc_desc so we know how to restore the registers. +1999-06-16 Fernando Nasser + + * cli-out.c (cli_out_new): Add flags argument to ui-out-new call. + * source.c (print_source_lines_base): Test for ui_source_list flag + and use ui_out for file and line output. + * ui-out.c (struct ui_out): Add flags field to struct and to default + initialization. + (ui_out_set_flags): New function. Handle flags. + (ui_out_clear_flags): New function. Ditto. + (ui_out_test_flags): New function. Ditto. + (ui_out_new): Add flags parameter. + * ui-out.h: Add flags argument to ui_out_new declaration. + Add declarations for ui_out_*_flags functions. + (enum ui_flags): New enum. Defines ui_out flags. + * top.c (gdb_init): Fix misspelling typo. + 1999-06-15 Michael Snyder * event-top.c (start_event_loop): call get_prompt. @@ -5514,6 +5834,7 @@ Wed Jun 23 15:30:46 1999 Andrew Cagney (read_command_lines): rename "prompt" to prompt_arg for clarity. (stop_sig): call get_prompt instead of reading prompt string directly. (command_loop): ditto. + (simplified_command_loop): ditto. (gdb_prompt_escape): New variable. Esc char for prompt parameters. (get_prompt_1): New function, workhorse for get_prompt. (get_prompt): Completely rewrite. Add functionality for a @@ -5546,6 +5867,10 @@ Sun Jun 13 10:44:13 1999 Andrew Cagney Please examine your test suite output carefully, and report any problems to me. +1999-06-11 Fernando Nasser + + * top.c (gdb_init): Add pre-processor test for UI_OUT. + 1999-06-11 Elena Zannoni * event-top.c (setup_event_loop): Change name to start_event_loop. @@ -5570,6 +5895,57 @@ Fri Jun 11 18:34:33 1999 Andrew Cagney (tui_file_rewind, tui_file_put): New functions. (tui_file_new): Add rewind and put. + * cli-out.c (cli_spaces): Replace gdb_stdout with data->stream. + (cli_text, cli_message, cli_flush, out_field_fmt, + field_separator): Ditto. + +Fri Jun 11 16:08:37 1999 Andrew Cagney + + * cli-out.c (cli_out_new): Replace init_cli_out, + * top.c (gdb_init): Call cli_out_new. + * main.c (main): Delete call to set_ui_out_impl. + + * ui-out.h (set_ui_out_impl, cli_ui_out_impl), ui-out.c: Delete. + (cli_out_new): Add declaration. Will move later. + + * ui-out.c (ui_out_new, ui_out_data), ui-out.h: New functions. + (struct ui_out): Add field data. + (ui_out_new): Replace init_ui_out_state. + + * ui-out.c (XMALLOC): Define. + (ui_out_stream_new, append_header_to_list): Use XMALLOC instead of + xmalloc. + * cli-out.c (XMALLOC): Define. + +Fri Jun 11 10:31:29 1999 Andrew Cagney + + * ui-out.c (ui_out_field_int, ui_out_field_skip, + ui_out_field_fmt): Rewrite statements to remove infix operators. + + * ui-out.c (get_curr_header, verify_field_proper_position, + verify_field_alignment, init_ui_out_state, set_ui_out_impl, + append_header_to_list): Add explicit ui_out parameter. + (struct ui_out): Move the local variables ``table_flag'', + ``body_flag'', ``table_columns'', ``table_id'', ``list_flat'', + ``field_count'', ``headerfirst'', ``headerlast'', ``headercurr'' + into this struct. + (typedef ui_out_hdr): Delete. + (struct ui_out_hdr): Rename struct _ui_out_hdr. + (ui_out_table_begin, ui_out_table_end, ui_out_table_body, + ui_out_table_header, ui_out_field_int, ui_out_list_begin, + ui_out_table_end, ui_out_list_end, ui_out_field_skip, + ui_out_table_body, ui_out_list_begin, ui_out_list_end, + ui_out_field_string, ui_out_field_fmt, init_ui_out_state, + verify_field_proper_position, verify_field_alignment, + clear_header_list, append_header_to_list, _initialize_ui_out): + Update. + + * ui-out.h (typedef streambuf): Delete. + (struct _streambuf): Rename to struct ui_stream. + * breakpoint.c (breakpoint_1), stack.c (print_frame_info_base), + printcmd.c (print_frame_args): Rename streambuf to struct + ui_stream. + Fri Jun 11 15:10:32 1999 Andrew Cagney * d10v-tdep.c (d10v_push_arguments): Fix order of arguments passed @@ -5697,6 +6073,14 @@ Thu Jun 10 20:04:02 1999 Andrew Cagney mn10300-tdep.c: New function. * config/mn10300/tm-mn10300.h (SAVED_PC_AFTER_CALL): Update. +Wed Jun 9 16:42:16 1999 Andrew Cagney + + * top.h, top.c (simplified_command_loop): Make global. + + * main.c (main): Delete call to call_interp_loop. Interpreters + hook in using command_loop_hook. + * top.c (call_interp_loop): Delete function. + 1999-06-10 Keith Seitz * mcore-rom.c (picobug_dumpregs): Return a value. Any value, it @@ -5868,6 +6252,13 @@ Fri Jun 4 17:10:36 1999 Andrew Cagney FP_REGNUM, PC_REGNUM, NUM_REGS, REGISTER_NAME. * d10v-tdep.c, config/d10v/tm-d10v.h: Update. +1999-06-03 Fernando Nasser + + * printcmd.c (print_frame_args): Convert some of the output to use + ui_out. + * stack.c (print_frame_info_base): Adjust the call to the above + function. + 1999-06-03 Michael Snyder * thread.c: eliminate the target_thread_vector (functionality @@ -6090,6 +6481,21 @@ Tue Jun 1 10:45:24 1999 Andrew Cagney 1999-05-31 Fernando Nasser + * breakpoint.c (print_it_normal): Convertion of part of the output + to use ui-out. + (mention): Same as above. + * infcmd.c (run_command): Same. + * source.c (print_source_lines_base): Same. + * stack.c (print_frame_info_base): Same. + +1999-05-31 Fernando Nasser + + * breakpoint.c (breakpoint_1): Fix names of fields on ui_out + produced output. + * ui-out.h: Cosmetic change. + +1999-05-31 Fernando Nasser + * stack.c (print_args_stub): Add missing stream parameter. Mon May 31 15:50:08 1999 Andrew Cagney @@ -6098,6 +6504,21 @@ Mon May 31 15:50:08 1999 Andrew Cagney * valops.c, value.h (default_push_arguments): Fix order of parameters to match PUSH_ARGUMENTS arguments. +1999-05-28 Fernando Nasser + + * top.c (print_command_lines): Simplified script format for + non-console output. + +1999-05-28 Fernando Nasser + + * top.c (print_command_lines): Fixed printing of if clauses. + * breakpoint.c (breakpoint_1): Adjust call to the above. + * top.c (show_user_1): Same as above. + +1999-05-27 Fernando Nasser + + * top.c (call_interp_loop): Correct build problem with UI_OUT defined. + Thu May 27 11:42:55 1999 Andrew Cagney * gdbarch.h (EXTRACT_STRUCT_VALUE_ADDRESS): Return 0. @@ -6167,6 +6588,14 @@ Wed May 26 13:51:25 1999 Andrew Cagney gdb_file_get_strbuf, gdb_file_adjust_strbuf, tui_file_flush): Verify ts_magic. +1999-05-25 Fernando Nasser + + * top.c (print_command_lines): New function, fix bug in printing + while commands and uses ui_out. + * gdbcmd.c: Add prototype for the above. + * breakpoint.c (breakpoint_1): Fix breakpoint script printing. + * command.c (show_user_1): Fix user command script printing. + 1999-05-25 Jim Blandy * breakpoint.c (insert_breakpoints, remove_breakpoint, @@ -6217,6 +6646,9 @@ Tue May 25 13:01:43 1999 Andrew Cagney * main.c (gdb_init): Move declaration from here. * top.h: To here. + * main.c (call_interp_loop): Move declaration from here. + * top.h: To here. + * defs.h (init_page_info): Add declaration. * top.c (initialize_utils): Move declaration from here. @@ -6293,6 +6725,8 @@ Mon May 24 16:16:29 1999 Andrew Cagney demangle.c (_initialize_demangler), maint.c (_initialize_maint_cmds), language.c (_initialize_language): Add external declaration. + * ui-out.c (_initialize_ui_out), cli-out.c (_initialize_cli_out): + Ditto. Mon May 24 10:04:56 1999 Andrew Cagney @@ -6406,6 +6840,34 @@ Fri May 21 11:23:54 1999 Andrew Cagney * rs6000-tdep.c (rs6000_push_arguments): Rename push_arguments. +1999-05-21 Fernando Nasser + + * breakpoint.c (breakpoint_1): Added ui_out output code but still + uses old code by default. + +1999-05-21 Fernando Nasser + + * Makefile.in: Added ui-ou files. + * main.c (main): Install cli_out by default. + * ui-out.c (ui_out_table_begin): Use saved table id. + +1999-05-21 Fernando Nasser + + * ui-out.h: Export implementation vectors so they can be + installed in main.c and top.c. + +1999-05-21 Fernando Nasser + + * ui-out.h: New file. Defines the ui_out API. + * ui-out.c: New file. Implements the ui_out API abstraction only. + * cli-out.c: New file. Implements low-level ui-out primitives for + CLI-based interaction. + +1999-05-20 Elena Zannoni + + * top.c (simplified_command_loop): Reformat using GNU style. + (call_interp_loop): Ditto. + Thu May 20 12:18:28 1999 Andrew Cagney * blockframe.c (get_prev_frame): Remove #ifdef around test for @@ -6437,6 +6899,18 @@ Thu May 20 12:18:28 1999 Andrew Cagney * event-loop.c: Ditto. * main.c: Ditto. +1999-05-20 Elena Zannoni + + * top.c (simplified_command_loop): New function. It is just a + bare minimal command_loop. + (call_interp_loop): New function. Call the correct version of the + command loop, with the appropriate input reading function, + depending on which interpreter gdb was invoked with. + + * main.c (main): Recognize and handle the new command line option + --interpreter. If an interpreter is specified, call the appropriate + command handling function. + 1999-05-19 Keith Seitz * config/mcore/tm-mcore.h (BELIEVE_PCC_PROMOTION): Define. We diff --git a/gdb/Makefile.in b/gdb/Makefile.in index a97df49..e2215f1 100644 --- a/gdb/Makefile.in +++ b/gdb/Makefile.in @@ -229,7 +229,7 @@ CDEPS = $(XM_CDEPS) $(TM_CDEPS) $(NAT_CDEPS) $(SIM) $(BFD) $(READLINE) \ ADD_FILES = $(REGEX) $(XM_ADD_FILES) $(TM_ADD_FILES) $(NAT_ADD_FILES) ADD_DEPS = $(REGEX1) $(XM_ADD_FILES) $(TM_ADD_FILES) $(NAT_ADD_FILES) -VERSION = 20000201 +VERSION = 20000202 DIST=gdb LINT=/usr/5bin/lint @@ -388,6 +388,8 @@ SFILES = ax-general.c ax-gdb.c bcache.c blockframe.c breakpoint.c \ findvar.c gdbarch.c gdbtypes.c \ inf-loop.c infcmd.c inflow.c infrun.c language.c \ kod.c kod-cisco.c \ + ui-out.c cli-out.c \ + varobj.c wrapper.c \ jv-exp.y jv-lang.c jv-valprint.c jv-typeprint.c \ m2-exp.y m2-lang.c m2-typeprint.c m2-valprint.c main.c maint.c \ mem-break.c minsyms.c mipsread.c nlmread.c objfiles.c parse.c \ @@ -464,6 +466,8 @@ event_top_h = event-top.h inf_loop_h = inf-loop.h remote_h = remote.h version_h = version.h +ui_out_h = ui-out.h +cli_out_h = cli-out.h # Header files that need to have srcdir added. Note that in the cases # where we use a macro like $(gdbcmd_h), things are carefully arranged @@ -529,6 +533,8 @@ COMMON_OBS = version.o blockframe.o breakpoint.o findvar.o stack.o thread.o \ dbxread.o coffread.o elfread.o \ dwarfread.o dwarf2read.o mipsread.o stabsread.o corefile.o \ c-lang.o ch-exp.o ch-lang.o f-lang.o \ + ui-out.o cli-out.o \ + varobj.o wrapper.o \ jv-lang.o jv-valprint.o jv-typeprint.o \ m2-lang.o \ scm-exp.o scm-lang.o scm-valprint.o complaints.o typeprint.o \ @@ -1729,4 +1735,11 @@ m2-exp.tab.o: m2-exp.tab.c $(defs_h) $(expression_h) $(gdbtypes_h) \ gdb-events.o: gdb-events.c gdb-events.h $(defs_h) $(gdbcmd_h) +ui-out.o: ui-out.c $(defs_h) $(ui_out_h) expression.h language.h +cli-out.o: cli-out.c $(defs_h) $(ui_out_h) $(cli_out_h) +varobj.o: varobj.c $(defs_h) $(frame_h) $(value_h) \ + $(language_h) valprint.h varobj.h + $(CC) -c $(INTERNAL_WARN_CFLAGS) $(NO_WERROR_CFLAGS) $< +wrapper.o: wrapper.c $(defs_h) $(frame_h) $(value_h) wrapper.h + ### end of the gdb Makefile.in. diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c index f10f661..c3e9b5d 100644 --- a/gdb/arm-tdep.c +++ b/gdb/arm-tdep.c @@ -103,6 +103,24 @@ struct frame_extra_info int framereg; }; +#define SWAP_TARGET_AND_HOST(buffer,len) \ + do \ + { \ + if (TARGET_BYTE_ORDER != HOST_BYTE_ORDER) \ + { \ + char tmp; \ + char *p = (char *)(buffer); \ + char *q = ((char *)(buffer)) + len - 1; \ + for (; p < q; p++, q--) \ + { \ + tmp = *q; \ + *q = *p; \ + *p = tmp; \ + } \ + } \ + } \ + while (0) + /* Will a function return an aggregate type in memory or in a register? Return 0 if an aggregate type can be returned in a register, 1 if it must be returned in memory. */ @@ -252,8 +270,9 @@ int arm_pc_is_thumb_dummy (bfd_vma memaddr) { CORE_ADDR sp = read_sp (); + CORE_ADDR fp = read_fp (); - if (PC_IN_CALL_DUMMY (memaddr, sp, sp + 64)) + if (PC_IN_CALL_DUMMY (memaddr, sp, fp)) return caller_is_thumb; else return 0; @@ -1227,10 +1246,22 @@ arm_push_arguments (int nargs, value_ptr * args, CORE_ADDR sp, calling the function. */ if (TYPE_CODE_FLT == typecode && REGISTER_SIZE == len) { - float f = *(float *) val; - dbl_arg = f; - val = (char *) &dbl_arg; + float f; + double d; + char * bufo = (char *) &d; + char * bufd = (char *) &dbl_arg; + len = sizeof (double); + f = *(float *) val; + SWAP_TARGET_AND_HOST (&f, sizeof (float)); /* adjust endianess */ + d = f; + /* We must revert the longwords so they get loaded into the + the right registers. */ + memcpy (bufd, bufo + len / 2, len / 2); + SWAP_TARGET_AND_HOST (bufd, len / 2); /* adjust endianess */ + memcpy (bufd + len / 2, bufo, len / 2); + SWAP_TARGET_AND_HOST (bufd + len / 2, len / 2); /* adjust endianess */ + val = (char *) &dbl_arg; } #if 1 /* I don't know why this code was disable. The only logical use @@ -1279,18 +1310,42 @@ arm_push_arguments (int nargs, value_ptr * args, CORE_ADDR sp, void arm_pop_frame (void) { - struct frame_info *frame = get_current_frame (); int regnum; - CORE_ADDR old_SP; + struct frame_info *frame = get_current_frame (); + + if (!PC_IN_CALL_DUMMY(frame->pc, frame->frame, read_fp())) + { + CORE_ADDR old_SP; - old_SP = read_register (frame->framereg); - for (regnum = 0; regnum < NUM_REGS; regnum++) - if (frame->fsr.regs[regnum] != 0) - write_register (regnum, + old_SP = read_register (frame->framereg); + for (regnum = 0; regnum < NUM_REGS; regnum++) + if (frame->fsr.regs[regnum] != 0) + write_register (regnum, read_memory_integer (frame->fsr.regs[regnum], 4)); - write_register (PC_REGNUM, FRAME_SAVED_PC (frame)); - write_register (SP_REGNUM, old_SP); + write_register (PC_REGNUM, FRAME_SAVED_PC (frame)); + write_register (SP_REGNUM, old_SP); + } + else + { + CORE_ADDR sp; + + sp = read_register (FP_REGNUM); + sp -= sizeof(CORE_ADDR); /* we don't care about this first word */ + + write_register (PC_REGNUM, read_memory_integer (sp, 4)); + sp -= sizeof(CORE_ADDR); + write_register (SP_REGNUM, read_memory_integer (sp, 4)); + sp -= sizeof(CORE_ADDR); + write_register (FP_REGNUM, read_memory_integer (sp, 4)); + sp -= sizeof(CORE_ADDR); + + for (regnum = 10; regnum >= 0; regnum--) + { + write_register (regnum, read_memory_integer (sp, 4)); + sp -= sizeof(CORE_ADDR); + } + } flush_cached_frames (); } diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index 6edfc62..c7b3ff6 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -39,6 +39,9 @@ #include "annotate.h" #include "symfile.h" #include "objfiles.h" +#ifdef UI_OUT +#include "ui-out.h" +#endif #include "gdb-events.h" @@ -1888,6 +1891,12 @@ static enum print_stop_action print_it_typical (bs) bpstat bs; { +#ifdef UI_OUT + struct cleanup *old_chain; + struct ui_stream *stb; + stb = ui_out_stream_new (uiout); + old_chain = make_cleanup ((make_cleanup_func) ui_out_stream_delete, stb); +#endif /* UI_OUT */ /* bs->breakpoint_at can be NULL if it was a momentary breakpoint which has since been deleted. */ if (bs->breakpoint_at == NULL) @@ -1897,11 +1906,19 @@ print_it_typical (bs) { case bp_breakpoint: case bp_hardware_breakpoint: +#ifdef UI_OUT + annotate_breakpoint (bs->breakpoint_at->number); + ui_out_text (uiout, "\nBreakpoint "); + ui_out_field_int (uiout, "bkptno", bs->breakpoint_at->number); + ui_out_text (uiout, ", "); + return PRINT_SRC_AND_LOC; +#else /* I think the user probably only wants to see one breakpoint number, not all of them. */ annotate_breakpoint (bs->breakpoint_at->number); printf_filtered ("\nBreakpoint %d, ", bs->breakpoint_at->number); return PRINT_SRC_AND_LOC; +#endif break; case bp_shlib_event: @@ -2034,6 +2051,18 @@ print_it_typical (bs) if (bs->old_val != NULL) { annotate_watchpoint (bs->breakpoint_at->number); +#ifdef UI_OUT + mention (bs->breakpoint_at); + ui_out_list_begin (uiout, "value"); + ui_out_text (uiout, "\nOld value = "); + value_print (bs->old_val, stb->stream, 0, Val_pretty_default); + ui_out_field_stream (uiout, "old", stb); + ui_out_text (uiout, "\nNew value = "); + value_print (bs->breakpoint_at->val, stb->stream, 0, Val_pretty_default); + ui_out_field_stream (uiout, "new", stb); + ui_out_list_end (uiout); + ui_out_text (uiout, "\n"); +#else mention (bs->breakpoint_at); printf_filtered ("\nOld value = "); value_print (bs->old_val, gdb_stdout, 0, Val_pretty_default); @@ -2041,6 +2070,7 @@ print_it_typical (bs) value_print (bs->breakpoint_at->val, gdb_stdout, 0, Val_pretty_default); printf_filtered ("\n"); +#endif value_free (bs->old_val); bs->old_val = NULL; } @@ -2049,15 +2079,49 @@ print_it_typical (bs) break; case bp_read_watchpoint: +#ifdef UI_OUT + mention (bs->breakpoint_at); + ui_out_list_begin (uiout, "value"); + ui_out_text (uiout, "\nValue = "); + value_print (bs->breakpoint_at->val, stb->stream, 0, Val_pretty_default); + ui_out_field_stream (uiout, "value", stb); + ui_out_list_end (uiout); + ui_out_text (uiout, "\n"); +#else mention (bs->breakpoint_at); printf_filtered ("\nValue = "); value_print (bs->breakpoint_at->val, gdb_stdout, 0, Val_pretty_default); printf_filtered ("\n"); +#endif return PRINT_UNKNOWN; break; case bp_access_watchpoint: +#ifdef UI_OUT + if (bs->old_val != NULL) + { + annotate_watchpoint (bs->breakpoint_at->number); + mention (bs->breakpoint_at); + ui_out_list_begin (uiout, "value"); + ui_out_text (uiout, "\nOld value = "); + value_print (bs->old_val, stb->stream, 0, Val_pretty_default); + ui_out_field_stream (uiout, "old", stb); + value_free (bs->old_val); + bs->old_val = NULL; + ui_out_text (uiout, "\nNew value = "); + } + else + { + mention (bs->breakpoint_at); + ui_out_field_string (uiout, "reason", "access-watchpoint-trigger"); + ui_out_text (uiout, "\nValue = "); + } + value_print (bs->breakpoint_at->val, stb->stream, 0,Val_pretty_default); + ui_out_field_stream (uiout, "new", stb); + ui_out_list_end (uiout); + ui_out_text (uiout, "\n"); +#else if (bs->old_val != NULL) { annotate_watchpoint (bs->breakpoint_at->number); @@ -2076,6 +2140,7 @@ print_it_typical (bs) value_print (bs->breakpoint_at->val, gdb_stdout, 0, Val_pretty_default); printf_filtered ("\n"); +#endif return PRINT_UNKNOWN; break; @@ -2083,7 +2148,13 @@ print_it_typical (bs) here. */ case bp_finish: + return PRINT_UNKNOWN; + break; + case bp_until: + return PRINT_UNKNOWN; + break; + case bp_none: case bp_longjmp: case bp_longjmp_resume: @@ -2288,9 +2359,16 @@ watchpoint_check (p) in this case, by the time we call print_it_typical() this bp will be deleted already. So we have no choice but print the information here. */ +#ifdef UI_OUT + ui_out_text (uiout, "\nWatchpoint "); + ui_out_field_int (uiout, "wpnum", bs->breakpoint_at->number); + ui_out_text (uiout, " deleted because the program has left the block in\n\ +which its expression is valid.\n"); +#else printf_filtered ("\ Watchpoint %d deleted because the program has left the block in\n\ which its expression is valid.\n", bs->breakpoint_at->number); +#endif if (b->related_breakpoint) b->related_breakpoint->disposition = del_at_next_stop; @@ -3033,12 +3111,23 @@ print_one_breakpoint (struct breakpoint *b, {"del", "dstp", "dis", "keep"}; static char bpenables[] = "nynny"; char wrap_indent[80]; +#ifdef UI_OUT + struct ui_stream *stb = ui_out_stream_new (uiout); + struct cleanup *old_chain = make_cleanup_ui_out_stream_delete (stb); +#endif annotate_record (); +#ifdef UI_OUT + ui_out_list_begin (uiout, "bkpt"); +#endif /* 1 */ annotate_field (0); +#ifdef UI_OUT + ui_out_field_int (uiout, "number", b->number); +#else printf_filtered ("%-3d ", b->number); +#endif /* 2 */ annotate_field (1); @@ -3046,15 +3135,28 @@ print_one_breakpoint (struct breakpoint *b, || ((int) b->type != bptypes[(int) b->type].type)) internal_error ("bptypes table does not describe type #%d.", (int) b->type); +#ifdef UI_OUT + ui_out_field_string (uiout, "type", bptypes[(int) b->type].description); +#else printf_filtered ("%-14s ", bptypes[(int) b->type].description); +#endif /* 3 */ annotate_field (2); +#ifdef UI_OUT + ui_out_field_string (uiout, "disp", bpdisps[(int) b->disposition]); +#else printf_filtered ("%-4s ", bpdisps[(int) b->disposition]); +#endif /* 4 */ annotate_field (3); +#ifdef UI_OUT + ui_out_field_fmt (uiout, "enabled", "%c", bpenables[(int) b->enable]); + ui_out_spaces (uiout, 2); +#else printf_filtered ("%-3c ", bpenables[(int) b->enable]); +#endif /* 5 and 6 */ strcpy (wrap_indent, " "); @@ -3073,8 +3175,16 @@ print_one_breakpoint (struct breakpoint *b, /* Field 4, the address, is omitted (which makes the columns not line up too nicely with the headers, but the effect is relatively readable). */ +#ifdef UI_OUT + if (addressprint) + ui_out_field_skip (uiout, "addr"); + annotate_field (5); + print_expression (b->exp, stb->stream); + ui_out_field_stream (uiout, "what", stb); +#else annotate_field (5); print_expression (b->exp, gdb_stdout); +#endif break; case bp_catch_load: @@ -3082,11 +3192,28 @@ print_one_breakpoint (struct breakpoint *b, /* Field 4, the address, is omitted (which makes the columns not line up too nicely with the headers, but the effect is relatively readable). */ +#ifdef UI_OUT + if (addressprint) + ui_out_field_skip (uiout, "addr"); + annotate_field (5); + if (b->dll_pathname == NULL) + { + ui_out_field_string (uiout, "what", ""); + ui_out_spaces (uiout, 1); + } + else + { + ui_out_text (uiout, "library \""); + ui_out_field_string (uiout, "what", b->dll_pathname); + ui_out_text (uiout, "\" "); + } +#else annotate_field (5); if (b->dll_pathname == NULL) printf_filtered (" "); else printf_filtered ("library \"%s\" ", b->dll_pathname); +#endif break; case bp_catch_fork: @@ -3094,34 +3221,74 @@ print_one_breakpoint (struct breakpoint *b, /* Field 4, the address, is omitted (which makes the columns not line up too nicely with the headers, but the effect is relatively readable). */ +#ifdef UI_OUT + if (addressprint) + ui_out_field_skip (uiout, "addr"); + annotate_field (5); + if (b->forked_inferior_pid != 0) + { + ui_out_text (uiout, "process "); + ui_out_field_int (uiout, "what", b->forked_inferior_pid); + ui_out_spaces (uiout, 1); + } +#else annotate_field (5); if (b->forked_inferior_pid != 0) printf_filtered ("process %d ", b->forked_inferior_pid); break; +#endif 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). */ +#ifdef UI_OUT + if (addressprint) + ui_out_field_skip (uiout, "addr"); + annotate_field (5); + if (b->exec_pathname != NULL) + { + ui_out_text (uiout, "program \""); + ui_out_field_string (uiout, "what", b->exec_pathname); + ui_out_text (uiout, "\" "); + } +#else annotate_field (5); if (b->exec_pathname != NULL) printf_filtered ("program \"%s\" ", b->exec_pathname); +#endif 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). */ +#ifdef UI_OUT + if (addressprint) + ui_out_field_skip (uiout, "addr"); + annotate_field (5); + ui_out_field_string (uiout, "what", "exception catch"); + ui_out_spaces (uiout, 1); +#else annotate_field (5); printf_filtered ("exception catch "); +#endif 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). */ +#ifdef UI_OUT + if (addressprint) + ui_out_field_skip (uiout, "addr"); + annotate_field (5); + ui_out_field_string (uiout, "what", "exception throw"); + ui_out_spaces (uiout, 1); +#else annotate_field (5); printf_filtered ("exception throw "); +#endif break; case bp_breakpoint: @@ -3136,6 +3303,35 @@ print_one_breakpoint (struct breakpoint *b, case bp_call_dummy: case bp_shlib_event: case bp_thread_event: +#ifdef UI_OUT + if (addressprint) + { + annotate_field (4); + ui_out_field_core_addr (uiout, "addr", b->address); + } + annotate_field (5); + *last_addr = b->address; + if (b->source_file) + { + sym = find_pc_sect_function (b->address, b->section); + if (sym) + { + ui_out_text (uiout, "in "); + ui_out_field_string (uiout, "func", + SYMBOL_SOURCE_NAME (sym)); + ui_out_wrap_hint (uiout, wrap_indent); + ui_out_text (uiout, " at "); + } + ui_out_field_string (uiout, "file", b->source_file); + ui_out_text (uiout, ":"); + ui_out_field_int (uiout, "line", b->line_number); + } + else + { + print_address_symbolic (b->address, stb->stream, demangle, ""); + ui_out_field_stream (uiout, "at", stb); + } +#else if (addressprint) { annotate_field (4); @@ -3163,64 +3359,125 @@ print_one_breakpoint (struct breakpoint *b, } else print_address_symbolic (b->address, gdb_stdout, demangle, " "); +#endif break; } if (b->thread != -1) { +#ifdef UI_OUT + /* FIXME: This seems to be redundant and lost here; see the + "stop only in" line a little further down. */ + ui_out_text (uiout, " thread "); + ui_out_field_int (uiout, "thread", b->thread); +#else printf_filtered (" thread %d", b->thread); +#endif } +#ifdef UI_OUT + ui_out_text (uiout, "\n"); +#else printf_filtered ("\n"); +#endif if (b->frame) { annotate_field (6); +#ifdef UI_OUT + ui_out_text (uiout, "\tstop only in stack frame at "); + ui_out_field_core_addr (uiout, "frame", b->frame); + ui_out_text (uiout, "\n"); +#else printf_filtered ("\tstop only in stack frame at "); print_address_numeric (b->frame, 1, gdb_stdout); printf_filtered ("\n"); +#endif } if (b->cond) { annotate_field (7); +#ifdef UI_OUT + ui_out_text (uiout, "\tstop only if "); + print_expression (b->cond, stb->stream); + ui_out_field_stream (uiout, "cond", stb); + ui_out_text (uiout, "\n"); +#else printf_filtered ("\tstop only if "); print_expression (b->cond, gdb_stdout); printf_filtered ("\n"); +#endif } if (b->thread != -1) { /* FIXME should make an annotation for this */ +#ifdef UI_OUT + ui_out_text (uiout, "\tstop only in thread "); + ui_out_field_int (uiout, "thread", b->thread); + ui_out_text (uiout, "\n"); +#else printf_filtered ("\tstop only in thread %d\n", b->thread); +#endif } if (show_breakpoint_hit_counts && b->hit_count) { /* FIXME should make an annotation for this */ +#ifdef UI_OUT + if (ep_is_catchpoint (b)) + ui_out_text (uiout, "\tcatchpoint"); + else + ui_out_text (uiout, "\tbreakpoint"); + ui_out_text (uiout, " already hit "); + ui_out_field_int (uiout, "times", b->hit_count); + if (b->hit_count == 1) + ui_out_text (uiout, " time\n"); + else + ui_out_text (uiout, " times\n"); +#else 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")); +#endif } + if (b->ignore_count) { annotate_field (8); +#ifdef UI_OUT + ui_out_text (uiout, "\tignore next "); + ui_out_field_int (uiout, "ignore", b->ignore_count); + ui_out_text (uiout, " hits\n"); +#else printf_filtered ("\tignore next %d hits\n", b->ignore_count); +#endif } if ((l = b->commands)) { annotate_field (9); +#ifdef UI_OUT + ui_out_list_begin (uiout, "script"); + print_command_lines (uiout, l, 4); + ui_out_list_end (uiout); +#else while (l) { print_command_line (l, 4, gdb_stdout); l = l->next; } +#endif } +#ifdef UI_OUT + ui_out_list_end (uiout); + do_cleanups (old_chain); +#endif } struct captured_breakpoint_query_args @@ -3269,6 +3526,13 @@ breakpoint_1 (bnum, allflag) CORE_ADDR last_addr = (CORE_ADDR) -1; int found_a_breakpoint = 0; +#ifdef UI_OUT + if (addressprint) + ui_out_table_begin (uiout, 6, "BreakpointTable"); + else + ui_out_table_begin (uiout, 5, "BreakpointTable"); +#endif /* UI_OUT */ + ALL_BREAKPOINTS (b) if (bnum == -1 || bnum == b->number) @@ -3294,6 +3558,24 @@ breakpoint_1 (bnum, allflag) if (!found_a_breakpoint++) { annotate_breakpoints_headers (); +#ifdef UI_OUT + annotate_field (0); + ui_out_table_header (uiout, 3, ui_left, "Num"); /* 1 */ + annotate_field (1); + ui_out_table_header (uiout, 14, ui_left, "Type"); /* 2 */ + annotate_field (2); + ui_out_table_header (uiout, 4, ui_left, "Disp"); /* 3 */ + annotate_field (3); + ui_out_table_header (uiout, 3, ui_left, "Enb"); /* 4 */ + if (addressprint) + { + annotate_field (4); + ui_out_table_header (uiout, 10, ui_left, "Address"); /* 5 */ + } + annotate_field (5); + ui_out_table_header (uiout, 40, ui_noalign, "What"); /* 6 */ + ui_out_table_body (uiout); +#else annotate_field (0); printf_filtered ("Num "); annotate_field (1); @@ -3309,6 +3591,7 @@ breakpoint_1 (bnum, allflag) } annotate_field (5); printf_filtered ("What\n"); +#endif /* UI_OUT */ annotate_breakpoints_table (); } @@ -3317,10 +3600,18 @@ breakpoint_1 (bnum, allflag) if (!found_a_breakpoint) { +#ifdef UI_OUT + if (bnum == -1) + ui_out_message (uiout, 0, "No breakpoints or watchpoints.\n"); + else + ui_out_message (uiout, 0, "No breakpoint or watchpoint number %d.\n", + bnum); +#else if (bnum == -1) printf_filtered ("No breakpoints or watchpoints.\n"); else printf_filtered ("No breakpoint or watchpoint number %d.\n", bnum); +#endif /* UI_OUT */ } else { @@ -3330,6 +3621,9 @@ breakpoint_1 (bnum, allflag) set_next_address (last_addr); } +#ifdef UI_OUT + ui_out_table_end (uiout); +#endif /* UI_OUT */ /* FIXME? Should this be moved up so that it is only called when there have been breakpoints? */ annotate_breakpoints_table_end (); @@ -4070,6 +4364,13 @@ mention (b) struct breakpoint *b; { int say_where = 0; +#ifdef UI_OUT + struct cleanup *old_chain; + struct ui_stream *stb; + + stb = ui_out_stream_new (uiout); + old_chain = make_cleanup ((make_cleanup_func) ui_out_stream_delete, stb); +#endif /* UI_OUT */ /* FIXME: This is misplaced; mention() is called by things (like hitting a watchpoint) other than breakpoint creation. It should be possible to @@ -4085,6 +4386,26 @@ mention (b) case bp_none: printf_filtered ("(apparently deleted?) Eventpoint %d: ", b->number); break; +#ifdef UI_OUT + case bp_watchpoint: + ui_out_text (uiout, "Watchpoint "); + ui_out_list_begin (uiout, "wpt"); + ui_out_field_int (uiout, "number", b->number); + ui_out_text (uiout, ": "); + print_expression (b->exp, stb->stream); + ui_out_field_stream (uiout, "exp", stb); + ui_out_list_end (uiout); + break; + case bp_hardware_watchpoint: + ui_out_text (uiout, "Hardware watchpoint "); + ui_out_list_begin (uiout, "wpt"); + ui_out_field_int (uiout, "number", b->number); + ui_out_text (uiout, ": "); + print_expression (b->exp, stb->stream); + ui_out_field_stream (uiout, "exp", stb); + ui_out_list_end (uiout); + break; +#else case bp_watchpoint: printf_filtered ("Watchpoint %d: ", b->number); print_expression (b->exp, gdb_stdout); @@ -4093,6 +4414,27 @@ mention (b) printf_filtered ("Hardware watchpoint %d: ", b->number); print_expression (b->exp, gdb_stdout); break; +#endif +#ifdef UI_OUT + case bp_read_watchpoint: + ui_out_text (uiout, "Hardware read watchpoint "); + ui_out_list_begin (uiout, "hw-rwpt"); + ui_out_field_int (uiout, "number", b->number); + ui_out_text (uiout, ": "); + print_expression (b->exp, stb->stream); + ui_out_field_stream (uiout, "exp", stb); + ui_out_list_end (uiout); + break; + case bp_access_watchpoint: + ui_out_text (uiout, "Hardware access (read/write) watchpoint "); + ui_out_list_begin (uiout, "hw-awpt"); + ui_out_field_int (uiout, "number", b->number); + ui_out_text (uiout, ": "); + print_expression (b->exp, stb->stream); + ui_out_field_stream (uiout, "exp", stb); + ui_out_list_end (uiout); + break; +#else case bp_read_watchpoint: printf_filtered ("Hardware read watchpoint %d: ", b->number); print_expression (b->exp, gdb_stdout); @@ -4102,6 +4444,7 @@ mention (b) b->number); print_expression (b->exp, gdb_stdout); break; +#endif case bp_breakpoint: printf_filtered ("Breakpoint %d", b->number); say_where = 1; @@ -4160,6 +4503,9 @@ mention (b) TUIDO (((TuiOpaqueFuncPtr) tui_vAllSetHasBreakAt, b, 1)); TUIDO (((TuiOpaqueFuncPtr) tuiUpdateAllExecInfos)); } +#ifdef UI_OUT + do_cleanups (old_chain); +#endif printf_filtered ("\n"); } @@ -5180,6 +5526,15 @@ can_use_hardware_watchpoint (v) return found_memory_cnt; } +#ifdef UI_OUT +void +watch_command_wrapper (arg, from_tty) + char *arg; + int from_tty; +{ + watch_command (arg, from_tty); +} +#endif static void watch_command (arg, from_tty) char *arg; @@ -5188,6 +5543,15 @@ watch_command (arg, from_tty) watch_command_1 (arg, hw_write, from_tty); } +#ifdef UI_OUT +void +rwatch_command_wrapper (arg, from_tty) + char *arg; + int from_tty; +{ + rwatch_command (arg, from_tty); +} +#endif static void rwatch_command (arg, from_tty) char *arg; @@ -5196,6 +5560,15 @@ rwatch_command (arg, from_tty) watch_command_1 (arg, hw_read, from_tty); } +#ifdef UI_OUT +void +awatch_command_wrapper (arg, from_tty) + char *arg; + int from_tty; +{ + awatch_command (arg, from_tty); +} +#endif static void awatch_command (arg, from_tty) char *arg; diff --git a/gdb/breakpoint.h b/gdb/breakpoint.h index d0aa8bd..f8358a9 100644 --- a/gdb/breakpoint.h +++ b/gdb/breakpoint.h @@ -551,6 +551,12 @@ extern void breakpoint_clear_ignore_counts PARAMS ((void)); extern void break_command PARAMS ((char *, int)); +extern void hbreak_command_wrapper PARAMS ((char *, int)); +extern void thbreak_command_wrapper PARAMS ((char *, int)); +extern void rbreak_command_wrapper PARAMS ((char *, int)); +extern void watch_command_wrapper PARAMS ((char *, int)); +extern void awatch_command_wrapper PARAMS ((char *, int)); +extern void rwatch_command_wrapper PARAMS ((char *, int)); extern void tbreak_command PARAMS ((char *, int)); extern int insert_breakpoints PARAMS ((void)); diff --git a/gdb/cli-out.c b/gdb/cli-out.c new file mode 100644 index 0000000..d906510 --- /dev/null +++ b/gdb/cli-out.c @@ -0,0 +1,339 @@ +/* Output generating routines for GDB CLI. + Copyright 1999-2000 Free Software Foundation, Inc. + Contributed by Cygnus Solutions. + Written by Fernando Nasser for Cygnus. + + This file is part of GDB. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include "defs.h" +#include "ui-out.h" +#include "cli-out.h" + +/* Convenience macro for allocting typesafe memory. */ + +#ifndef XMALLOC +#define XMALLOC(TYPE) (TYPE*) xmalloc (sizeof (TYPE)) +#endif + +struct ui_out_data + { + struct ui_file *stream; + }; + +/* These are the CLI output functions */ + +static void cli_table_begin (struct ui_out *uiout, int nbrofcols, char *tblid); +static void cli_table_body (struct ui_out *uiout); +static void cli_table_end (struct ui_out *uiout); +static void cli_table_header (struct ui_out *uiout, int width, + enum ui_align alig, char *colhdr); +static void cli_list_begin (struct ui_out *uiout, int list_flag, char *lstid); +static void cli_list_end (struct ui_out *uiout, int list_flag); +static void cli_field_int (struct ui_out *uiout, int fldno, int width, + enum ui_align alig, char *fldname, int value); +static void cli_field_skip (struct ui_out *uiout, int fldno, int width, + enum ui_align alig, char *fldname); +static void cli_field_string (struct ui_out *uiout, int fldno, int width, + enum ui_align alig, char *fldname, + const char *string); +static void cli_field_fmt (struct ui_out *uiout, int fldno, + int width, enum ui_align align, + char *fldname, char *format, va_list args); +static void cli_spaces (struct ui_out *uiout, int numspaces); +static void cli_text (struct ui_out *uiout, char *string); +static void cli_message (struct ui_out *uiout, int verbosity, char *format, + va_list args); +static void cli_wrap_hint (struct ui_out *uiout, char *identstring); +static void cli_flush (struct ui_out *uiout); + +/* This is the CLI ui-out implementation functions vector */ + +/* FIXME: This can be initialized dynamically after default is set to + handle initial output in main.c */ + +static struct ui_out_impl cli_ui_out_impl = +{ + cli_table_begin, + cli_table_body, + cli_table_end, + cli_table_header, + cli_list_begin, + cli_list_end, + cli_field_int, + cli_field_skip, + cli_field_string, + cli_field_fmt, + cli_spaces, + cli_text, + cli_message, + cli_wrap_hint, + cli_flush +}; + +/* Prototypes for local functions */ + +extern void _initialize_cli_out PARAMS ((void)); + +static void field_separator (void); + +static void out_field_fmt (struct ui_out *uiout, int fldno, char *fldname, + char *format,...); + +/* local variables */ + +/* (none yet) */ + +/* Mark beginning of a table */ + +void +cli_table_begin (uiout, nbrofcols, tblid) + struct ui_out *uiout; + int nbrofcols; + char *tblid; +{ +} + +/* Mark beginning of a table body */ + +void +cli_table_body (uiout) + struct ui_out *uiout; +{ + /* first, close the table header line */ + cli_text (uiout, "\n"); +} + +/* Mark end of a table */ + +void +cli_table_end (uiout) + struct ui_out *uiout; +{ +} + +/* Specify table header */ + +void +cli_table_header (uiout, width, alignment, colhdr) + struct ui_out *uiout; + int width; + int alignment; + char *colhdr; +{ + cli_field_string (uiout, 0, width, alignment, 0, colhdr); +} + +/* Mark beginning of a list */ + +void +cli_list_begin (uiout, list_flag, lstid) + struct ui_out *uiout; + int list_flag; + char *lstid; +{ +} + +/* Mark end of a list */ + +void +cli_list_end (uiout, list_flag) + struct ui_out *uiout; + int list_flag; +{ +} + +/* output an int field */ + +void +cli_field_int (uiout, fldno, width, alignment, fldname, value) + struct ui_out *uiout; + int fldno; + int width; + int alignment; + char *fldname; + int value; +{ + char buffer[20]; /* FIXME: how many chars long a %d can become? */ + + sprintf (buffer, "%d", value); + cli_field_string (uiout, fldno, width, alignment, fldname, buffer); +} + +/* used to ommit a field */ + +void +cli_field_skip (uiout, fldno, width, alignment, fldname) + struct ui_out *uiout; + int fldno; + int width; + int alignment; + char *fldname; +{ + cli_field_string (uiout, fldno, width, alignment, fldname, ""); +} + +/* other specific cli_field_* end up here so alignment and field + separators are both handled by cli_field_string */ + +void +cli_field_string (struct ui_out *uiout, + int fldno, + int width, + int align, + char *fldname, + const char *string) +{ + int before = 0; + int after = 0; + + if ((align != ui_noalign) && string) + { + before = width - strlen (string); + if (before <= 0) + before = 0; + else + { + if (align == ui_right) + after = 0; + else if (align == ui_left) + { + after = before; + before = 0; + } + else + /* ui_center */ + { + after = before / 2; + before -= after; + } + } + } + + if (before) + ui_out_spaces (uiout, before); + if (string) + out_field_fmt (uiout, fldno, fldname, "%s", string); + if (after) + ui_out_spaces (uiout, after); + + if (align != ui_noalign) + field_separator (); +} + +/* This is the only field function that does not align */ + +void +cli_field_fmt (struct ui_out *uiout, int fldno, + int width, enum ui_align align, + char *fldname, char *format, va_list args) +{ + struct ui_out_data *data = ui_out_data (uiout); + vfprintf_filtered (data->stream, format, args); + + if (align != ui_noalign) + field_separator (); +} + +void +cli_spaces (uiout, numspaces) + struct ui_out *uiout; + int numspaces; +{ + struct ui_out_data *data = ui_out_data (uiout); + print_spaces_filtered (numspaces, data->stream); +} + +void +cli_text (uiout, string) + struct ui_out *uiout; + char *string; +{ + struct ui_out_data *data = ui_out_data (uiout); + fputs_filtered (string, data->stream); +} + +void +cli_message (struct ui_out *uiout, int verbosity, char *format, va_list args) +{ + struct ui_out_data *data = ui_out_data (uiout); + if (ui_out_get_verblvl (uiout) >= verbosity) + vfprintf_unfiltered (data->stream, format, args); +} + +void +cli_wrap_hint (uiout, identstring) + struct ui_out *uiout; + char *identstring; +{ + wrap_here (identstring); +} + +void +cli_flush (uiout) + struct ui_out *uiout; +{ + struct ui_out_data *data = ui_out_data (uiout); + gdb_flush (data->stream); +} + +/* local functions */ + +/* Like cli_field_fmt, but takes a variable number of args + and makes a va_list and does not insert a separator */ + +/* VARARGS */ +static void +out_field_fmt (struct ui_out *uiout, int fldno, char *fldname, + char *format,...) +{ + struct ui_out_data *data = ui_out_data (uiout); + va_list args; + + va_start (args, format); + vfprintf_filtered (data->stream, format, args); + + va_end (args); +} + +/* access to ui_out format private members */ + +static void +field_separator () +{ + struct ui_out_data *data = ui_out_data (uiout); + fputc_filtered (' ', data->stream); +} + +/* initalize private members at startup */ + +struct ui_out * +cli_out_new (struct ui_file *stream) +{ + int flags = ui_source_list; + + struct ui_out_data *data = XMALLOC (struct ui_out_data); + data->stream = stream; + return ui_out_new (&cli_ui_out_impl, data, flags); +} + +/* standard gdb initialization hook */ +void +_initialize_cli_out () +{ + /* nothing needs to be done */ +} diff --git a/gdb/cli-out.h b/gdb/cli-out.h new file mode 100644 index 0000000..f017f80 --- /dev/null +++ b/gdb/cli-out.h @@ -0,0 +1,27 @@ +/* Output generating routines for GDB CLI. + Copyright 1999-2000 Free Software Foundation, Inc. + Contributed by Cygnus Solutions. + + This file is part of GDB. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#ifndef CLI_OUT_H +#define CLI_OUT_H + +extern struct ui_out *cli_out_new (struct ui_file *stream); + +#endif diff --git a/gdb/command.c b/gdb/command.c index 76c98e6..0db8095 100644 --- a/gdb/command.c +++ b/gdb/command.c @@ -22,6 +22,9 @@ #include "value.h" #include #include "gdb_string.h" +#ifdef UI_OUT +#include "ui-out.h" +#endif #if HAVE_SYS_WAIT_H #include @@ -520,7 +523,11 @@ print_doc_line (stream, str) line_buffer[p - str] = '\0'; if (islower (line_buffer[0])) line_buffer[0] = toupper (line_buffer[0]); +#ifdef UI_OUT + ui_out_text (uiout, line_buffer); +#else fputs_filtered (line_buffer, stream); +#endif } /* @@ -1363,9 +1370,73 @@ do_setshow_command (arg, from_tty, c) } else if (c->type == show_cmd) { +#ifdef UI_OUT + struct cleanup *old_chain; + struct ui_stream *stb; + int quote; + + stb = ui_out_stream_new (uiout); + old_chain = make_cleanup ((make_cleanup_func) ui_out_stream_delete, stb); +#endif /* UI_OUT */ + /* Print doc minus "show" at start. */ print_doc_line (gdb_stdout, c->doc + 5); +#ifdef UI_OUT + ui_out_text (uiout, " is "); + ui_out_wrap_hint (uiout, " "); + quote = 0; + switch (c->var_type) + { + case var_string: + { + unsigned char *p; + + if (*(unsigned char **) c->var) + fputstr_filtered (*(unsigned char **) c->var, '"', stb->stream); + quote = 1; + } + break; + case var_string_noescape: + case var_filename: + case var_enum: + if (*(char **) c->var) + fputs_filtered (*(char **) c->var, stb->stream); + quote = 1; + break; + case var_boolean: + fputs_filtered (*(int *) c->var ? "on" : "off", stb->stream); + break; + case var_uinteger: + if (*(unsigned int *) c->var == UINT_MAX) + { + fputs_filtered ("unlimited", stb->stream); + break; + } + /* else fall through */ + case var_zinteger: + fprintf_filtered (stb->stream, "%u", *(unsigned int *) c->var); + break; + case var_integer: + if (*(int *) c->var == INT_MAX) + { + fputs_filtered ("unlimited", stb->stream); + } + else + fprintf_filtered (stb->stream, "%d", *(int *) c->var); + break; + + default: + error ("gdb internal error: bad var_type in do_setshow_command"); + } + if (quote) + ui_out_text (uiout, "\""); + ui_out_field_stream (uiout, "value", stb); + if (quote) + ui_out_text (uiout, "\""); + ui_out_text (uiout, ".\n"); + do_cleanups (old_chain); +#else fputs_filtered (" is ", gdb_stdout); wrap_here (" "); switch (c->var_type) @@ -1412,6 +1483,7 @@ do_setshow_command (arg, from_tty, c) error ("gdb internal error: bad var_type in do_setshow_command"); } fputs_filtered (".\n", gdb_stdout); +#endif } else error ("gdb internal error: bad cmd_type in do_setshow_command"); @@ -1428,10 +1500,31 @@ cmd_show_list (list, from_tty, prefix) int from_tty; char *prefix; { +#ifdef UI_OUT + ui_out_list_begin (uiout, "showlist"); +#endif for (; list != NULL; list = list->next) { /* If we find a prefix, run its list, prefixing our output by its prefix (with "show " skipped). */ +#ifdef UI_OUT + if (list->prefixlist && !list->abbrev_flag) + { + ui_out_list_begin (uiout, "optionlist"); + ui_out_field_string (uiout, "prefix", list->prefixname + 5); + cmd_show_list (*list->prefixlist, from_tty, list->prefixname + 5); + ui_out_list_end (uiout); + } + if (list->type == show_cmd) + { + ui_out_list_begin (uiout, "option"); + ui_out_text (uiout, prefix); + ui_out_field_string (uiout, "name", list->name); + ui_out_text (uiout, ": "); + do_setshow_command ((char *) NULL, from_tty, list); + ui_out_list_end (uiout); + } +#else if (list->prefixlist && !list->abbrev_flag) cmd_show_list (*list->prefixlist, from_tty, list->prefixname + 5); if (list->type == show_cmd) @@ -1441,7 +1534,11 @@ cmd_show_list (list, from_tty, prefix) fputs_filtered (": ", gdb_stdout); do_setshow_command ((char *) NULL, from_tty, list); } +#endif } +#ifdef UI_OUT + ui_out_list_end (uiout); +#endif } /* ARGSUSED */ @@ -1541,12 +1638,17 @@ show_user_1 (c, stream) fputs_filtered (c->name, stream); fputs_filtered (":\n", stream); +#ifdef UI_OUT + print_command_lines (uiout, cmdlines, 1); + fputs_filtered ("\n", stream); +#else while (cmdlines) { print_command_line (cmdlines, 4, stream); cmdlines = cmdlines->next; } fputs_filtered ("\n", stream); +#endif } /* ARGSUSED */ diff --git a/gdb/configure b/gdb/configure index 6e456d7..69d9792 100755 --- a/gdb/configure +++ b/gdb/configure @@ -30,10 +30,6 @@ ac_help="$ac_help ac_help="$ac_help --enable-targets Alternative target configurations" ac_help="$ac_help - --enable-ide Enable IDE support" -ac_help="$ac_help - --with-foundry-libs=DIR Use the Foundry SDK in DIR" -ac_help="$ac_help --with-cpu=CPU Set the default CPU variant to debug" ac_help="$ac_help --enable-gdbtk Enable GDBTK GUI front end" @@ -587,7 +583,7 @@ fi # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:591: checking for $ac_word" >&5 +echo "configure:587: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -617,7 +613,7 @@ if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:621: checking for $ac_word" >&5 +echo "configure:617: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -668,7 +664,7 @@ fi # Extract the first word of "cl", so it can be a program name with args. set dummy cl; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:672: checking for $ac_word" >&5 +echo "configure:668: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -700,7 +696,7 @@ fi fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:704: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 +echo "configure:700: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. @@ -711,12 +707,12 @@ cross_compiling=$ac_cv_prog_cc_cross cat > conftest.$ac_ext << EOF -#line 715 "configure" +#line 711 "configure" #include "confdefs.h" main(){return(0);} EOF -if { (eval echo configure:720: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:716: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then ac_cv_prog_cc_works=yes # If we can't run a trivial program, we are probably using a cross compiler. if (./conftest; exit) 2>/dev/null; then @@ -742,12 +738,12 @@ if test $ac_cv_prog_cc_works = no; then { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:746: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:742: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 cross_compiling=$ac_cv_prog_cc_cross echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 -echo "configure:751: checking whether we are using GNU C" >&5 +echo "configure:747: checking whether we are using GNU C" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -756,7 +752,7 @@ else yes; #endif EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:760: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:756: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gcc=yes else ac_cv_prog_gcc=no @@ -775,7 +771,7 @@ ac_test_CFLAGS="${CFLAGS+set}" ac_save_CFLAGS="$CFLAGS" CFLAGS= echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:779: checking whether ${CC-cc} accepts -g" >&5 +echo "configure:775: checking whether ${CC-cc} accepts -g" >&5 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -807,7 +803,7 @@ else fi echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -echo "configure:811: checking how to run the C preprocessor" >&5 +echo "configure:807: checking how to run the C preprocessor" >&5 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= @@ -822,13 +818,13 @@ else # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:832: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:828: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -839,13 +835,13 @@ else rm -rf conftest* CPP="${CC-cc} -E -traditional-cpp" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:849: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:845: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -856,13 +852,13 @@ else rm -rf conftest* CPP="${CC-cc} -nologo -E" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:866: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:862: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -887,9 +883,9 @@ fi echo "$ac_t""$CPP" 1>&6 echo $ac_n "checking for AIX""... $ac_c" 1>&6 -echo "configure:891: checking for AIX" >&5 +echo "configure:887: checking for AIX" >&5 cat > conftest.$ac_ext <&6 -echo "configure:915: checking for POSIXized ISC" >&5 +echo "configure:911: checking for POSIXized ISC" >&5 if test -d /etc/conf/kconfig.d && grep _POSIX_VERSION /usr/include/sys/unistd.h >/dev/null 2>&1 then @@ -935,7 +931,7 @@ fi echo $ac_n "checking for ${CC-cc} option to accept ANSI C""... $ac_c" 1>&6 -echo "configure:939: checking for ${CC-cc} option to accept ANSI C" >&5 +echo "configure:935: checking for ${CC-cc} option to accept ANSI C" >&5 if eval "test \"`echo '$''{'am_cv_prog_cc_stdc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -951,7 +947,7 @@ for ac_arg in "" -qlanglvl=ansi -std1 "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__ do CC="$ac_save_CC $ac_arg" cat > conftest.$ac_ext < #include @@ -988,7 +984,7 @@ return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } EOF -if { (eval echo configure:992: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:988: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* am_cv_prog_cc_stdc="$ac_arg"; break else @@ -1059,7 +1055,7 @@ else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; } fi echo $ac_n "checking host system type""... $ac_c" 1>&6 -echo "configure:1063: checking host system type" >&5 +echo "configure:1059: checking host system type" >&5 host_alias=$host case "$host_alias" in @@ -1080,7 +1076,7 @@ host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` echo "$ac_t""$host" 1>&6 echo $ac_n "checking target system type""... $ac_c" 1>&6 -echo "configure:1084: checking target system type" >&5 +echo "configure:1080: checking target system type" >&5 target_alias=$target case "$target_alias" in @@ -1098,7 +1094,7 @@ target_os=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` echo "$ac_t""$target" 1>&6 echo $ac_n "checking build system type""... $ac_c" 1>&6 -echo "configure:1102: checking build system type" >&5 +echo "configure:1098: checking build system type" >&5 build_alias=$build case "$build_alias" in @@ -1123,7 +1119,7 @@ test "$host_alias" != "$target_alias" && ALL_LINGUAS= echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 -echo "configure:1127: checking whether ${MAKE-make} sets \${MAKE}" >&5 +echo "configure:1123: checking whether ${MAKE-make} sets \${MAKE}" >&5 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1152,7 +1148,7 @@ fi # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1156: checking for $ac_word" >&5 +echo "configure:1152: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1180,12 +1176,12 @@ else fi echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 -echo "configure:1184: checking for ANSI C header files" >&5 +echo "configure:1180: checking for ANSI C header files" >&5 if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -1193,7 +1189,7 @@ else #include EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1197: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1193: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -1210,7 +1206,7 @@ rm -f conftest* if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat > conftest.$ac_ext < EOF @@ -1228,7 +1224,7 @@ fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat > conftest.$ac_ext < EOF @@ -1249,7 +1245,7 @@ if test "$cross_compiling" = yes; then : else cat > conftest.$ac_ext < #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') @@ -1260,7 +1256,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); exit (0); } EOF -if { (eval echo configure:1264: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1260: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then : else @@ -1284,12 +1280,12 @@ EOF fi echo $ac_n "checking for working const""... $ac_c" 1>&6 -echo "configure:1288: checking for working const" >&5 +echo "configure:1284: checking for working const" >&5 if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1338: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_const=yes else @@ -1359,21 +1355,21 @@ EOF fi echo $ac_n "checking for inline""... $ac_c" 1>&6 -echo "configure:1363: checking for inline" >&5 +echo "configure:1359: checking for inline" >&5 if eval "test \"`echo '$''{'ac_cv_c_inline'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_cv_c_inline=no for ac_kw in inline __inline__ __inline; do cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1373: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_inline=$ac_kw; break else @@ -1399,12 +1395,12 @@ EOF esac echo $ac_n "checking for off_t""... $ac_c" 1>&6 -echo "configure:1403: checking for off_t" >&5 +echo "configure:1399: checking for off_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_off_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS @@ -1432,12 +1428,12 @@ EOF fi echo $ac_n "checking for size_t""... $ac_c" 1>&6 -echo "configure:1436: checking for size_t" >&5 +echo "configure:1432: checking for size_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS @@ -1467,19 +1463,19 @@ fi # The Ultrix 4.2 mips builtin alloca declared by alloca.h only works # for constant arguments. Useless! echo $ac_n "checking for working alloca.h""... $ac_c" 1>&6 -echo "configure:1471: checking for working alloca.h" >&5 +echo "configure:1467: checking for working alloca.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_alloca_h'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { char *p = alloca(2 * sizeof(int)); ; return 0; } EOF -if { (eval echo configure:1483: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1479: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_header_alloca_h=yes else @@ -1500,12 +1496,12 @@ EOF fi echo $ac_n "checking for alloca""... $ac_c" 1>&6 -echo "configure:1504: checking for alloca" >&5 +echo "configure:1500: checking for alloca" >&5 if eval "test \"`echo '$''{'ac_cv_func_alloca_works'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1533: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_func_alloca_works=yes else @@ -1565,12 +1561,12 @@ EOF echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6 -echo "configure:1569: checking whether alloca needs Cray hooks" >&5 +echo "configure:1565: checking whether alloca needs Cray hooks" >&5 if eval "test \"`echo '$''{'ac_cv_os_cray'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&6 if test $ac_cv_os_cray = yes; then for ac_func in _getb67 GETB67 getb67; do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:1599: checking for $ac_func" >&5 +echo "configure:1595: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1623: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -1650,7 +1646,7 @@ done fi echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6 -echo "configure:1654: checking stack direction for C alloca" >&5 +echo "configure:1650: checking stack direction for C alloca" >&5 if eval "test \"`echo '$''{'ac_cv_c_stack_direction'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1658,7 +1654,7 @@ else ac_cv_c_stack_direction=0 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1677: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_c_stack_direction=1 else @@ -1702,17 +1698,17 @@ for ac_hdr in unistd.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:1706: checking for $ac_hdr" >&5 +echo "configure:1702: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1716: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1712: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -1741,12 +1737,12 @@ done for ac_func in getpagesize do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:1745: checking for $ac_func" >&5 +echo "configure:1741: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1769: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -1794,7 +1790,7 @@ fi done echo $ac_n "checking for working mmap""... $ac_c" 1>&6 -echo "configure:1798: checking for working mmap" >&5 +echo "configure:1794: checking for working mmap" >&5 if eval "test \"`echo '$''{'ac_cv_func_mmap_fixed_mapped'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1802,7 +1798,7 @@ else ac_cv_func_mmap_fixed_mapped=no else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1942: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_func_mmap_fixed_mapped=yes else @@ -1970,17 +1966,17 @@ unistd.h values.h sys/param.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:1974: checking for $ac_hdr" >&5 +echo "configure:1970: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1984: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1980: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -2010,12 +2006,12 @@ done __argz_count __argz_stringify __argz_next do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:2014: checking for $ac_func" >&5 +echo "configure:2010: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2038: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -2067,12 +2063,12 @@ done for ac_func in stpcpy do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:2071: checking for $ac_func" >&5 +echo "configure:2067: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2095: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -2129,19 +2125,19 @@ EOF if test $ac_cv_header_locale_h = yes; then echo $ac_n "checking for LC_MESSAGES""... $ac_c" 1>&6 -echo "configure:2133: checking for LC_MESSAGES" >&5 +echo "configure:2129: checking for LC_MESSAGES" >&5 if eval "test \"`echo '$''{'am_cv_val_LC_MESSAGES'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { return LC_MESSAGES ; return 0; } EOF -if { (eval echo configure:2145: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2141: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* am_cv_val_LC_MESSAGES=yes else @@ -2162,7 +2158,7 @@ EOF fi fi echo $ac_n "checking whether NLS is requested""... $ac_c" 1>&6 -echo "configure:2166: checking whether NLS is requested" >&5 +echo "configure:2162: checking whether NLS is requested" >&5 # Check whether --enable-nls or --disable-nls was given. if test "${enable_nls+set}" = set; then enableval="$enable_nls" @@ -2182,7 +2178,7 @@ fi EOF echo $ac_n "checking whether included gettext is requested""... $ac_c" 1>&6 -echo "configure:2186: checking whether included gettext is requested" >&5 +echo "configure:2182: checking whether included gettext is requested" >&5 # Check whether --with-included-gettext or --without-included-gettext was given. if test "${with_included_gettext+set}" = set; then withval="$with_included_gettext" @@ -2201,17 +2197,17 @@ fi ac_safe=`echo "libintl.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for libintl.h""... $ac_c" 1>&6 -echo "configure:2205: checking for libintl.h" >&5 +echo "configure:2201: checking for libintl.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2215: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2211: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -2228,19 +2224,19 @@ fi if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then echo "$ac_t""yes" 1>&6 echo $ac_n "checking for gettext in libc""... $ac_c" 1>&6 -echo "configure:2232: checking for gettext in libc" >&5 +echo "configure:2228: checking for gettext in libc" >&5 if eval "test \"`echo '$''{'gt_cv_func_gettext_libc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { return (int) gettext ("") ; return 0; } EOF -if { (eval echo configure:2244: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2240: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* gt_cv_func_gettext_libc=yes else @@ -2256,7 +2252,7 @@ echo "$ac_t""$gt_cv_func_gettext_libc" 1>&6 if test "$gt_cv_func_gettext_libc" != "yes"; then echo $ac_n "checking for bindtextdomain in -lintl""... $ac_c" 1>&6 -echo "configure:2260: checking for bindtextdomain in -lintl" >&5 +echo "configure:2256: checking for bindtextdomain in -lintl" >&5 ac_lib_var=`echo intl'_'bindtextdomain | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2264,7 +2260,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lintl $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2275: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2291,19 +2287,19 @@ fi if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then echo "$ac_t""yes" 1>&6 echo $ac_n "checking for gettext in libintl""... $ac_c" 1>&6 -echo "configure:2295: checking for gettext in libintl" >&5 +echo "configure:2291: checking for gettext in libintl" >&5 if eval "test \"`echo '$''{'gt_cv_func_gettext_libintl'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2303: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* gt_cv_func_gettext_libintl=yes else @@ -2331,7 +2327,7 @@ EOF # Extract the first word of "msgfmt", so it can be a program name with args. set dummy msgfmt; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2335: checking for $ac_word" >&5 +echo "configure:2331: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_MSGFMT'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2365,12 +2361,12 @@ fi for ac_func in dcgettext do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:2369: checking for $ac_func" >&5 +echo "configure:2365: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2393: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -2420,7 +2416,7 @@ done # Extract the first word of "gmsgfmt", so it can be a program name with args. set dummy gmsgfmt; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2424: checking for $ac_word" >&5 +echo "configure:2420: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_GMSGFMT'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2456,7 +2452,7 @@ fi # Extract the first word of "xgettext", so it can be a program name with args. set dummy xgettext; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2460: checking for $ac_word" >&5 +echo "configure:2456: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_XGETTEXT'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2488,7 +2484,7 @@ else fi cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2496: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* CATOBJEXT=.gmo DATADIRNAME=share @@ -2528,7 +2524,7 @@ fi # Extract the first word of "msgfmt", so it can be a program name with args. set dummy msgfmt; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2532: checking for $ac_word" >&5 +echo "configure:2528: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_MSGFMT'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2562,7 +2558,7 @@ fi # Extract the first word of "gmsgfmt", so it can be a program name with args. set dummy gmsgfmt; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2566: checking for $ac_word" >&5 +echo "configure:2562: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_GMSGFMT'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2598,7 +2594,7 @@ fi # Extract the first word of "xgettext", so it can be a program name with args. set dummy xgettext; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2602: checking for $ac_word" >&5 +echo "configure:2598: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_XGETTEXT'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2688,7 +2684,7 @@ fi LINGUAS= else echo $ac_n "checking for catalogs to be installed""... $ac_c" 1>&6 -echo "configure:2692: checking for catalogs to be installed" >&5 +echo "configure:2688: checking for catalogs to be installed" >&5 NEW_LINGUAS= for lang in ${LINGUAS=$ALL_LINGUAS}; do case "$ALL_LINGUAS" in @@ -2716,17 +2712,17 @@ echo "configure:2692: checking for catalogs to be installed" >&5 if test "$CATOBJEXT" = ".cat"; then ac_safe=`echo "linux/version.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for linux/version.h""... $ac_c" 1>&6 -echo "configure:2720: checking for linux/version.h" >&5 +echo "configure:2716: checking for linux/version.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2730: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2726: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -2822,7 +2818,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2826: checking for $ac_word" >&5 +echo "configure:2822: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_AWK'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2863,7 +2859,7 @@ done # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # ./install, which can be erroneously created by make from ./install.sh. echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 -echo "configure:2867: checking for a BSD compatible install" >&5 +echo "configure:2863: checking for a BSD compatible install" >&5 if test -z "$INSTALL"; then if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2924,7 +2920,7 @@ fi # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args. set dummy ${ac_tool_prefix}ar; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2928: checking for $ac_word" >&5 +echo "configure:2924: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_AR'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2956,7 +2952,7 @@ fi # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ac_tool_prefix}ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2960: checking for $ac_word" >&5 +echo "configure:2956: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2988,7 +2984,7 @@ if test -n "$ac_tool_prefix"; then # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2992: checking for $ac_word" >&5 +echo "configure:2988: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3025,7 +3021,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3029: checking for $ac_word" >&5 +echo "configure:3025: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_YACC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3077,12 +3073,12 @@ test "$program_transform_name" = "" && program_transform_name="s,x,x," echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6 -echo "configure:3081: checking return type of signal handlers" >&5 +echo "configure:3077: checking return type of signal handlers" >&5 if eval "test \"`echo '$''{'ac_cv_type_signal'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -3099,7 +3095,7 @@ int main() { int i; ; return 0; } EOF -if { (eval echo configure:3103: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3099: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_type_signal=void else @@ -3119,12 +3115,12 @@ EOF echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 -echo "configure:3123: checking for ANSI C header files" >&5 +echo "configure:3119: checking for ANSI C header files" >&5 if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -3132,7 +3128,7 @@ else #include EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3136: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3132: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -3149,7 +3145,7 @@ rm -f conftest* if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat > conftest.$ac_ext < EOF @@ -3167,7 +3163,7 @@ fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat > conftest.$ac_ext < EOF @@ -3188,7 +3184,7 @@ if test "$cross_compiling" = yes; then : else cat > conftest.$ac_ext < #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') @@ -3199,7 +3195,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); exit (0); } EOF -if { (eval echo configure:3203: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:3199: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then : else @@ -3232,17 +3228,17 @@ for ac_hdr in ctype.h curses.h endian.h link.h thread_db.h proc_service.h \ do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:3236: checking for $ac_hdr" >&5 +echo "configure:3232: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3246: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3242: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -3269,12 +3265,12 @@ fi done echo $ac_n "checking whether stat file-mode macros are broken""... $ac_c" 1>&6 -echo "configure:3273: checking whether stat file-mode macros are broken" >&5 +echo "configure:3269: checking whether stat file-mode macros are broken" >&5 if eval "test \"`echo '$''{'ac_cv_header_stat_broken'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -3326,12 +3322,12 @@ fi echo $ac_n "checking for working const""... $ac_c" 1>&6 -echo "configure:3330: checking for working const" >&5 +echo "configure:3326: checking for working const" >&5 if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3380: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_const=yes else @@ -3404,12 +3400,12 @@ fi for ac_func in setpgid sbrk sigaction isascii bzero bcopy btowc poll sigprocmask do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3408: checking for $ac_func" >&5 +echo "configure:3404: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3432: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -3459,19 +3455,19 @@ done # The Ultrix 4.2 mips builtin alloca declared by alloca.h only works # for constant arguments. Useless! echo $ac_n "checking for working alloca.h""... $ac_c" 1>&6 -echo "configure:3463: checking for working alloca.h" >&5 +echo "configure:3459: checking for working alloca.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_alloca_h'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { char *p = alloca(2 * sizeof(int)); ; return 0; } EOF -if { (eval echo configure:3475: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3471: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_header_alloca_h=yes else @@ -3492,12 +3488,12 @@ EOF fi echo $ac_n "checking for alloca""... $ac_c" 1>&6 -echo "configure:3496: checking for alloca" >&5 +echo "configure:3492: checking for alloca" >&5 if eval "test \"`echo '$''{'ac_cv_func_alloca_works'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3525: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_func_alloca_works=yes else @@ -3557,12 +3553,12 @@ EOF echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6 -echo "configure:3561: checking whether alloca needs Cray hooks" >&5 +echo "configure:3557: checking whether alloca needs Cray hooks" >&5 if eval "test \"`echo '$''{'ac_cv_os_cray'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&6 if test $ac_cv_os_cray = yes; then for ac_func in _getb67 GETB67 getb67; do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3591: checking for $ac_func" >&5 +echo "configure:3587: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3615: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -3642,7 +3638,7 @@ done fi echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6 -echo "configure:3646: checking stack direction for C alloca" >&5 +echo "configure:3642: checking stack direction for C alloca" >&5 if eval "test \"`echo '$''{'ac_cv_c_stack_direction'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3650,7 +3646,7 @@ else ac_cv_c_stack_direction=0 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:3669: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_c_stack_direction=1 else @@ -3692,19 +3688,19 @@ fi echo $ac_n "checking for PTRACE_GETXFPREGS""... $ac_c" 1>&6 -echo "configure:3696: checking for PTRACE_GETXFPREGS" >&5 +echo "configure:3692: checking for PTRACE_GETXFPREGS" >&5 if eval "test \"`echo '$''{'gdb_cv_have_ptrace_getxfpregs'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { PTRACE_GETXFPREGS; ; return 0; } EOF -if { (eval echo configure:3708: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3704: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* gdb_cv_have_ptrace_getxfpregs=yes else @@ -3725,7 +3721,7 @@ EOF fi echo $ac_n "checking for socketpair in -lsocket""... $ac_c" 1>&6 -echo "configure:3729: checking for socketpair in -lsocket" >&5 +echo "configure:3725: checking for socketpair in -lsocket" >&5 ac_lib_var=`echo socket'_'socketpair | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -3733,7 +3729,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lsocket $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3744: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -3774,12 +3770,12 @@ fi for ac_func in socketpair do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3778: checking for $ac_func" >&5 +echo "configure:3774: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3802: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -3829,12 +3825,12 @@ done echo $ac_n "checking whether malloc must be declared""... $ac_c" 1>&6 -echo "configure:3833: checking whether malloc must be declared" >&5 +echo "configure:3829: checking whether malloc must be declared" >&5 if eval "test \"`echo '$''{'bfd_cv_decl_needed_malloc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < @@ -3855,7 +3851,7 @@ int main() { char *(*pfn) = (char *(*)) malloc ; return 0; } EOF -if { (eval echo configure:3859: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3855: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_decl_needed_malloc=no else @@ -3876,12 +3872,12 @@ EOF fi echo $ac_n "checking whether realloc must be declared""... $ac_c" 1>&6 -echo "configure:3880: checking whether realloc must be declared" >&5 +echo "configure:3876: checking whether realloc must be declared" >&5 if eval "test \"`echo '$''{'bfd_cv_decl_needed_realloc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < @@ -3902,7 +3898,7 @@ int main() { char *(*pfn) = (char *(*)) realloc ; return 0; } EOF -if { (eval echo configure:3906: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3902: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_decl_needed_realloc=no else @@ -3923,12 +3919,12 @@ EOF fi echo $ac_n "checking whether free must be declared""... $ac_c" 1>&6 -echo "configure:3927: checking whether free must be declared" >&5 +echo "configure:3923: checking whether free must be declared" >&5 if eval "test \"`echo '$''{'bfd_cv_decl_needed_free'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < @@ -3949,7 +3945,7 @@ int main() { char *(*pfn) = (char *(*)) free ; return 0; } EOF -if { (eval echo configure:3953: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3949: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_decl_needed_free=no else @@ -3970,12 +3966,12 @@ EOF fi echo $ac_n "checking whether strerror must be declared""... $ac_c" 1>&6 -echo "configure:3974: checking whether strerror must be declared" >&5 +echo "configure:3970: checking whether strerror must be declared" >&5 if eval "test \"`echo '$''{'bfd_cv_decl_needed_strerror'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < @@ -3996,7 +3992,7 @@ int main() { char *(*pfn) = (char *(*)) strerror ; return 0; } EOF -if { (eval echo configure:4000: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3996: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_decl_needed_strerror=no else @@ -4017,12 +4013,12 @@ EOF fi echo $ac_n "checking whether strdup must be declared""... $ac_c" 1>&6 -echo "configure:4021: checking whether strdup must be declared" >&5 +echo "configure:4017: checking whether strdup must be declared" >&5 if eval "test \"`echo '$''{'bfd_cv_decl_needed_strdup'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < @@ -4043,7 +4039,7 @@ int main() { char *(*pfn) = (char *(*)) strdup ; return 0; } EOF -if { (eval echo configure:4047: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4043: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_decl_needed_strdup=no else @@ -4064,12 +4060,12 @@ EOF fi echo $ac_n "checking whether strstr must be declared""... $ac_c" 1>&6 -echo "configure:4068: checking whether strstr must be declared" >&5 +echo "configure:4064: checking whether strstr must be declared" >&5 if eval "test \"`echo '$''{'bfd_cv_decl_needed_strstr'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < @@ -4090,7 +4086,7 @@ int main() { char *(*pfn) = (char *(*)) strstr ; return 0; } EOF -if { (eval echo configure:4094: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4090: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_decl_needed_strstr=no else @@ -4117,9 +4113,9 @@ fi # could be expunged. --jsm 1999-03-22 echo $ac_n "checking for HPUX save_state structure""... $ac_c" 1>&6 -echo "configure:4121: checking for HPUX save_state structure" >&5 +echo "configure:4117: checking for HPUX save_state structure" >&5 cat > conftest.$ac_ext < EOF @@ -4134,7 +4130,7 @@ fi rm -f conftest* cat > conftest.$ac_ext < EOF @@ -4201,19 +4197,19 @@ fi if test "$ac_cv_header_sys_procfs_h" = yes; then echo $ac_n "checking for pstatus_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:4205: checking for pstatus_t in sys/procfs.h" >&5 +echo "configure:4201: checking for pstatus_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_pstatus_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { pstatus_t avar ; return 0; } EOF -if { (eval echo configure:4217: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4213: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_pstatus_t=yes else @@ -4235,19 +4231,19 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_pstatus_t" 1>&6 echo $ac_n "checking for prrun_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:4239: checking for prrun_t in sys/procfs.h" >&5 +echo "configure:4235: checking for prrun_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_prrun_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { prrun_t avar ; return 0; } EOF -if { (eval echo configure:4251: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4247: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_prrun_t=yes else @@ -4269,19 +4265,19 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_prrun_t" 1>&6 echo $ac_n "checking for gregset_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:4273: checking for gregset_t in sys/procfs.h" >&5 +echo "configure:4269: checking for gregset_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_gregset_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { gregset_t avar ; return 0; } EOF -if { (eval echo configure:4285: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4281: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_gregset_t=yes else @@ -4303,19 +4299,19 @@ EOF echo "$ac_t""$bfd_cv_have_sys_procfs_type_gregset_t" 1>&6 echo $ac_n "checking for fpregset_t in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:4307: checking for fpregset_t in sys/procfs.h" >&5 +echo "configure:4303: checking for fpregset_t in sys/procfs.h" >&5 if eval "test \"`echo '$''{'bfd_cv_have_sys_procfs_type_fpregset_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { fpregset_t avar ; return 0; } EOF -if { (eval echo configure:4319: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4315: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_have_sys_procfs_type_fpregset_t=yes else @@ -4339,12 +4335,12 @@ EOF echo $ac_n "checking for PIOCSET ioctl entry in sys/procfs.h""... $ac_c" 1>&6 -echo "configure:4343: checking for PIOCSET ioctl entry in sys/procfs.h" >&5 +echo "configure:4339: checking for PIOCSET ioctl entry in sys/procfs.h" >&5 if eval "test \"`echo '$''{'gdb_cv_have_procfs_piocset'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -4357,7 +4353,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:4361: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4357: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* gdb_cv_have_procfs_piocset=yes else @@ -4379,7 +4375,7 @@ EOF fi echo $ac_n "checking for main in -lm""... $ac_c" 1>&6 -echo "configure:4383: checking for main in -lm" >&5 +echo "configure:4379: checking for main in -lm" >&5 ac_lib_var=`echo m'_'main | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4387,14 +4383,14 @@ else ac_save_LIBS="$LIBS" LIBS="-lm $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4394: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4423,7 +4419,7 @@ fi echo $ac_n "checking for wctype in -lc""... $ac_c" 1>&6 -echo "configure:4427: checking for wctype in -lc" >&5 +echo "configure:4423: checking for wctype in -lc" >&5 ac_lib_var=`echo c'_'wctype | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4431,7 +4427,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lc $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4442: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4461,7 +4457,7 @@ if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then else echo "$ac_t""no" 1>&6 echo $ac_n "checking for wctype in -lw""... $ac_c" 1>&6 -echo "configure:4465: checking for wctype in -lw" >&5 +echo "configure:4461: checking for wctype in -lw" >&5 ac_lib_var=`echo w'_'wctype | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4469,7 +4465,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lw $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4480: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4512,12 +4508,12 @@ fi echo $ac_n "checking for long long support in compiler""... $ac_c" 1>&6 -echo "configure:4516: checking for long long support in compiler" >&5 +echo "configure:4512: checking for long long support in compiler" >&5 if eval "test \"`echo '$''{'gdb_cv_c_long_long'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4527: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* gdb_cv_c_long_long=yes else @@ -4549,7 +4545,7 @@ fi echo $ac_n "checking for long long support in printf""... $ac_c" 1>&6 -echo "configure:4553: checking for long long support in printf" >&5 +echo "configure:4549: checking for long long support in printf" >&5 if eval "test \"`echo '$''{'gdb_cv_printf_has_long_long'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4557,7 +4553,7 @@ else gdb_cv_printf_has_long_long=no else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:4571: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then gdb_cv_printf_has_long_long=yes else @@ -4595,19 +4591,19 @@ echo "$ac_t""$gdb_cv_printf_has_long_long" 1>&6 echo $ac_n "checking for long double support in compiler""... $ac_c" 1>&6 -echo "configure:4599: checking for long double support in compiler" >&5 +echo "configure:4595: checking for long double support in compiler" >&5 if eval "test \"`echo '$''{'ac_cv_c_long_double'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4607: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_long_double=yes else @@ -4629,7 +4625,7 @@ fi echo $ac_n "checking for long double support in printf""... $ac_c" 1>&6 -echo "configure:4633: checking for long double support in printf" >&5 +echo "configure:4629: checking for long double support in printf" >&5 if eval "test \"`echo '$''{'gdb_cv_printf_has_long_double'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4637,7 +4633,7 @@ else gdb_cv_printf_has_long_double=no else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:4647: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then gdb_cv_printf_has_long_double=yes else @@ -4671,7 +4667,7 @@ echo "$ac_t""$gdb_cv_printf_has_long_double" 1>&6 echo $ac_n "checking for long double support in scanf""... $ac_c" 1>&6 -echo "configure:4675: checking for long double support in scanf" >&5 +echo "configure:4671: checking for long double support in scanf" >&5 if eval "test \"`echo '$''{'gdb_cv_scanf_has_long_double'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4679,7 +4675,7 @@ else gdb_cv_scanf_has_long_double=no else cat > conftest.$ac_ext < 3.14159 && f < 3.14160); } EOF -if { (eval echo configure:4693: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:4689: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then gdb_cv_scanf_has_long_double=yes else @@ -4715,17 +4711,17 @@ for ac_hdr in unistd.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:4719: checking for $ac_hdr" >&5 +echo "configure:4715: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4729: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4725: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -4754,12 +4750,12 @@ done for ac_func in getpagesize do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:4758: checking for $ac_func" >&5 +echo "configure:4754: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4782: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -4807,7 +4803,7 @@ fi done echo $ac_n "checking for working mmap""... $ac_c" 1>&6 -echo "configure:4811: checking for working mmap" >&5 +echo "configure:4807: checking for working mmap" >&5 if eval "test \"`echo '$''{'ac_cv_func_mmap_fixed_mapped'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4815,7 +4811,7 @@ else ac_cv_func_mmap_fixed_mapped=no else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:4955: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_func_mmap_fixed_mapped=yes else @@ -4984,7 +4980,7 @@ if test ${build} = ${host} -a ${host} = ${target} ; then case ${host_os} in hpux*) echo $ac_n "checking for HPUX/OSF thread support""... $ac_c" 1>&6 -echo "configure:4988: checking for HPUX/OSF thread support" >&5 +echo "configure:4984: checking for HPUX/OSF thread support" >&5 if test -f /usr/include/dce/cma_config.h ; then if test "$GCC" = "yes" ; then echo "$ac_t""yes" 1>&6 @@ -5003,7 +4999,7 @@ EOF ;; solaris*) echo $ac_n "checking for Solaris thread debugging library""... $ac_c" 1>&6 -echo "configure:5007: checking for Solaris thread debugging library" >&5 +echo "configure:5003: checking for Solaris thread debugging library" >&5 if test -f /usr/lib/libthread_db.so.1 ; then echo "$ac_t""yes" 1>&6 cat >> confdefs.h <<\EOF @@ -5013,7 +5009,7 @@ EOF CONFIG_OBS="${CONFIG_OBS} sol-thread.o" CONFIG_SRCS="${CONFIG_SRCS} sol-thread.c" echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6 -echo "configure:5017: checking for dlopen in -ldl" >&5 +echo "configure:5013: checking for dlopen in -ldl" >&5 ac_lib_var=`echo dl'_'dlopen | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -5021,7 +5017,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ldl $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5032: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -5064,17 +5060,17 @@ fi # all symbols visible in the dynamic symbol table. hold_ldflags=$LDFLAGS echo $ac_n "checking for the ld -export-dynamic flag""... $ac_c" 1>&6 -echo "configure:5068: checking for the ld -export-dynamic flag" >&5 +echo "configure:5064: checking for the ld -export-dynamic flag" >&5 LDFLAGS="${LDFLAGS} -Wl,-export-dynamic" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5074: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* found=yes else @@ -5093,13 +5089,13 @@ rm -f conftest* # Sun randomly tweaked the prototypes in # at one point. echo $ac_n "checking if is old""... $ac_c" 1>&6 -echo "configure:5097: checking if is old" >&5 +echo "configure:5093: checking if is old" >&5 if eval "test \"`echo '$''{'gdb_cv_proc_service_is_old'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < @@ -5110,7 +5106,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:5114: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5110: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* gdb_cv_proc_service_is_old=no else @@ -5256,12 +5252,12 @@ fi # In the Cygwin environment, we need some additional flags. echo $ac_n "checking for cygwin""... $ac_c" 1>&6 -echo "configure:5383: checking for cygwin" >&5 +echo "configure:5379: checking for cygwin" >&5 if eval "test \"`echo '$''{'gdb_cv_os_cygwin'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&6 -echo "configure:5422: checking for tgetent in -lncurses" >&5 +echo "configure:5418: checking for tgetent in -lncurses" >&5 ac_lib_var=`echo ncurses'_'tgetent | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -5303,7 +5299,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lncurses $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5437: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -5333,7 +5329,7 @@ if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then else echo "$ac_t""no" 1>&6 echo $ac_n "checking for tgetent in -lHcurses""... $ac_c" 1>&6 -echo "configure:5460: checking for tgetent in -lHcurses" >&5 +echo "configure:5456: checking for tgetent in -lHcurses" >&5 ac_lib_var=`echo Hcurses'_'tgetent | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -5341,7 +5337,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lHcurses $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5475: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -5371,7 +5367,7 @@ if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then else echo "$ac_t""no" 1>&6 echo $ac_n "checking for tgetent in -ltermlib""... $ac_c" 1>&6 -echo "configure:5498: checking for tgetent in -ltermlib" >&5 +echo "configure:5494: checking for tgetent in -ltermlib" >&5 ac_lib_var=`echo termlib'_'tgetent | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -5379,7 +5375,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ltermlib $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5513: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -5409,7 +5405,7 @@ if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then else echo "$ac_t""no" 1>&6 echo $ac_n "checking for tgetent in -ltermcap""... $ac_c" 1>&6 -echo "configure:5536: checking for tgetent in -ltermcap" >&5 +echo "configure:5532: checking for tgetent in -ltermcap" >&5 ac_lib_var=`echo termcap'_'tgetent | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -5417,7 +5413,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ltermcap $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5551: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -5447,7 +5443,7 @@ if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then else echo "$ac_t""no" 1>&6 echo $ac_n "checking for tgetent in -lcurses""... $ac_c" 1>&6 -echo "configure:5574: checking for tgetent in -lcurses" >&5 +echo "configure:5570: checking for tgetent in -lcurses" >&5 ac_lib_var=`echo curses'_'tgetent | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -5455,7 +5451,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lcurses $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5589: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -5485,7 +5481,7 @@ if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then else echo "$ac_t""no" 1>&6 echo $ac_n "checking for tgetent in -lterminfo""... $ac_c" 1>&6 -echo "configure:5612: checking for tgetent in -lterminfo" >&5 +echo "configure:5608: checking for tgetent in -lterminfo" >&5 ac_lib_var=`echo terminfo'_'tgetent | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -5493,7 +5489,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lterminfo $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5627: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -5555,12 +5551,54 @@ fi +# Check whether --with-cpu or --without-cpu was given. +if test "${with_cpu+set}" = set; then + withval="$with_cpu" + case "${target}" in + powerpc-* | powerpcle-* ) + ## It would be nice to keep this table in sync with the one in + ## gcc/configure. + case "${with_cpu}" in + ppc-uisa | rs6000 | 403 | 403GC | 505 | 860 | 601 | 602 | 603 \ + | 604 | 750 ) + ## Those are all handled in variants in rs6000-tdep.c, so they're fine. + ;; + common | power | power2 | rios | rios1 | rios2 | rsc | rsc1 ) + ## These are all RS6000 variants, as far as GDB is concerned. + with_cpu=rs6000 + ;; + 603e | ec603e ) + with_cpu=603 + ;; + 604e ) + with_cpu=604 + ;; + * ) + echo "configure: warning: GDB: unknown --with-cpu value: \`${with_cpu}'; using \`ppc-uisa'." 1>&2 + with_cpu=ppc-uisa + ;; + esac + ;; + * ) + echo "configure: warning: GDB may ignore the --with-cpu flag for ${target} targets" 1>&2 + ;; +esac +cat >> confdefs.h <&6 -echo "configure:6771: checking for X" >&5 +echo "configure:6704: checking for X" >&5 # Check whether --with-x or --without-x was given. if test "${with_x+set}" = set; then @@ -5622,12 +5660,12 @@ if test "$ac_x_includes" = NO; then # First, try using that file with no special directory specified. cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:6838: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:6771: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -5696,14 +5734,14 @@ if test "$ac_x_libraries" = NO; then ac_save_LIBS="$LIBS" LIBS="-l$x_direct_test_library $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6847: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* LIBS="$ac_save_LIBS" # We can link X programs with no special library path. @@ -5983,12 +6021,12 @@ fi echo $ac_n "checking for Cygwin environment""... $ac_c" 1>&6 -echo "configure:7265: checking for Cygwin environment" >&5 +echo "configure:7198: checking for Cygwin environment" >&5 if eval "test \"`echo '$''{'ac_cv_cygwin'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:7214: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_cygwin=yes else @@ -6016,19 +6054,19 @@ echo "$ac_t""$ac_cv_cygwin" 1>&6 CYGWIN= test "$ac_cv_cygwin" = yes && CYGWIN=yes echo $ac_n "checking for mingw32 environment""... $ac_c" 1>&6 -echo "configure:7298: checking for mingw32 environment" >&5 +echo "configure:7231: checking for mingw32 environment" >&5 if eval "test \"`echo '$''{'ac_cv_mingw32'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:7243: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_mingw32=yes else @@ -6047,7 +6085,7 @@ test "$ac_cv_mingw32" = yes && MINGW32=yes echo $ac_n "checking for executable suffix""... $ac_c" 1>&6 -echo "configure:7329: checking for executable suffix" >&5 +echo "configure:7262: checking for executable suffix" >&5 if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6057,7 +6095,7 @@ else rm -f conftest* echo 'int main () { return 0; }' > conftest.$ac_ext ac_cv_exeext= - if { (eval echo configure:7339: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then + if { (eval echo configure:7272: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then for file in conftest.*; do case $file in *.c | *.o | *.obj | *.ilk | *.pdb) ;; @@ -6271,15 +6309,8 @@ s%@DLLTOOL@%$DLLTOOL%g s%@WINDRES@%$WINDRES%g s%@TERM_LIB@%$TERM_LIB%g s%@WIN32LIBS@%$WIN32LIBS%g -s%@ENABLE_IDE@%$ENABLE_IDE%g -s%@FOUNDRY_LIB_BASE@%$FOUNDRY_LIB_BASE%g s%@LIBGUI@%$LIBGUI%g s%@GUI_CFLAGS_X@%$GUI_CFLAGS_X%g -s%@IDE_CFLAGS_X@%$IDE_CFLAGS_X%g -s%@IDE_X@%$IDE_X%g -s%@LIBIDETCL@%$LIBIDETCL%g -s%@LIBIDE@%$LIBIDE%g -s%@IDE_DEPS@%$IDE_DEPS%g s%@WIN32LDAPP@%$WIN32LDAPP%g s%@TCL_VERSION@%$TCL_VERSION%g s%@TCL_MAJOR_VERSION@%$TCL_MAJOR_VERSION%g diff --git a/gdb/configure.in b/gdb/configure.in index e8d6c3b..1046d2e 100644 --- a/gdb/configure.in +++ b/gdb/configure.in @@ -497,6 +497,42 @@ fi AC_SUBST(WIN32LIBS) +AC_ARG_WITH(cpu, +[ --with-cpu=CPU Set the default CPU variant to debug], +[case "${target}" in + powerpc-* | powerpcle-* ) + ## It would be nice to keep this table in sync with the one in + ## gcc/configure. + case "${with_cpu}" in + ppc-uisa | rs6000 | 403 | 403GC | 505 | 860 | 601 | 602 | 603 \ + | 604 | 750 ) + ## Those are all handled in variants in rs6000-tdep.c, so they're fine. + ;; + common | power | power2 | rios | rios1 | rios2 | rsc | rsc1 ) + ## These are all RS6000 variants, as far as GDB is concerned. + with_cpu=rs6000 + ;; + 603e | ec603e ) + with_cpu=603 + ;; + 604e ) + with_cpu=604 + ;; + * ) + AC_MSG_WARN(GDB: unknown --with-cpu value: \`${with_cpu}'; using \`ppc-uisa'.) + with_cpu=ppc-uisa + ;; + esac + ;; + * ) + AC_MSG_WARN(GDB may ignore the --with-cpu flag for ${target} targets) + ;; +esac +AC_DEFINE_UNQUOTED(TARGET_CPU_DEFAULT, "${with_cpu}") +],) + + + AC_PATH_X diff --git a/gdb/defs.h b/gdb/defs.h index 47e9dfe..8d59246 100644 --- a/gdb/defs.h +++ b/gdb/defs.h @@ -1113,6 +1113,7 @@ extern CORE_ADDR push_word (CORE_ADDR, ULONGEST); extern int watchdog; /* Hooks for alternate command interfaces. */ + struct target_waitstatus; struct cmd_list_element; @@ -1270,4 +1271,10 @@ enum gdb_rc gdb_breakpoint (char *address, char *condition, int thread, int ignore_count); enum gdb_rc gdb_thread_select (/* output object */ char *tidstr); +#ifdef UI_OUT +/* Print a list of known thread ids. */ +enum gdb_rc gdb_list_thread_ids (/* output object */); + +/* Switch thread and print notification. */ +#endif #endif /* #ifndef DEFS_H */ diff --git a/gdb/event-top.c b/gdb/event-top.c index 3d21a1a..4fbd6a0 100644 --- a/gdb/event-top.c +++ b/gdb/event-top.c @@ -246,7 +246,6 @@ display_gdb_prompt (char *new_prompt) int prompt_length = 0; char *gdb_prompt = get_prompt (); - if (target_executing && sync_execution) { /* This is to trick readline into not trying to display the diff --git a/gdb/gdbcmd.h b/gdb/gdbcmd.h index b801f08..0441f31 100644 --- a/gdb/gdbcmd.h +++ b/gdb/gdbcmd.h @@ -20,6 +20,9 @@ #define GDBCMD_H 1 #include "command.h" +#ifdef UI_OUT +#include "ui-out.h" +#endif /* Chain containing all defined commands. */ @@ -108,6 +111,10 @@ execute_control_command PARAMS ((struct command_line *)); extern void print_command_line (struct command_line *, unsigned int, struct ui_file *); +#ifdef UI_OUT +extern void print_command_lines PARAMS ((struct ui_out *, + struct command_line *, unsigned int)); +#endif extern char **noop_completer PARAMS ((char *, char *)); diff --git a/gdb/infcmd.c b/gdb/infcmd.c index 082d957..fb43984 100644 --- a/gdb/infcmd.c +++ b/gdb/infcmd.c @@ -34,6 +34,9 @@ #include "language.h" #include "symfile.h" #include "objfiles.h" +#ifdef UI_OUT +#include "ui-out.h" +#endif #include "event-top.h" #include "parser-defs.h" @@ -317,6 +320,16 @@ Start it from the beginning? ")) if (from_tty) { +#ifdef UI_OUT + ui_out_field_string (uiout, NULL, "Starting program"); + ui_out_text (uiout, ": "); + if (exec_file) + ui_out_field_string (uiout, "execfile", exec_file); + ui_out_spaces (uiout, 1); + ui_out_field_string (uiout, "infargs", inferior_args); + ui_out_text (uiout, "\n"); + ui_out_flush (uiout); +#else puts_filtered ("Starting program: "); if (exec_file) puts_filtered (exec_file); @@ -324,6 +337,7 @@ Start it from the beginning? ")) puts_filtered (inferior_args); puts_filtered ("\n"); gdb_flush (gdb_stdout); +#endif } target_create_inferior (exec_file, inferior_args, @@ -1030,13 +1044,26 @@ static void print_return_value (int structure_return, struct type *value_type) { register value_ptr value; +#ifdef UI_OUT + static struct ui_stream *stb = NULL; +#endif /* UI_OUT */ if (!structure_return) { value = value_being_returned (value_type, stop_registers, structure_return); +#ifdef UI_OUT + stb = ui_out_stream_new (uiout); + ui_out_text (uiout, "Value returned is "); + ui_out_field_fmt (uiout, "gdb-result-var", "$%d", record_latest_value (value)); + ui_out_text (uiout, "= "); + value_print (value, stb->stream, 0, Val_no_prettyprint); + ui_out_field_stream (uiout, "return-value", stb); + ui_out_text (uiout, "\n"); +#else /* UI_OUT */ printf_filtered ("Value returned is $%d = ", record_latest_value (value)); value_print (value, gdb_stdout, 0, Val_no_prettyprint); printf_filtered ("\n"); +#endif /* UI_OUT */ } else { @@ -1045,14 +1072,31 @@ print_return_value (int structure_return, struct type *value_type) initiate the call, as opposed to the call_function_by_hand case */ #ifdef VALUE_RETURNED_FROM_STACK value = 0; +#ifdef UI_OUT + ui_out_text (uiout, "Value returned has type: "); + ui_out_field_string (uiout, "return-type", TYPE_NAME (value_type)); + ui_out_text (uiout, "."); + ui_out_text (uiout, " Cannot determine contents\n"); +#else /* UI_OUT */ printf_filtered ("Value returned has type: %s.", TYPE_NAME (value_type)); printf_filtered (" Cannot determine contents\n"); +#endif /* UI_OUT */ #else value = value_being_returned (value_type, stop_registers, structure_return); +#ifdef UI_OUT + stb = ui_out_stream_new (uiout); + ui_out_text (uiout, "Value returned is "); + ui_out_field_fmt (uiout, "gdb-result-var", "$%d", record_latest_value (value)); + ui_out_text (uiout, "= "); + value_print (value, stb->stream, 0, Val_no_prettyprint); + ui_out_field_stream (uiout, "return-value", stb); + ui_out_text (uiout, "\n"); +#else printf_filtered ("Value returned is $%d = ", record_latest_value (value)); value_print (value, gdb_stdout, 0, Val_no_prettyprint); printf_filtered ("\n"); #endif +#endif } } @@ -1760,6 +1804,15 @@ detach_command (args, from_tty) /* Stop the execution of the target while running in async mode, in the backgound. */ +#ifdef UI_OUT +void +interrupt_target_command_wrapper (args, from_tty) + char *args; + int from_tty; +{ + interrupt_target_command (args, from_tty); +} +#endif static void interrupt_target_command (args, from_tty) char *args; diff --git a/gdb/infrun.c b/gdb/infrun.c index 549c515..57ab576 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -1441,7 +1441,13 @@ handle_inferior_event (struct execution_control_state *ecs) { add_thread (ecs->pid); +#ifdef UI_OUT + ui_out_text (uiout, "[New "); + ui_out_text (uiout, target_pid_or_tid_to_str (ecs->pid)); + ui_out_text (uiout, "]\n"); +#else printf_filtered ("[New %s]\n", target_pid_or_tid_to_str (ecs->pid)); +#endif #if 0 /* NOTE: This block is ONLY meant to be invoked in case of a @@ -3223,6 +3229,19 @@ print_stop_reason (enum inferior_stop_reason stop_reason, int stop_info) break; case SIGNAL_EXITED: /* The inferior was terminated by a signal. */ +#ifdef UI_OUT + annotate_signalled (); + ui_out_text (uiout, "\nProgram terminated with signal "); + annotate_signal_name (); + ui_out_field_string (uiout, "signal-name", target_signal_to_name (stop_info)); + annotate_signal_name_end (); + ui_out_text (uiout, ", "); + annotate_signal_string (); + ui_out_field_string (uiout, "signal-meaning", target_signal_to_string (stop_info)); + annotate_signal_string_end (); + ui_out_text (uiout, ".\n"); + ui_out_text (uiout, "The program no longer exists.\n"); +#else annotate_signalled (); printf_filtered ("\nProgram terminated with signal "); annotate_signal_name (); @@ -3236,19 +3255,46 @@ print_stop_reason (enum inferior_stop_reason stop_reason, int stop_info) printf_filtered ("The program no longer exists.\n"); gdb_flush (gdb_stdout); +#endif break; case EXITED: /* The inferior program is finished. */ +#ifdef UI_OUT + annotate_exited (stop_info); + if (stop_info) + { + ui_out_text (uiout, "\nProgram exited with code "); + ui_out_field_fmt (uiout, "exit-code", "0%o", (unsigned int) stop_info); + ui_out_text (uiout, ".\n"); + } + else + { + ui_out_text (uiout, "\nProgram exited normally.\n"); + } +#else annotate_exited (stop_info); if (stop_info) printf_filtered ("\nProgram exited with code 0%o.\n", (unsigned int) stop_info); else printf_filtered ("\nProgram exited normally.\n"); +#endif break; case SIGNAL_RECEIVED: /* Signal received. The signal table tells us to print about it. */ +#ifdef UI_OUT + annotate_signal (); + ui_out_text (uiout, "\nProgram received signal "); + annotate_signal_name (); + ui_out_field_string (uiout, "signal-name", target_signal_to_name (stop_info)); + annotate_signal_name_end (); + ui_out_text (uiout, ", "); + annotate_signal_string (); + ui_out_field_string (uiout, "signal-meaning", target_signal_to_string (stop_info)); + annotate_signal_string_end (); + ui_out_text (uiout, ".\n"); +#else annotate_signal (); printf_filtered ("\nProgram received signal "); annotate_signal_name (); @@ -3260,6 +3306,7 @@ print_stop_reason (enum inferior_stop_reason stop_reason, int stop_info) annotate_signal_string_end (); printf_filtered (".\n"); gdb_flush (gdb_stdout); +#endif break; default: internal_error ("print_stop_reason: unrecognized enum value"); diff --git a/gdb/main.c b/gdb/main.c index c5c4e96..6c9baa3 100644 --- a/gdb/main.c +++ b/gdb/main.c @@ -32,6 +32,7 @@ #include "gdb_string.h" #include "event-loop.h" +#include "ui-out.h" #if defined (TUI) || defined (GDBTK) /* FIXME: cagney/2000-01-31: This #include is to allow older code such as that found in the TUI to continue to build. */ @@ -254,6 +255,9 @@ captured_main (void *data) {"command", required_argument, 0, 'x'}, {"version", no_argument, &print_version, 1}, {"x", required_argument, 0, 'x'}, + {"ui", required_argument, 0, 'i'}, + {"interpreter", required_argument, 0, 'i'}, + {"i", required_argument, 0, 'i'}, {"directory", required_argument, 0, 'd'}, {"d", required_argument, 0, 'd'}, {"cd", required_argument, 0, 11}, @@ -739,6 +743,10 @@ Options:\n\n\ --help Print this message.\n\ ", stream); fputs_unfiltered ("\ + --interpreter=INTERP\n\ + Select a specific interpreter / user interface\n\ +", stream); + fputs_unfiltered ("\ --mapped Use mapped symbol files if supported on this system.\n\ --nw Do not use a window interface.\n\ --nx Do not read ", stream); diff --git a/gdb/printcmd.c b/gdb/printcmd.c index 9fac1f3..0528e2b 100644 --- a/gdb/printcmd.c +++ b/gdb/printcmd.c @@ -35,6 +35,9 @@ #include "annotate.h" #include "symfile.h" /* for overlay functions */ #include "objfiles.h" /* ditto */ +#ifdef UI_OUT +#include "ui-out.h" +#endif extern int asm_demangle; /* Whether to demangle syms in asm printouts */ extern int addressprint; /* Whether to print hex addresses in HLL " */ @@ -1777,6 +1780,13 @@ print_frame_args (func, fi, num, stream) int arg_size; /* Number of ints of arguments that we have printed so far. */ int args_printed = 0; +#ifdef UI_OUT + struct cleanup *old_chain; + struct ui_stream *stb; + + stb = ui_out_stream_new (uiout); + old_chain = make_cleanup ((make_cleanup_func) ui_out_stream_delete, stb); +#endif /* UI_OUT */ if (func) { @@ -1881,6 +1891,21 @@ print_frame_args (func, fi, num, stream) sym = nsym; } +#ifdef UI_OUT + /* Print the current arg. */ + if (!first) + ui_out_text (uiout, ", "); + ui_out_wrap_hint (uiout, " "); + + annotate_arg_begin (); + + ui_out_list_begin (uiout, NULL); + fprintf_symbol_filtered (stb->stream, SYMBOL_SOURCE_NAME (sym), + SYMBOL_LANGUAGE (sym), DMGL_PARAMS | DMGL_ANSI); + ui_out_field_stream (uiout, "name", stb); + annotate_arg_name_end (); + ui_out_text (uiout, "="); +#else /* Print the current arg. */ if (!first) fprintf_filtered (stream, ", "); @@ -1892,6 +1917,7 @@ print_frame_args (func, fi, num, stream) SYMBOL_LANGUAGE (sym), DMGL_PARAMS | DMGL_ANSI); annotate_arg_name_end (); fputs_filtered ("=", stream); +#endif /* Avoid value_print because it will deref ref parameters. We just want to print their addresses. Print ??? for args whose address @@ -1907,12 +1933,24 @@ print_frame_args (func, fi, num, stream) if (GDB_TARGET_IS_D10V && SYMBOL_CLASS (sym) == LOC_REGPARM && TYPE_CODE (VALUE_TYPE (val)) == TYPE_CODE_PTR) TYPE_LENGTH (VALUE_TYPE (val)) = 2; +#ifdef UI_OUT + val_print (VALUE_TYPE (val), VALUE_CONTENTS (val), 0, + VALUE_ADDRESS (val), + stb->stream, 0, 0, 2, Val_no_prettyprint); + ui_out_field_stream (uiout, "value", stb); + } + else + ui_out_text (uiout, "???"); + + ui_out_list_end (uiout); +#else val_print (VALUE_TYPE (val), VALUE_CONTENTS (val), 0, VALUE_ADDRESS (val), stream, 0, 0, 2, Val_no_prettyprint); } else fputs_filtered ("???", stream); +#endif annotate_arg_end (); @@ -1933,6 +1971,9 @@ print_frame_args (func, fi, num, stream) print_frame_nameless_args (fi, start, num - args_printed, first, stream); } +#ifdef UI_OUT + do_cleanups (old_chain); +#endif /* no UI_OUT */ } /* Print nameless args on STREAM. diff --git a/gdb/remote.c b/gdb/remote.c index 72ff24d..674a03e 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -758,7 +758,13 @@ record_currthread (currthread) if (!in_thread_list (currthread)) { add_thread (currthread); +#ifdef UI_OUT + ui_out_text (uiout, "[New "); + ui_out_text (uiout, target_pid_to_str (currthread)); + ui_out_text (uiout, "]\n"); +#else printf_filtered ("[New %s]\n", target_pid_to_str (currthread)); +#endif } } diff --git a/gdb/source.c b/gdb/source.c index 358cac9..dd26043 100644 --- a/gdb/source.c +++ b/gdb/source.c @@ -38,6 +38,9 @@ #include "objfiles.h" #include "annotate.h" #include "gdbtypes.h" +#ifdef UI_OUT +#include "ui-out.h" +#endif #ifdef CRLF_SOURCE_FILES @@ -1011,6 +1014,11 @@ print_source_lines_base (s, line, stopline, noerror) current_source_line = line; first_line_listed = line; +#ifdef UI_OUT + /* If printing of source lines is disabled, just print file and line number */ + if (ui_out_test_flags (uiout, ui_source_list)) + { +#endif /* Only prints "No such file or directory" once */ if ((s != last_source_visited) || (!last_source_error)) { @@ -1022,6 +1030,14 @@ print_source_lines_base (s, line, stopline, noerror) desc = last_source_error; noerror = 1; } +#ifdef UI_OUT + } + else + { + desc = -1; + noerror = 1; + } +#endif if (desc < 0) { @@ -1034,7 +1050,14 @@ print_source_lines_base (s, line, stopline, noerror) print_sys_errmsg (name, errno); } else +#ifdef UI_OUT + ui_out_field_int (uiout, "line", line); + ui_out_text (uiout, "\tin "); + ui_out_field_string (uiout, "file", s->filename); + ui_out_text (uiout, "\n"); +#else printf_filtered ("%d\tin %s\n", line, s->filename); +#endif return; } @@ -1062,6 +1085,44 @@ print_source_lines_base (s, line, stopline, noerror) while (nlines-- > 0) { +#ifdef UI_OUT + char buf[20]; + + c = fgetc (stream); + if (c == EOF) + break; + last_line_listed = current_source_line; + sprintf (buf, "%d\t", current_source_line++); + ui_out_text (uiout, buf); + do + { + if (c < 040 && c != '\t' && c != '\n' && c != '\r') + { + sprintf (buf, "^%c", c + 0100); + ui_out_text (uiout, buf); + } + else if (c == 0177) + ui_out_text (uiout, "^?"); +#ifdef CRLF_SOURCE_FILES + else if (c == '\r') + { + /* Skip a \r character, but only before a \n. */ + int c1 = fgetc (stream); + + if (c1 != '\n') + printf_filtered ("^%c", c + 0100); + if (c1 != EOF) + ungetc (c1, stream); + } +#endif + else + { + sprintf (buf, "%c", c); + ui_out_text (uiout, buf); + } + } + while (c != '\n' && (c = fgetc (stream)) >= 0); +#else c = fgetc (stream); if (c == EOF) break; @@ -1083,6 +1144,7 @@ print_source_lines_base (s, line, stopline, noerror) printf_filtered ("%c", c); } while (c != '\n' && (c = fgetc (stream)) >= 0); +#endif } fclose (stream); diff --git a/gdb/stack.c b/gdb/stack.c index 7e414c5..f0cae6e 100644 --- a/gdb/stack.c +++ b/gdb/stack.c @@ -36,6 +36,9 @@ #include "annotate.h" #include "symfile.h" #include "objfiles.h" +#ifdef UI_OUT +#include "ui-out.h" +#endif /* Prototypes for exported functions. */ @@ -429,8 +432,13 @@ print_frame_info_base (fi, level, source, args) { if (addressprint && mid_statement && !tui_version) { +#ifdef UI_OUT + ui_out_field_core_addr (uiout, "addr", fi->pc); + ui_out_text (uiout, "\t"); +#else print_address_numeric (fi->pc, 1, gdb_stdout); printf_filtered ("\t"); +#endif } if (print_frame_info_listing_hook) print_frame_info_listing_hook (sal.symtab, sal.line, sal.line + 1, 0); @@ -458,6 +466,13 @@ print_frame (struct frame_info *fi, struct symbol *func; register char *funname = 0; enum language funlang = language_unknown; +#ifdef UI_OUT + struct ui_stream *stb; + struct cleanup *old_chain; + + stb = ui_out_stream_new (uiout); + old_chain = make_cleanup ((make_cleanup_func) ui_out_stream_delete, stb); +#endif /* UI_OUT */ func = find_pc_function (fi->pc); if (func) @@ -536,37 +551,87 @@ print_frame (struct frame_info *fi, annotate_frame_begin (level == -1 ? 0 : level, fi->pc); +#ifdef UI_OUT + ui_out_list_begin (uiout, "frame"); +#endif if (level >= 0) - printf_filtered ("#%-2d ", level); + { +#ifdef UI_OUT + ui_out_text (uiout, "#"); + ui_out_field_fmt (uiout, "level", "%-2d", level); + ui_out_spaces (uiout, 1); +#else + printf_filtered ("#%-2d ", level); +#endif + } if (addressprint) if (fi->pc != sal.pc || !sal.symtab || source == LOC_AND_ADDRESS) { annotate_frame_address (); +#ifdef UI_OUT + ui_out_field_core_addr (uiout, "addr", fi->pc); + annotate_frame_address_end (); + ui_out_text (uiout, " in "); +#else print_address_numeric (fi->pc, 1, gdb_stdout); annotate_frame_address_end (); printf_filtered (" in "); +#endif } annotate_frame_function_name (); +#ifdef UI_OUT + fprintf_symbol_filtered (stb->stream, funname ? funname : "??", funlang, + DMGL_ANSI); + ui_out_field_stream (uiout, "func", stb); + ui_out_wrap_hint (uiout, " "); +#else fprintf_symbol_filtered (gdb_stdout, funname ? funname : "??", funlang, DMGL_ANSI); wrap_here (" "); +#endif annotate_frame_args (); +#ifdef UI_OUT + ui_out_text (uiout, " ("); +#else fputs_filtered (" (", gdb_stdout); +#endif if (args) { struct print_args_args args; args.fi = fi; args.func = func; args.stream = gdb_stdout; +#ifdef UI_OUT + ui_out_list_begin (uiout, "args"); catch_errors (print_args_stub, &args, "", RETURN_MASK_ALL); + /* FIXME: args must be a list. If one argument is a string it will + have " that will not be properly escaped. */ + ui_out_list_end (uiout); +#else + catch_errors (print_args_stub, &args, "", RETURN_MASK_ALL); +#endif QUIT; } +#ifdef UI_OUT + ui_out_text (uiout, ")"); +#else printf_filtered (")"); +#endif if (sal.symtab && sal.symtab->filename) { annotate_frame_source_begin (); +#ifdef UI_OUT + ui_out_wrap_hint (uiout, " "); + ui_out_text (uiout, " at "); + annotate_frame_source_file (); + ui_out_field_string (uiout, "file", sal.symtab->filename); + annotate_frame_source_file_end (); + ui_out_text (uiout, ":"); + annotate_frame_source_line (); + ui_out_field_int (uiout, "line", sal.line); +#else wrap_here (" "); printf_filtered (" at "); annotate_frame_source_file (); @@ -575,6 +640,7 @@ print_frame (struct frame_info *fi, printf_filtered (":"); annotate_frame_source_line (); printf_filtered ("%d", sal.line); +#endif annotate_frame_source_end (); } @@ -585,8 +651,14 @@ print_frame (struct frame_info *fi, if (!funname) { annotate_frame_where (); +#ifdef UI_OUT + ui_out_wrap_hint (uiout, " "); + ui_out_text (uiout, " from "); + ui_out_field_string (uiout, "from", PC_LOAD_SEGMENT (fi->pc)); +#else wrap_here (" "); printf_filtered (" from %s", PC_LOAD_SEGMENT (fi->pc)); +#endif } #endif /* PC_LOAD_SEGMENT */ @@ -597,13 +669,25 @@ print_frame (struct frame_info *fi, if (lib) { annotate_frame_where (); +#ifdef UI_OUT + ui_out_wrap_hint (uiout, " "); + ui_out_text (uiout, " from "); + ui_out_field_string (uiout, "from", lib); +#else wrap_here (" "); printf_filtered (" from %s", lib); +#endif } } #endif /* PC_SOLIB */ +#ifdef UI_OUT + ui_out_list_end (uiout); + ui_out_text (uiout, "\n"); + do_cleanups (old_chain); +#else printf_filtered ("\n"); +#endif } @@ -1649,6 +1733,15 @@ find_relative_frame (frame, level_offset_ptr) frame expressions. */ /* ARGSUSED */ +#ifdef UI_OUT +void +select_frame_command_wrapper (level_exp, from_tty) + char *level_exp; + int from_tty; +{ + select_frame_command (level_exp, from_tty); +} +#endif static void select_frame_command (level_exp, from_tty) char *level_exp; @@ -1798,6 +1891,15 @@ down_command (count_exp, from_tty) show_and_print_stack_frame (selected_frame, selected_frame_level, 1); } +#ifdef UI_OUT +void +return_command_wrapper (retval_exp, from_tty) + char *retval_exp; + int from_tty; +{ + return_command (retval_exp, from_tty); +} +#endif static void return_command (retval_exp, from_tty) char *retval_exp; diff --git a/gdb/symfile.c b/gdb/symfile.c index 0726d1a..5b2a2ff 100644 --- a/gdb/symfile.c +++ b/gdb/symfile.c @@ -1299,9 +1299,14 @@ generic_load (char *args, int from_tty) /* Is this really necessary? I guess it gives the user something to look at during a long download. */ +#ifdef UI_OUT + ui_out_message (uiout, 0, "Loading section %s, size 0x%s lma 0x%s\n", + sect_name, paddr_nz (size), paddr_nz (lma)); +#else fprintf_unfiltered (gdb_stdout, "Loading section %s, size 0x%s lma 0x%s\n", sect_name, paddr_nz (size), paddr_nz (lma)); +#endif bfd_get_section_contents (loadfile_bfd, s, buffer, 0, size); @@ -1364,9 +1369,18 @@ generic_load (char *args, int from_tty) { CORE_ADDR entry; entry = bfd_get_start_address (loadfile_bfd); +#ifdef UI_OUT + ui_out_text (uiout, "Start address "); + ui_out_field_fmt (uiout, "address", "0x%s" , paddr_nz (entry)); + ui_out_text (uiout, ", load size "); + ui_out_field_fmt (uiout, "load-size", "%ld" , data_count); + ui_out_text (uiout, "\n"); + +#else fprintf_unfiltered (gdb_stdout, "Start address 0x%s , load size %ld\n", paddr_nz (entry), data_count); +#endif /* We were doing this in remote-mips.c, I suspect it is right for other targets too. */ write_pc (entry); @@ -1404,6 +1418,27 @@ print_transfer_performance (struct ui_file *stream, unsigned long write_count, unsigned long time_count) { +#ifdef UI_OUT + ui_out_text (uiout, "Transfer rate: "); + if (time_count > 0) + { + ui_out_field_fmt (uiout, "transfer-rate", "%ld", + (data_count * 8) / time_count); + ui_out_text (uiout, " bits/sec"); + } + else + { + ui_out_field_fmt (uiout, "transferred-bits", "%ld", (data_count * 8)); + ui_out_text (uiout, " bits in <1 sec"); + } + if (write_count > 0) + { + ui_out_text (uiout, ", "); + ui_out_field_fmt (uiout, "write-rate", "%ld", data_count / write_count); + ui_out_text (uiout, " bytes/write"); + } + ui_out_text (uiout, ".\n"); +#else fprintf_unfiltered (stream, "Transfer rate: "); if (time_count > 0) fprintf_unfiltered (stream, "%ld bits/sec", (data_count * 8) / time_count); @@ -1412,6 +1447,7 @@ print_transfer_performance (struct ui_file *stream, if (write_count > 0) fprintf_unfiltered (stream, ", %ld bytes/write", data_count / write_count); fprintf_unfiltered (stream, ".\n"); +#endif } /* This function allows the addition of incrementally linked object files. diff --git a/gdb/symtab.c b/gdb/symtab.c index 91febd6..ceaa108 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -4031,6 +4031,15 @@ methods_info (regexp) #endif /* 0 */ /* Breakpoint all functions matching regular expression. */ +#ifdef UI_OUT +void +rbreak_command_wrapper (regexp, from_tty) + char *regexp; + int from_tty; +{ + rbreak_command (regexp, from_tty); +} +#endif static void rbreak_command (regexp, from_tty) char *regexp; diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 27c1004..b4d5d01 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,14 @@ +2000-02-02 Fernando Nasser + + * gdb.base/step-test.exp: Fix the steps to enter a callee by means + of successive stepi commands -- while in the prologue we should see + the function entry bracket. + +2000-02-02 Fernando Nasser + + * gdb.base/ending-run.exp: Add ARM in thumb mode case, where we + reach __change_mode() when stepping through the end of main(). + 2000-01-17 Fernando Nasser * gdb.base/default.exp: Fix expected pattern. diff --git a/gdb/testsuite/configure b/gdb/testsuite/configure index 519e32b..19ddd89 100755 --- a/gdb/testsuite/configure +++ b/gdb/testsuite/configure @@ -32,6 +32,7 @@ program_suffix=NONE program_transform_name=s,x,x, silent= site= +sitefile= srcdir= target=NONE verbose= @@ -146,6 +147,7 @@ Configuration: --help print this message --no-create do not create output files --quiet, --silent do not print \`checking...' messages + --site-file=FILE use FILE as the site file --version print the version of autoconf that created configure Directory and file names: --prefix=PREFIX install architecture-independent files in PREFIX @@ -316,6 +318,11 @@ EOF -site=* | --site=* | --sit=*) site="$ac_optarg" ;; + -site-file | --site-file | --site-fil | --site-fi | --site-f) + ac_prev=sitefile ;; + -site-file=* | --site-file=* | --site-fil=* | --site-fi=* | --site-f=*) + sitefile="$ac_optarg" ;; + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) @@ -481,12 +488,16 @@ fi srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'` # Prefer explicitly selected file to automatically selected ones. -if test -z "$CONFIG_SITE"; then - if test "x$prefix" != xNONE; then - CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" - else - CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" +if test -z "$sitefile"; then + if test -z "$CONFIG_SITE"; then + if test "x$prefix" != xNONE; then + CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" + else + CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" + fi fi +else + CONFIG_SITE="$sitefile" fi for ac_site_file in $CONFIG_SITE; do if test -r "$ac_site_file"; then @@ -575,7 +586,7 @@ else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; } fi echo $ac_n "checking host system type""... $ac_c" 1>&6 -echo "configure:579: checking host system type" >&5 +echo "configure:590: checking host system type" >&5 host_alias=$host case "$host_alias" in @@ -596,7 +607,7 @@ host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` echo "$ac_t""$host" 1>&6 echo $ac_n "checking target system type""... $ac_c" 1>&6 -echo "configure:600: checking target system type" >&5 +echo "configure:611: checking target system type" >&5 target_alias=$target case "$target_alias" in @@ -614,7 +625,7 @@ target_os=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` echo "$ac_t""$target" 1>&6 echo $ac_n "checking build system type""... $ac_c" 1>&6 -echo "configure:618: checking build system type" >&5 +echo "configure:629: checking build system type" >&5 build_alias=$build case "$build_alias" in diff --git a/gdb/testsuite/gdb.base/ending-run.exp b/gdb/testsuite/gdb.base/ending-run.exp index 0e76d89..ec0ea64 100644 --- a/gdb/testsuite/gdb.base/ending-run.exp +++ b/gdb/testsuite/gdb.base/ending-run.exp @@ -145,6 +145,10 @@ gdb_expect { # This is what happens on Solaris currently -sts 1999-08-25 pass "step out of main on Solaris" } + -re ".*in ..change.mode ().*$gdb_prompt $" { + # This is what happens on ARM in thumb mode -fn 2000-02-01 + pass "step out of main on ARM thumb" + } -re ".*in.*\\\$START\\\$.*from.*dld.sl.*$gdb_prompt $" { pass "step out of main" } diff --git a/gdb/testsuite/gdb.base/step-test.exp b/gdb/testsuite/gdb.base/step-test.exp index 903700e..c0acf81 100644 --- a/gdb/testsuite/gdb.base/step-test.exp +++ b/gdb/testsuite/gdb.base/step-test.exp @@ -142,6 +142,9 @@ test_i "stepi to next line" "stepi" \ test_i "stepi into function" "stepi" \ ".*${decimal}.*callee.*STEPI" \ ".*callee \\(\\) at .*step-test\\.c" +test_i "stepi to function first line" "stepi" \ + ".*int callee\\(\\) .*\\{" \ + ".*myglob.*" # Have to be careful here, if the finish does not work, # then we may run to the end of the program, which # will cause erroneous failures in the rest of the tests @@ -178,7 +181,7 @@ gdb_expect { return } timeout { - fail "stepi: finish call" + fail "stepi: finish call (timeout)" return } } diff --git a/gdb/thread.c b/gdb/thread.c index 0ef9a76..c910dbb 100644 --- a/gdb/thread.c +++ b/gdb/thread.c @@ -35,6 +35,9 @@ #include #include #include +#ifdef UI_OUT +#include "ui-out.h" +#endif /*#include "lynxos-core.h" */ @@ -250,6 +253,37 @@ in_thread_list (pid) return 0; /* Never heard of 'im */ } +#ifdef UI_OUT +/* Print a list of thread ids currently known, and the total number of + threads. To be used from within catch_errors. */ +static int +do_captured_list_thread_ids (void *arg) +{ + struct thread_info *tp; + int num = 0; + + ui_out_list_begin (uiout, "thread-ids"); + + for (tp = thread_list; tp; tp = tp->next) + { + num++; + ui_out_field_int (uiout, "thread-id", tp->num); + } + + ui_out_list_end (uiout); + ui_out_field_int (uiout, "number-of-threads", num); + return GDB_RC_OK; +} + +/* Official gdblib interface function to get a list of thread ids and + the total number. */ +enum gdb_rc +gdb_list_thread_ids (/* output object */) +{ + return catch_errors (do_captured_list_thread_ids, NULL, + NULL, RETURN_MASK_ALL); +} +#endif /* Load infrun state for the thread PID. */ @@ -633,15 +667,31 @@ do_captured_thread_select (void *tidstr) tp = find_thread_id (num); +#ifdef UI_OUT + if (!tp) + error ("Thread ID %d not known.", num); +#else if (!tp) error ("Thread ID %d not known. Use the \"info threads\" command to\n\ see the IDs of currently known threads.", num); +#endif if (!thread_alive (tp)) error ("Thread ID %d has terminated.\n", num); switch_to_thread (tp->pid); +#ifdef UI_OUT + ui_out_text (uiout, "[Switching to thread "); + ui_out_field_int (uiout, "new-thread-id", pid_to_thread_id (inferior_pid)); + ui_out_text (uiout, " ("); +#if defined(HPUXHPPA) + ui_out_text (uiout, target_tid_to_str (inferior_pid)); +#else + ui_out_text (uiout, target_pid_to_str (inferior_pid)); +#endif + ui_out_text (uiout, ")]"); +#else /* UI_OUT */ printf_filtered ("[Switching to thread %d (%s)]\n", pid_to_thread_id (inferior_pid), #if defined(HPUXHPPA) @@ -650,6 +700,7 @@ see the IDs of currently known threads.", num); target_pid_to_str (inferior_pid) #endif ); +#endif /* UI_OUT */ print_stack_frame (selected_frame, selected_frame_level, 1); return GDB_RC_OK; diff --git a/gdb/top.c b/gdb/top.c index 8a26c9e..2acbb74 100644 --- a/gdb/top.c +++ b/gdb/top.c @@ -50,6 +50,10 @@ #include "gdb_string.h" #include "gdb_stat.h" #include +#ifdef UI_OUT +#include "ui-out.h" +#include "cli-out.h" +#endif /* Prototypes for local functions */ @@ -774,8 +778,11 @@ gdb_init (argv0) set_language (language_c); expected_language = current_language; /* don't warn about the change. */ - /* All the interpreters should have had a look at things by now. - Initialize the selected interpreter. */ +#ifdef UI_OUT + /* Install the default UI */ + uiout = cli_out_new (gdb_stdout); +#endif + if (init_ui_hook) init_ui_hook (argv0); } @@ -835,6 +842,97 @@ get_command_line (type, arg) } /* Recursively print a command (including full control structures). */ +#ifdef UI_OUT +void +print_command_lines (uiout, cmd, depth) + struct ui_out *uiout; + struct command_line *cmd; + unsigned int depth; +{ + struct command_line *list; + + list = cmd; + while (list) + { + + if (depth) + ui_out_spaces (uiout, 2 * depth); + + /* A simple command, print it and continue. */ + if (list->control_type == simple_control) + { + ui_out_field_string (uiout, NULL, list->line); + ui_out_text (uiout, "\n"); + list = list->next; + continue; + } + + /* loop_continue to jump to the start of a while loop, print it + and continue. */ + if (list->control_type == continue_control) + { + ui_out_field_string (uiout, NULL, "loop_continue"); + ui_out_text (uiout, "\n"); + list = list->next; + continue; + } + + /* loop_break to break out of a while loop, print it and continue. */ + if (list->control_type == break_control) + { + ui_out_field_string (uiout, NULL, "loop_break"); + ui_out_text (uiout, "\n"); + list = list->next; + continue; + } + + /* A while command. Recursively print its subcommands and continue. */ + if (list->control_type == while_control) + { + ui_out_text (uiout, "while "); + ui_out_field_fmt (uiout, NULL, "while %s", list->line); + ui_out_text (uiout, "\n"); + print_command_lines (uiout, *list->body_list, depth + 1); + ui_out_field_string (uiout, NULL, "end"); + if (depth) + ui_out_spaces (uiout, 2 * depth); + ui_out_text (uiout, "end\n"); + list = list->next; + continue; + } + + /* An if command. Recursively print both arms before continueing. */ + if (list->control_type == if_control) + { + ui_out_text (uiout, "if "); + ui_out_field_fmt (uiout, NULL, "if %s", list->line); + ui_out_text (uiout, "\n"); + /* The true arm. */ + print_command_lines (uiout, list->body_list[0], depth + 1); + + /* Show the false arm if it exists. */ + if (list->body_count == 2) + { + if (depth) + ui_out_spaces (uiout, 2 * depth); + ui_out_field_string (uiout, NULL, "else"); + ui_out_text (uiout, "else\n"); + print_command_lines (uiout, list->body_list[1], depth + 1); + } + + ui_out_field_string (uiout, NULL, "end"); + if (depth) + ui_out_spaces (uiout, 2 * depth); + ui_out_text (uiout, "end\n"); + list = list->next; + continue; + } + + /* ignore illegal command type and try next */ + list = list->next; + } /* while (list) */ +} +#else void print_command_line (cmd, depth, stream) struct command_line *cmd; @@ -915,6 +1013,7 @@ print_command_line (cmd, depth, stream) fputs_filtered ("end\n", stream); } } +#endif /* Execute the command in CMD. */ @@ -1514,6 +1613,41 @@ command_loop () } } +/* Read commands from `instream' and execute them until end of file or + error reading instream. This command loop doesnt care about any + such things as displaying time and space usage. If the user asks + for those, they won't work. */ +void +simplified_command_loop (read_input_func, execute_command_func) + char *(*read_input_func) (char *); + void (*execute_command_func) (char *, int); +{ + struct cleanup *old_chain; + char *command; + int stdin_is_tty = ISATTY (stdin); + + while (instream && !feof (instream)) + { + quit_flag = 0; + if (instream == stdin && stdin_is_tty) + reinitialize_more_filter (); + old_chain = make_cleanup ((make_cleanup_func) command_loop_marker, 0); + + /* Get a command-line. */ + command = (*read_input_func) (instream == stdin ? + get_prompt () : (char *) NULL); + + if (command == 0) + return; + + (*execute_command_func) (command, instream == stdin); + + /* Do any commands attached to breakpoint we stopped at. */ + bpstat_do_actions (&stop_bpstat); + + do_cleanups (old_chain); + } +} /* Commands call this if they do not want to be repeated by null lines. */ @@ -2975,7 +3109,12 @@ print_gdb_version (stream) program to parse, and is just canonical program name and version number, which starts after last space. */ +#ifdef UI_OUT + /* Print it console style until a format is defined */ + fprintf_filtered (stream, "GNU gdb %s (UI_OUT)\n", version); +#else fprintf_filtered (stream, "GNU gdb %s\n", version); +#endif /* Second line is a copyright notice. */ diff --git a/gdb/top.h b/gdb/top.h index 9e962a3..42ee712 100644 --- a/gdb/top.h +++ b/gdb/top.h @@ -34,6 +34,8 @@ extern void cd_command PARAMS ((char *, int)); extern void read_command_file PARAMS ((FILE *)); extern void init_history PARAMS ((void)); extern void command_loop PARAMS ((void)); +extern void simplified_command_loop PARAMS ((char *(*read_input_func) (char *), + void (*execute_command_func) (char *, int))); extern int quit_confirm PARAMS ((void)); extern void quit_force PARAMS ((char *, int)); extern void quit_command PARAMS ((char *, int)); diff --git a/gdb/ui-out.c b/gdb/ui-out.c new file mode 100644 index 0000000..9e40011 --- /dev/null +++ b/gdb/ui-out.c @@ -0,0 +1,1007 @@ +/* Output generating routines for GDB. + Copyright 1999, 2000 Free Software Foundation, Inc. + Contributed by Cygnus Solutions. + Written by Fernando Nasser for Cygnus. + + This file is part of GDB. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include "defs.h" +#include "gdb_string.h" +#include "expression.h" /* For language.h */ +#include "language.h" +#include "ui-out.h" + +/* Convenience macro for allocting typesafe memory. */ + +#undef XMALLOC +#define XMALLOC(TYPE) (TYPE*) xmalloc (sizeof (TYPE)) + +/* table header structures */ + +struct ui_out_hdr + { + int colno; + int width; + int alignment; + char *colhdr; + struct ui_out_hdr *next; + }; + +/* The ui_out structure */ +/* Any change here requires a corresponding one in the initialization + of the default uiout, which is statically initialized */ + +struct ui_out + { + int flags; + /* specific implementation of ui-out */ + struct ui_out_impl *impl; + struct ui_out_data *data; + + /* if on, a table is being generated */ + int table_flag; + + /* if on, the body of a table is being generated */ + int body_flag; + + /* number of table columns (as specified in the table_begin call) */ + int table_columns; + + /* strinf identifying the table (as specified in the table_begin call) */ + char *table_id; + + /* if on, a list is being generated. The value is the level of nesting */ + int list_flag; + + /* we count each field; the first element is for non-list fields */ + int field_count[5]; + + /* points to the first header (if any) */ + struct ui_out_hdr *headerfirst; + + /* points to the last header (if any) */ + struct ui_out_hdr *headerlast; + + /* points to header of next column to format */ + struct ui_out_hdr *headercurr; + + }; + +/* These are the default implementation functions */ + +static void default_table_begin (struct ui_out *uiout, int nbrofcols, + char *tblid); +static void default_table_body (struct ui_out *uiout); +static void default_table_end (struct ui_out *uiout); +static void default_table_header (struct ui_out *uiout, int width, + enum ui_align alig, char *colhdr); +static void default_list_begin (struct ui_out *uiout, int list_flag, + char *lstid); +static void default_list_end (struct ui_out *uiout, int list_flag); +static void default_field_int (struct ui_out *uiout, int fldno, int width, + enum ui_align alig, char *fldname, int value); +static void default_field_skip (struct ui_out *uiout, int fldno, int width, + enum ui_align alig, char *fldname); +static void default_field_string (struct ui_out *uiout, int fldno, int width, + enum ui_align align, char *fldname, + const char *string); +static void default_field_fmt (struct ui_out *uiout, int fldno, + int width, enum ui_align align, + char *fldname, char *format, va_list args); +static void default_spaces (struct ui_out *uiout, int numspaces); +static void default_text (struct ui_out *uiout, char *string); +static void default_message (struct ui_out *uiout, int verbosity, char *format, + va_list args); +static void default_wrap_hint (struct ui_out *uiout, char *identstring); +static void default_flush (struct ui_out *uiout); + +/* This is the default ui-out implementation functions vector */ + +struct ui_out_impl default_ui_out_impl = +{ + default_table_begin, + default_table_body, + default_table_end, + default_table_header, + default_list_begin, + default_list_end, + default_field_int, + default_field_skip, + default_field_string, + default_field_fmt, + default_spaces, + default_text, + default_message, + default_wrap_hint, + default_flush +}; + +/* The default ui_out */ + +struct ui_out def_uiout = +{ + 0, /* flags */ + &default_ui_out_impl, /* impl */ +}; + +/* Pointer to current ui_out */ +/* FIXME: This should not be a global, but something passed down from main.c + or top.c */ + +struct ui_out *uiout = &def_uiout; + +/* These are the interfaces to implementation functions */ + +static void uo_table_begin (struct ui_out *uiout, int nbrofcols, char *tblid); +static void uo_table_body (struct ui_out *uiout); +static void uo_table_end (struct ui_out *uiout); +static void uo_table_header (struct ui_out *uiout, int width, + enum ui_align align, char *colhdr); +static void uo_list_begin (struct ui_out *uiout, int list_flag, char *lstid); +static void uo_list_end (struct ui_out *uiout, int list_flag); +static void uo_field_int (struct ui_out *uiout, int fldno, int width, + enum ui_align align, char *fldname, int value); +static void uo_field_skip (struct ui_out *uiout, int fldno, int width, + enum ui_align align, char *fldname); +static void uo_field_string (struct ui_out *uiout, int fldno, int width, + enum ui_align align, char *fldname, const char *string); +static void uo_field_fmt (struct ui_out *uiout, int fldno, int width, + enum ui_align align, char *fldname, + char *format, va_list args); +static void uo_spaces (struct ui_out *uiout, int numspaces); +static void uo_text (struct ui_out *uiout, char *string); +static void uo_message (struct ui_out *uiout, int verbosity, + char *format, va_list args); +static void uo_wrap_hint (struct ui_out *uiout, char *identstring); +static void uo_flush (struct ui_out *uiout); + +/* Prototypes for local functions */ + +extern void _initialize_ui_out (void); +static void append_header_to_list (struct ui_out *uiout, int width, int alignment, char *colhdr); +static int get_curr_header (struct ui_out *uiout, int *colno, int *width, + int *alignment, char **colhdr); +static void clear_header_list (struct ui_out *uiout); +static void verify_field_proper_position (struct ui_out *uiout); +static void verify_field_alignment (struct ui_out *uiout, int fldno, int *width, int *alignment); + +static void init_ui_out_state (struct ui_out *uiout); + +/* exported functions (ui_out API) */ + +/* Mark beginning of a table */ + +void +ui_out_table_begin (uiout, nbrofcols, tblid) + struct ui_out *uiout; + int nbrofcols; + char *tblid; +{ + if (uiout->table_flag) + internal_error ("gdb/ui_out.c: tables cannot be nested; table_begin found before \ +previous table_end."); + + uiout->table_flag = 1; + uiout->table_columns = nbrofcols; + if (tblid != NULL) + uiout->table_id = xstrdup (tblid); + else + uiout->table_id = NULL; + clear_header_list (uiout); + + uo_table_begin (uiout, nbrofcols, uiout->table_id); +} + +void +ui_out_table_body (uiout) + struct ui_out *uiout; +{ + if (!uiout->table_flag) + internal_error ("gdb/ui_out.c: table_body outside a table is not valid; it must be \ +after a table_begin and before a table_end."); + if (uiout->body_flag) + internal_error ("gdb/ui_out.c: extra table_body call not allowed; there must be \ +only one table_body after a table_begin and before a table_end."); + if (uiout->headercurr->colno != uiout->table_columns) + internal_error ("gdb/ui_out.c: number of headers differ from number of table \ +columns."); + + uiout->body_flag = 1; + uiout->headercurr = uiout->headerfirst; + + uo_table_body (uiout); +} + +void +ui_out_table_end (uiout) + struct ui_out *uiout; +{ + if (!uiout->table_flag) + internal_error ("gdb/ui_out.c: misplaced table_end or missing table_begin."); + + uiout->body_flag = 0; + uiout->table_flag = 0; + + uo_table_end (uiout); + + if (uiout->table_id) + free (uiout->table_id); + clear_header_list (uiout); +} + +void +ui_out_table_header (uiout, width, alignment, colhdr) + struct ui_out *uiout; + int width; + enum ui_align alignment; + char *colhdr; +{ + if (!uiout->table_flag || uiout->body_flag) + internal_error ("ui_out: table header must be specified after table_begin \ +and before table_body."); + + append_header_to_list (uiout, width, alignment, colhdr); + + uo_table_header (uiout, width, alignment, colhdr); +} + +void +ui_out_list_begin (uiout, lstid) + struct ui_out *uiout; + char *lstid; +{ + if (uiout->table_flag && !uiout->body_flag) + internal_error ("ui_out: table header or table_body expected; lists must be \ +specified after table_body."); + if (uiout->list_flag >= 4) + internal_error ("ui_out: list depth exceeded; only 4 levels of lists can be \ +nested."); + + uiout->list_flag++; + uiout->field_count[uiout->list_flag] = 0; + if (uiout->table_flag && (uiout->list_flag == 1)) + uiout->headercurr = uiout->headerfirst; + + uo_list_begin (uiout, uiout->list_flag, lstid); +} + +void +ui_out_list_end (uiout) + struct ui_out *uiout; +{ + if (!uiout->list_flag) + internal_error ("ui_out: misplaced list_end; there is no list to be closed."); + + uo_list_end (uiout, uiout->list_flag); + + uiout->list_flag--; +} + +void +ui_out_field_int (uiout, fldname, value) + struct ui_out *uiout; + char *fldname; + int value; +{ + int fldno; + int width; + int align; + + verify_field_proper_position (uiout); + + uiout->field_count[uiout->list_flag] += 1; + fldno = uiout->field_count[uiout->list_flag]; + + verify_field_alignment (uiout, fldno, &width, &align); + + uo_field_int (uiout, fldno, width, align, fldname, value); +} + +void +ui_out_field_core_addr (uiout, fldname, address) + struct ui_out *uiout; + char *fldname; + CORE_ADDR address; +{ + char addstr[20]; + + /* FIXME-32x64: need a print_address_numeric with field width */ + /* print_address_numeric (address, 1, local_stream); */ + strcpy (addstr, local_hex_string_custom ((unsigned long) address, "08l")); + + ui_out_field_string (uiout, fldname, addstr); +} + +void +ui_out_field_stream (uiout, fldname, buf) + struct ui_out *uiout; + char *fldname; + struct ui_stream *buf; +{ + long length; + char *buffer = ui_file_xstrdup (buf->stream, &length); + struct cleanup *old_cleanup = make_cleanup (free, buffer); + if (length > 0) + ui_out_field_string (uiout, fldname, buffer); + else + ui_out_field_skip (uiout, fldname); + ui_file_rewind (buf->stream); + do_cleanups (old_cleanup); +} + +/* used to ommit a field */ + +void +ui_out_field_skip (uiout, fldname) + struct ui_out *uiout; + char *fldname; +{ + int fldno; + int width; + int align; + + verify_field_proper_position (uiout); + + uiout->field_count[uiout->list_flag] += 1; + fldno = uiout->field_count[uiout->list_flag]; + + verify_field_alignment (uiout, fldno, &width, &align); + + uo_field_skip (uiout, fldno, width, align, fldname); +} + +void +ui_out_field_string (struct ui_out *uiout, + char *fldname, + const char *string) +{ + int fldno; + int width; + int align; + + verify_field_proper_position (uiout); + + uiout->field_count[uiout->list_flag] += 1; + fldno = uiout->field_count[uiout->list_flag]; + + verify_field_alignment (uiout, fldno, &width, &align); + + uo_field_string (uiout, fldno, width, align, fldname, string); +} + +/* VARARGS */ +void +ui_out_field_fmt (struct ui_out *uiout, char *fldname, char *format,...) +{ + va_list args; + int fldno; + int width; + int align; + + verify_field_proper_position (uiout); + + uiout->field_count[uiout->list_flag] += 1; + fldno = uiout->field_count[uiout->list_flag]; + + /* will not align, but has to call anyway */ + verify_field_alignment (uiout, fldno, &width, &align); + + va_start (args, format); + + uo_field_fmt (uiout, fldno, width, align, fldname, format, args); + + va_end (args); +} + +void +ui_out_spaces (uiout, numspaces) + struct ui_out *uiout; + int numspaces; +{ + uo_spaces (uiout, numspaces); +} + +void +ui_out_text (uiout, string) + struct ui_out *uiout; + char *string; +{ + uo_text (uiout, string); +} + +void +ui_out_message (struct ui_out *uiout, int verbosity, char *format,...) +{ + va_list args; + + va_start (args, format); + + uo_message (uiout, verbosity, format, args); + + va_end (args); +} + +struct ui_stream * +ui_out_stream_new (uiout) + struct ui_out *uiout; +{ + struct ui_stream *tempbuf; + + tempbuf = XMALLOC (struct ui_stream); + tempbuf->uiout = uiout; + tempbuf->stream = mem_fileopen (); + return tempbuf; +} + +void +ui_out_stream_delete (buf) + struct ui_stream *buf; +{ + ui_file_delete (buf->stream); + free (buf); +} + +static void +do_stream_delete (void *buf) +{ + ui_out_stream_delete (buf); +} + +struct cleanup * +make_cleanup_ui_out_stream_delete (struct ui_stream *buf) +{ + return make_cleanup (do_stream_delete, buf); +} + + +void +ui_out_wrap_hint (uiout, identstring) + struct ui_out *uiout; + char *identstring; +{ + uo_wrap_hint (uiout, identstring); +} + +void +ui_out_flush (uiout) + struct ui_out *uiout; +{ + uo_flush (uiout); +} + +/* set the flags specified by the mask given */ +int +ui_out_set_flags (uiout, mask) + struct ui_out *uiout; + int mask; +{ + int oldflags; + + uiout->flags != mask; + + return oldflags; +} + +/* clear the flags specified by the mask given */ +int +ui_out_clear_flags (uiout, mask) + struct ui_out *uiout; + int mask; +{ + int oldflags; + + uiout->flags &= ~mask; + + return oldflags; +} + +/* test the flags against the mask given */ +int +ui_out_test_flags (uiout, mask) + struct ui_out *uiout; + int mask; +{ + return (uiout->flags & mask); +} + +/* obtain the current verbosity level (as stablished by the + 'set verbositylevel' command */ + +int +ui_out_get_verblvl (uiout) + struct ui_out *uiout; +{ + /* FIXME: not implemented yet */ + return 0; +} + +#if 0 +void +ui_out_result_begin (uiout, class) + struct ui_out *uiout; + char *class; +{ +} + +void +ui_out_result_end (uiout) + struct ui_out *uiout; +{ +} + +void +ui_out_info_begin (uiout, class) + struct ui_out *uiout; + char *class; +{ +} + +void +ui_out_info_end (uiout) + struct ui_out *uiout; +{ +} + +void +ui_out_notify_begin (uiout, class) + struct ui_out *uiout; + char *class; +{ +} + +void +ui_out_notify_end (uiout) + struct ui_out *uiout; +{ +} + +void +ui_out_error_begin (uiout, class) + struct ui_out *uiout; + char *class; +{ +} + +void +ui_out_error_end (uiout) + struct ui_out *uiout; +{ +} +#endif + +#if 0 +void +gdb_error (ui_out * uiout, int severity, char *format,...) +{ + va_list args; +} + +void +gdb_query (uiout, qflags, qprompt) + struct ui_out *uiout; + int flags; + char *qprompt; +{ +} +#endif + +/* default gdb-out hook functions */ + +static void +default_table_begin (uiout, nbrofcols, tblid) + struct ui_out *uiout; + int nbrofcols; + char *tblid; +{ +} + +static void +default_table_body (uiout) + struct ui_out *uiout; +{ +} + +static void +default_table_end (uiout) + struct ui_out *uiout; +{ +} + +static void +default_table_header (uiout, width, alignment, colhdr) + struct ui_out *uiout; + int width; + enum ui_align alignment; + char *colhdr; +{ +} + +static void +default_list_begin (uiout, list_flag, lstid) + struct ui_out *uiout; + int list_flag; + char *lstid; +{ +} + +static void +default_list_end (uiout, list_flag) + struct ui_out *uiout; + int list_flag; +{ +} + +static void +default_field_int (uiout, fldno, width, align, fldname, value) + struct ui_out *uiout; + int fldno; + int width; + enum ui_align align; + char *fldname; + int value; +{ +} + +static void +default_field_skip (uiout, fldno, width, align, fldname) + struct ui_out *uiout; + int fldno; + int width; + enum ui_align align; + char *fldname; +{ +} + +static void +default_field_string (struct ui_out *uiout, + int fldno, + int width, + enum ui_align align, + char *fldname, + const char *string) +{ +} + +static void +default_field_fmt (uiout, fldno, width, align, fldname, format, args) + struct ui_out *uiout; + int fldno; + int width; + enum ui_align align; + char *fldname; + char *format; + va_list args; +{ +} + +static void +default_spaces (uiout, numspaces) + struct ui_out *uiout; + int numspaces; +{ +} + +static void +default_text (uiout, string) + struct ui_out *uiout; + char *string; +{ +} + +static void +default_message (uiout, verbosity, format, args) + struct ui_out *uiout; + int verbosity; + char *format; + va_list args; +{ +} + +static void +default_wrap_hint (uiout, identstring) + struct ui_out *uiout; + char *identstring; +{ +} + +static void +default_flush (uiout) + struct ui_out *uiout; +{ +} + +/* Interface to the implementation functions */ + +void +uo_table_begin (struct ui_out *uiout, int nbrofcols, char *tblid) +{ + if (!uiout->impl->table_begin) + return; + uiout->impl->table_begin (uiout, nbrofcols, tblid); +} + +void +uo_table_body (struct ui_out *uiout) +{ + if (!uiout->impl->table_body) + return; + uiout->impl->table_body (uiout); +} + +void +uo_table_end (struct ui_out *uiout) +{ + if (!uiout->impl->table_end) + return; + uiout->impl->table_end (uiout); +} + +void +uo_table_header (struct ui_out *uiout, int width, enum ui_align align, char *colhdr) +{ + if (!uiout->impl->table_header) + return; + uiout->impl->table_header (uiout, width, align, colhdr); +} + +void +uo_list_begin (struct ui_out *uiout, int list_flag, char *lstid) +{ + if (!uiout->impl->list_begin) + return; + uiout->impl->list_begin (uiout, list_flag, lstid); +} + +void +uo_list_end (struct ui_out *uiout, int list_flag) +{ + if (!uiout->impl->list_end) + return; + uiout->impl->list_end (uiout, list_flag); +} + +void +uo_field_int (struct ui_out *uiout, int fldno, int width, enum ui_align align, char *fldname, int value) +{ + if (!uiout->impl->field_int) + return; + uiout->impl->field_int (uiout, fldno, width, align, fldname, value); +} + +void +uo_field_skip (struct ui_out *uiout, int fldno, int width, enum ui_align align, char *fldname) +{ + if (!uiout->impl->field_skip) + return; + uiout->impl->field_skip (uiout, fldno, width, align, fldname); +} + +void +uo_field_string (struct ui_out *uiout, int fldno, int width, + enum ui_align align, char *fldname, const char *string) +{ + if (!uiout->impl->field_string) + return; + uiout->impl->field_string (uiout, fldno, width, align, fldname, string); +} + +void +uo_field_fmt (struct ui_out *uiout, int fldno, int width, enum ui_align align, char *fldname, char *format, va_list args) +{ + if (!uiout->impl->field_fmt) + return; + uiout->impl->field_fmt (uiout, fldno, width, align, fldname, format, args); +} + +void +uo_spaces (struct ui_out *uiout, int numspaces) +{ + if (!uiout->impl->spaces) + return; + uiout->impl->spaces (uiout, numspaces); +} + +void +uo_text (struct ui_out *uiout, char *string) +{ + if (!uiout->impl->text) + return; + uiout->impl->text (uiout, string); +} + +void +uo_message (struct ui_out *uiout, int verbosity, char *format, va_list args) +{ + if (!uiout->impl->message) + return; + uiout->impl->message (uiout, verbosity, format, args); +} + +void +uo_wrap_hint (struct ui_out *uiout, char *identstring) +{ + if (!uiout->impl->wrap_hint) + return; + uiout->impl->wrap_hint (uiout, identstring); +} + +void +uo_flush (struct ui_out *uiout) +{ + if (!uiout->impl->flush) + return; + uiout->impl->flush (uiout); +} + +/* local functions */ + +/* list of column headers manipulation routines */ + +static void +clear_header_list (uiout) + struct ui_out *uiout; +{ + while (uiout->headerfirst != NULL) + { + uiout->headercurr = uiout->headerfirst; + uiout->headerfirst = uiout->headerfirst->next; + if (uiout->headercurr->colhdr != NULL) + free (uiout->headercurr->colhdr); + free (uiout->headercurr); + } + uiout->headerlast = NULL; + uiout->headercurr = NULL; +} + +static void +append_header_to_list (struct ui_out *uiout, + int width, + int alignment, + char *colhdr) +{ + struct ui_out_hdr *temphdr; + + temphdr = XMALLOC (struct ui_out_hdr); + temphdr->width = width; + temphdr->alignment = alignment; + /* we have to copy the column title as the original may be an automatic */ + if (colhdr != NULL) + { + temphdr->colhdr = xmalloc (strlen (colhdr) + 1); + strcpy (temphdr->colhdr, colhdr); + } + temphdr->next = NULL; + if (uiout->headerfirst == NULL) + { + temphdr->colno = 1; + uiout->headerfirst = temphdr; + uiout->headerlast = temphdr; + } + else + { + temphdr->colno = uiout->headerlast->colno + 1; + uiout->headerlast->next = temphdr; + uiout->headerlast = temphdr; + } + uiout->headercurr = uiout->headerlast; +} + +/* returns 0 if there is no more headers */ + +static int +get_curr_header (struct ui_out *uiout, + int *colno, + int *width, + int *alignment, + char **colhdr) +{ + /* There may be no headers at all or we may have used all columns */ + if (uiout->headercurr == NULL) + return 0; + *colno = uiout->headercurr->colno; + *width = uiout->headercurr->width; + *alignment = uiout->headercurr->alignment; + *colhdr = uiout->headercurr->colhdr; + uiout->headercurr = uiout->headercurr->next; + return 1; +} + +/* makes sure the field_* calls were properly placed */ + +static void +verify_field_proper_position (struct ui_out *uiout) +{ + if (uiout->table_flag) + { + if (!uiout->body_flag) + internal_error ("ui_out: table_body missing; table fields must be \ +specified after table_body and inside a list."); + if (!uiout->list_flag) + internal_error ("ui_out: list_begin missing; table fields must be \ +specified after table_body and inside a list."); + } +} + +/* determines what is the alignment policy */ + +static void +verify_field_alignment (struct ui_out *uiout, + int fldno, + int *width, + int *align) +{ + int colno; + char *text; + + if (uiout->table_flag + && get_curr_header (uiout, &colno, width, align, &text)) + { + if (fldno != colno) + internal_error ("gdb/ui-out.c: ui-out internal error in handling headers."); + } + else + { + *width = 0; + *align = ui_noalign; + } +} + +/* access to ui_out format private members */ + +void +ui_out_get_field_separator (uiout) + struct ui_out *uiout; +{ +} + +/* Access to ui-out members data */ + +struct ui_out_data * +ui_out_data (struct ui_out *uiout) +{ + return uiout->data; +} + +/* initalize private members at startup */ + +struct ui_out * +ui_out_new (struct ui_out_impl *impl, + struct ui_out_data *data, + int flags) +{ + struct ui_out *uiout = XMALLOC (struct ui_out); + uiout->data = data; + uiout->impl = impl; + uiout->flags = flags; + uiout->table_flag = 0; + uiout->body_flag = 0; + uiout->list_flag = 0; + uiout->field_count[0] = 0; + uiout->headerfirst = NULL; + uiout->headerlast = NULL; + uiout->headercurr = NULL; + return uiout; +} + +/* standard gdb initialization hook */ + +void +_initialize_ui_out () +{ + /* nothing needs to be done */ +} diff --git a/gdb/ui-out.h b/gdb/ui-out.h new file mode 100644 index 0000000..d8db588 --- /dev/null +++ b/gdb/ui-out.h @@ -0,0 +1,221 @@ +/* Output generating routines for GDB. + Copyright 1999, 2000 Free Software Foundation, Inc. + Contributed by Cygnus Solutions. + Written by Fernando Nasser for Cygnus. + + This file is part of GDB. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#ifndef UI_OUT_H +#define UI_OUT_H 1 + +/* The ui_out structure */ + +#if __STDC__ +struct ui_out; +struct ui_out_data; +#endif + + +/* the current ui_out */ + +/* FIXME: This should not be a global but something passed down from main.c + or top.c */ +extern struct ui_out *uiout; + +/* alignment enum */ +enum ui_align + { + ui_left = -1, + ui_center, + ui_right, + ui_noalign + }; + +/* flags enum */ +enum ui_flags + { + ui_from_tty = 1, + ui_source_list = 2 + }; + + +/* The ui_out stream structure. */ +/* NOTE: cagney/2000-02-01: The ui_stream object can be subsumed by + the more generic ui_file object. */ + +struct ui_stream + { + struct ui_out *uiout; + struct ui_file *stream; + }; + + +/* Prototypes for ui-out API. */ + +extern void ui_out_table_begin PARAMS ((struct ui_out * uiout, int nbrofcols, + char *tblid)); + +extern void ui_out_table_header PARAMS ((struct ui_out * uiout, int width, + enum ui_align align, char *colhdr)); + +extern void ui_out_table_body PARAMS ((struct ui_out * uiout)); + +extern void ui_out_table_end PARAMS ((struct ui_out * uiout)); + +extern void ui_out_list_begin PARAMS ((struct ui_out * uiout, char *lstid)); + +extern void ui_out_list_end PARAMS ((struct ui_out * uiout)); + +extern void ui_out_field_int PARAMS ((struct ui_out * uiout, char *fldname, + int value)); + +extern void ui_out_field_core_addr PARAMS ((struct ui_out * uiout, char *fldname, + CORE_ADDR address)); + +extern void ui_out_field_string (struct ui_out * uiout, char *fldname, + const char *string); + +extern void ui_out_field_stream PARAMS ((struct ui_out * uiout, char *fldname, + struct ui_stream * buf)); + +extern void ui_out_field_fmt PARAMS ((struct ui_out * uiout, char *fldname, + char *format,...)); + +extern void ui_out_field_skip PARAMS ((struct ui_out * uiout, char *fldname)); + +extern void ui_out_spaces PARAMS ((struct ui_out * uiout, int numspaces)); + +extern void ui_out_text PARAMS ((struct ui_out * uiout, char *string)); + +extern void ui_out_message PARAMS ((struct ui_out * uiout, int verbosity, + char *format,...)); + +extern struct ui_stream *ui_out_stream_new PARAMS ((struct ui_out * uiout)); + +extern void ui_out_stream_delete PARAMS ((struct ui_stream * buf)); + +struct cleanup *make_cleanup_ui_out_stream_delete (struct ui_stream *buf); + +extern void ui_out_wrap_hint PARAMS ((struct ui_out * uiout, char *identstring)); + +extern void ui_out_flush PARAMS ((struct ui_out * uiout)); + +extern void ui_out_get_field_separator PARAMS ((struct ui_out * uiout)); + +extern int ui_out_set_flags PARAMS ((struct ui_out * uiout, int mask)); + +extern int ui_out_clear_flags PARAMS ((struct ui_out * uiout, int mask)); + +extern int ui_out_get_verblvl PARAMS ((struct ui_out * uiout)); + +extern int ui_out_test_flags (struct ui_out *uiout, int mask); + +#if 0 +extern void ui_out_result_begin PARAMS ((struct ui_out * uiout, char *class)); + +extern void ui_out_result_end PARAMS ((struct ui_out * uiout)); + +extern void ui_out_info_begin PARAMS ((struct ui_out * uiout, char *class)); + +extern void ui_out_info_end PARAMS ((struct ui_out * uiout)); + +extern void ui_out_notify_begin PARAMS ((struct ui_out * uiout, char *class)); + +extern void ui_out_notify_end PARAMS ((struct ui_out * uiout)); + +extern void ui_out_error_begin PARAMS ((struct ui_out * uiout, char *class)); + +extern void ui_out_error_end PARAMS ((struct ui_out * uiout)); +#endif + +#if 0 +extern void gdb_error PARAMS ((struct ui_out * uiout, int severity, + char *format,...)); + +extern void gdb_query PARAMS ((struct ui_out * uiout, + int qflags, char *qprompt)); +#endif + +/* From here on we have things that are only needed by implementation + routines and main.c. We should pehaps have a separate file for that, + like a ui-out-impl.h file */ + +/* User Interface Output Implementation Function Table */ + +/* Type definition of all implementation functions. */ + +typedef void (table_begin_ftype) (struct ui_out * uiout, + int nbrofcols, char *tblid); +typedef void (table_body_ftype) (struct ui_out * uiout); +typedef void (table_end_ftype) (struct ui_out * uiout); +typedef void (table_header_ftype) (struct ui_out * uiout, int width, + enum ui_align align, char *colhdr); +typedef void (list_begin_ftype) (struct ui_out * uiout, + int list_flag, char *lstid); +typedef void (list_end_ftype) (struct ui_out * uiout, int list_flag); +typedef void (field_int_ftype) (struct ui_out * uiout, int fldno, int width, + enum ui_align align, char *fldname, int value); +typedef void (field_skip_ftype) (struct ui_out * uiout, int fldno, int width, + enum ui_align align, char *fldname); +typedef void (field_string_ftype) (struct ui_out * uiout, int fldno, int width, + enum ui_align align, char *fldname, + const char *string); +typedef void (field_fmt_ftype) (struct ui_out * uiout, int fldno, int width, + enum ui_align align, char *fldname, + char *format, va_list args); +typedef void (spaces_ftype) (struct ui_out * uiout, int numspaces); +typedef void (text_ftype) (struct ui_out * uiout, char *string); +typedef void (message_ftype) (struct ui_out * uiout, int verbosity, + char *format, va_list args); +typedef void (wrap_hint_ftype) (struct ui_out * uiout, char *identstring); +typedef void (flush_ftype) (struct ui_out * uiout); + +/* ui-out-impl */ + +/* IMPORTANT: If you change this structure, make sure to change the default + initialization in ui-out.c */ + +struct ui_out_impl + { + table_begin_ftype *table_begin; + table_body_ftype *table_body; + table_end_ftype *table_end; + table_header_ftype *table_header; + list_begin_ftype *list_begin; + list_end_ftype *list_end; + field_int_ftype *field_int; + field_skip_ftype *field_skip; + field_string_ftype *field_string; + field_fmt_ftype *field_fmt; + spaces_ftype *spaces; + text_ftype *text; + message_ftype *message; + wrap_hint_ftype *wrap_hint; + flush_ftype *flush; + }; + +extern struct ui_out_data *ui_out_data (struct ui_out *uiout); + + +/* Create a ui_out object */ + +extern struct ui_out *ui_out_new (struct ui_out_impl *impl, + struct ui_out_data *data, + int flags); + +#endif /* UI_OUT_H */ diff --git a/gdb/varobj.c b/gdb/varobj.c new file mode 100644 index 0000000..f0740c6 --- /dev/null +++ b/gdb/varobj.c @@ -0,0 +1,2421 @@ +/* Implementation of the GDB variable objects API. + Copyright 1999, 2000 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include "defs.h" +#include "value.h" +#include "expression.h" +#include "frame.h" +#include "valprint.h" +#include "language.h" +#include "wrapper.h" +#include "gdbcmd.h" +#include + +#include "varobj.h" + +/* Non-zero if we want to see trace of varobj level stuff. */ + +int varobjdebug = 0; + +/* String representations of gdb's format codes */ +char *varobj_format_string[] = +{"natural", "binary", "decimal", "hexadecimal", "octal"}; + +/* String representations of gdb's known languages */ +char *varobj_language_string[] = +{"unknown", "C", "C++", "Java"}; + +/* Data structures */ + +/* Every root variable has one of these structures saved in its + varobj. Members which must be free'd are noted. */ +struct varobj_root + { + + /* Alloc'd expression for this parent. */ + struct expression *exp; + + /* Block for which this expression is valid */ + struct block *valid_block; + + /* The frame for this expression */ + CORE_ADDR frame; + + /* Language info for this variable and its children */ + struct language_specific *lang; + + /* The varobj for this root node. */ + struct varobj *rootvar; + + /* Next root variable */ + struct varobj_root *next; + }; + +/* Every variable in the system has a structure of this type defined + for it. This structure holds all information necessary to manipulate + a particular object variable. Members which must be freed are noted. */ +struct varobj + { + + /* Alloc'd name of the variable for this object.. If this variable is a + child, then this name will be the child's source name. + (bar, not foo.bar) */ + /* NOTE: This is the "expression" */ + char *name; + + /* The alloc'd name for this variable's object. This is here for + convenience when constructing this object's children. */ + char *obj_name; + + /* Index of this variable in its parent or -1 */ + int index; + + /* The type of this variable. This may NEVER be NULL. */ + struct type *type; + + /* The value of this expression or subexpression. This may be NULL. */ + value_ptr value; + + /* Did an error occur evaluating the expression or getting its value? */ + int error; + + /* The number of (immediate) children this variable has */ + int num_children; + + /* If this object is a child, this points to its immediate parent. */ + struct varobj *parent; + + /* A list of this object's children */ + struct varobj_child *children; + + /* Description of the root variable. Points to root variable for children. */ + struct varobj_root *root; + + /* The format of the output for this object */ + enum varobj_display_formats format; + }; + +/* Every variable keeps a linked list of its children, described + by the following structure. */ +/* FIXME: Deprecated. All should use vlist instead */ + +struct varobj_child + { + + /* Pointer to the child's data */ + struct varobj *child; + + /* Pointer to the next child */ + struct varobj_child *next; + }; + +/* A stack of varobjs */ +/* FIXME: Deprecated. All should use vlist instead */ + +struct vstack + { + struct varobj *var; + struct vstack *next; + }; + +struct cpstack + { + char *name; + struct cpstack *next; + }; + +/* A list of varobjs */ + +struct vlist + { + struct varobj *var; + struct vlist *next; + }; + +/* Private function prototypes */ + +/* Helper functions for the above subcommands. */ + +static int delete_variable PARAMS ((struct cpstack **, struct varobj *, int)); + +static void delete_variable_1 PARAMS ((struct cpstack **, int *, + struct varobj *, int, int)); + +static int install_variable PARAMS ((struct varobj *)); + +static void uninstall_variable PARAMS ((struct varobj *)); + +static struct varobj *child_exists PARAMS ((struct varobj *, char *)); + +static struct varobj *create_child PARAMS ((struct varobj *, int, char *)); + +static void save_child_in_parent PARAMS ((struct varobj *, struct varobj *)); + +static void remove_child_from_parent PARAMS ((struct varobj *, struct varobj *)); + +/* Utility routines */ + +static struct varobj *new_variable PARAMS ((void)); + +static struct varobj *new_root_variable PARAMS ((void)); + +static void free_variable PARAMS ((struct varobj * var)); + +static struct type *get_type PARAMS ((struct varobj * var)); + +static struct type *get_type_deref PARAMS ((struct varobj * var)); + +static struct type *get_target_type PARAMS ((struct type *)); + +static enum varobj_display_formats variable_default_display PARAMS ((struct varobj *)); + +static int my_value_equal PARAMS ((value_ptr, value_ptr, int *)); + +static void vpush PARAMS ((struct vstack ** pstack, struct varobj * var)); + +static struct varobj *vpop PARAMS ((struct vstack ** pstack)); + +static void cppush PARAMS ((struct cpstack ** pstack, char *name)); + +static char *cppop PARAMS ((struct cpstack ** pstack)); + +/* Language-specific routines. */ + +static enum varobj_languages variable_language PARAMS ((struct varobj * var)); + +static int number_of_children PARAMS ((struct varobj *)); + +static char *name_of_variable PARAMS ((struct varobj *)); + +static char *name_of_child PARAMS ((struct varobj *, int)); + +static value_ptr value_of_root PARAMS ((struct varobj * var)); + +static value_ptr value_of_child PARAMS ((struct varobj * parent, int index)); + +static struct type *type_of_child PARAMS ((struct varobj * var)); + +static int variable_editable PARAMS ((struct varobj * var)); + +static char *my_value_of_variable PARAMS ((struct varobj * var)); + +static int type_changeable PARAMS ((struct varobj * var)); + +/* C implementation */ + +static int c_number_of_children PARAMS ((struct varobj * var)); + +static char *c_name_of_variable PARAMS ((struct varobj * parent)); + +static char *c_name_of_child PARAMS ((struct varobj * parent, int index)); + +static value_ptr c_value_of_root PARAMS ((struct varobj * var)); + +static value_ptr c_value_of_child PARAMS ((struct varobj * parent, int index)); + +static struct type *c_type_of_child PARAMS ((struct varobj * parent, int index)); + +static int c_variable_editable PARAMS ((struct varobj * var)); + +static char *c_value_of_variable PARAMS ((struct varobj * var)); + +/* C++ implementation */ + +static int cplus_number_of_children PARAMS ((struct varobj * var)); + +static void cplus_class_num_children PARAMS ((struct type * type, int children[3])); + +static char *cplus_name_of_variable PARAMS ((struct varobj * parent)); + +static char *cplus_name_of_child PARAMS ((struct varobj * parent, int index)); + +static value_ptr cplus_value_of_root PARAMS ((struct varobj * var)); + +static value_ptr cplus_value_of_child PARAMS ((struct varobj * parent, int index)); + +static struct type *cplus_type_of_child PARAMS ((struct varobj * parent, int index)); + +static int cplus_variable_editable PARAMS ((struct varobj * var)); + +static char *cplus_value_of_variable PARAMS ((struct varobj * var)); + +/* Java implementation */ + +static int java_number_of_children PARAMS ((struct varobj * var)); + +static char *java_name_of_variable PARAMS ((struct varobj * parent)); + +static char *java_name_of_child PARAMS ((struct varobj * parent, int index)); + +static value_ptr java_value_of_root PARAMS ((struct varobj * var)); + +static value_ptr java_value_of_child PARAMS ((struct varobj * parent, int index)); + +static struct type *java_type_of_child PARAMS ((struct varobj * parent, int index)); + +static int java_variable_editable PARAMS ((struct varobj * var)); + +static char *java_value_of_variable PARAMS ((struct varobj * var)); + +/* The language specific vector */ + +struct language_specific + { + + /* The language of this variable */ + enum varobj_languages language; + + /* The number of children of PARENT. */ + int (*number_of_children) PARAMS ((struct varobj * parent)); + + /* The name (expression) of a root varobj. */ + char *(*name_of_variable) PARAMS ((struct varobj * parent)); + + /* The name of the INDEX'th child of PARENT. */ + char *(*name_of_child) PARAMS ((struct varobj * parent, int index)); + + /* The value_ptr of the root variable ROOT. */ + value_ptr (*value_of_root) PARAMS ((struct varobj * root)); + + /* The value_ptr of the INDEX'th child of PARENT. */ + value_ptr (*value_of_child) PARAMS ((struct varobj * parent, int index)); + + /* The type of the INDEX'th child of PARENT. */ + struct type *(*type_of_child) PARAMS ((struct varobj * parent, int index)); + + /* Is VAR editable? */ + int (*variable_editable) PARAMS ((struct varobj * var)); + + /* The current value of VAR. */ + char *(*value_of_variable) PARAMS ((struct varobj * var)); + }; + +/* Array of known source language routines. */ +static struct language_specific + languages[vlang_end][sizeof (struct language_specific)] = +{ + /* Unknown (try treating as C */ + { + vlang_unknown, + c_number_of_children, + c_name_of_variable, + c_name_of_child, + c_value_of_root, + c_value_of_child, + c_type_of_child, + c_variable_editable, + c_value_of_variable + } + , + /* C */ + { + vlang_c, + c_number_of_children, + c_name_of_variable, + c_name_of_child, + c_value_of_root, + c_value_of_child, + c_type_of_child, + c_variable_editable, + c_value_of_variable + } + , + /* C++ */ + { + vlang_cplus, + cplus_number_of_children, + cplus_name_of_variable, + cplus_name_of_child, + cplus_value_of_root, + cplus_value_of_child, + cplus_type_of_child, + cplus_variable_editable, + cplus_value_of_variable + } + , + /* Java */ + { + vlang_java, + java_number_of_children, + java_name_of_variable, + java_name_of_child, + java_value_of_root, + java_value_of_child, + java_type_of_child, + java_variable_editable, + java_value_of_variable + } +}; + +/* A little convenience enum for dealing with C++/Java */ +enum vsections + { + v_public = 0, v_private, v_protected + }; + +/* Private data */ + +/* Mappings of varobj_display_formats enums to gdb's format codes */ +static int format_code[] = +{0, 't', 'd', 'x', 'o'}; + +/* Header of the list of root variable objects */ +static struct varobj_root *rootlist; +static int rootcount = 0; /* number of root varobjs in the list */ + +/* Prime number indicating the number of buckets in the hash table */ +/* A prime large enough to avoid too many colisions */ +#define VAROBJ_TABLE_SIZE 227 + +/* Pointer to the varobj hash table (built at run time) */ +static struct vlist **varobj_table; + +#if defined(FREEIF) +#undef FREEIF +#endif +#define FREEIF(x) if (x != NULL) free((char *) (x)) + +/* Is the variable X one of our "fake" children? */ +#define CPLUS_FAKE_CHILD(x) \ +((x) != NULL && (x)->type == NULL && (x)->value == NULL) + + +/* API Implementation */ + +/* Creates a varobj (not its children) */ + +struct varobj * +varobj_create (char *objname, + char *expression, CORE_ADDR frame) +{ + struct varobj *var; + struct frame_info *fi, *old_fi; + struct block *block; + struct cleanup *old_chain; + + /* Fill out a varobj structure for the (root) variable being constructed. */ + var = new_root_variable (); + old_chain = make_cleanup ((make_cleanup_func) free_variable, var); + + if (expression != NULL) + { + char *p; + enum varobj_languages lang; + + /* Parse and evaluate the expression, filling in as much + of the variable's data as possible */ + + /* Allow creator to specify context of variable */ + if (frame == (CORE_ADDR) -1) + fi = selected_frame; + else + fi = find_frame_addr_in_frame_chain (frame); + + block = NULL; + if (fi != NULL) + block = get_frame_block (fi); + + p = expression; + innermost_block = NULL; + /* Callee may longjump */ + var->root->exp = parse_exp_1 (&p, block, 0); + + /* Don't allow variables to be created for types. */ + if (var->root->exp->elts[0].opcode == OP_TYPE) + { + do_cleanups (old_chain); + fprintf_unfiltered (gdb_stderr, + "Attempt to use a type name as an expression."); + return NULL; + } + + var->format = variable_default_display (var); + var->root->valid_block = innermost_block; + var->name = savestring (expression, strlen (expression)); + + /* When the frame is different from the current frame, + we must select the appropriate frame before parsing + the expression, otherwise the value will not be current. + Since select_frame is so benign, just call it for all cases. */ + if (fi != NULL) + { + var->root->frame = FRAME_FP (fi); + old_fi = selected_frame; + select_frame (fi, -1); + } + + /* We definitively need to catch errors here. + If evaluate_expression succeeds we got the value we wanted. + But if it fails, we still go on with a call to evaluate_type() */ + if (gdb_evaluate_expression (var->root->exp, &var->value)) + { + /* no error */ + release_value (var->value); + if (VALUE_LAZY (var->value)) + gdb_value_fetch_lazy (var->value); + } + else + var->value = evaluate_type (var->root->exp); + + var->type = VALUE_TYPE (var->value); + + /* Set language info */ + lang = variable_language (var); + var->root->lang = languages[lang]; + + /* Set ourselves as our root */ + var->root->rootvar = var; + + /* Reset the selected frame */ + if (fi != NULL) + select_frame (old_fi, -1); + } + + if (var != NULL) + { + var->obj_name = savestring (objname, strlen (objname)); + + /* If a varobj name is duplicated, the install will fail so + we must clenup */ + if (!install_variable (var)) + { + do_cleanups (old_chain); + return NULL; + } + } + + discard_cleanups (old_chain); + return var; +} + +/* Generates an unique name that can be used for a varobj */ + +char * +varobj_gen_name (void) +{ + static int id = 0; + char obj_name[31]; + + /* generate a name for this object */ + id++; + sprintf (obj_name, "var%d", id); + + return xstrdup (obj_name); +} + +/* Given an "objname", returns the pointer to the corresponding varobj + or NULL if not found */ + +struct varobj * +varobj_get_handle (char *objname) +{ + struct vlist *cv; + const char *chp; + unsigned int index = 0; + unsigned int i = 1; + + for (chp = objname; *chp; chp++) + { + index = (index + (i++ * (unsigned int) *chp)) % VAROBJ_TABLE_SIZE; + } + + cv = *(varobj_table + index); + while ((cv != NULL) && (strcmp (cv->var->obj_name, objname) != 0)) + cv = cv->next; + + if (cv == NULL) + error ("Variable object not found"); + + return cv->var; +} + +/* Given the handle, return the name of the object */ + +char * +varobj_get_objname (struct varobj *var) +{ + return var->obj_name; +} + +/* Given the handle, return the expression represented by the object */ + +char * +varobj_get_expression (struct varobj *var) +{ + return name_of_variable (var); +} + +/* Deletes a varobj and all its children if only_children == 0, + otherwise deletes only the children; returns a malloc'ed list of all the + (malloc'ed) names of the variables that have been deleted (NULL terminated) */ + +int +varobj_delete (struct varobj *var, char ***dellist, int only_children) +{ + int delcount; + int mycount; + struct cpstack *result = NULL; + char **cp; + + /* Initialize a stack for temporary results */ + cppush (&result, NULL); + + if (only_children) + /* Delete only the variable children */ + delcount = delete_variable (&result, var, 1 /* only the children */ ); + else + /* Delete the variable and all its children */ + delcount = delete_variable (&result, var, 0 /* parent+children */ ); + + /* We may have been asked to return a list of what has been deleted */ + if (dellist != NULL) + { + *dellist = xmalloc ((delcount + 1) * sizeof (char *)); + + cp = *dellist; + mycount = delcount; + *cp = cppop (&result); + while ((*cp != NULL) && (mycount > 0)) + { + mycount--; + cp++; + *cp = cppop (&result); + } + + if (mycount || (*cp != NULL)) + warning ("varobj_delete: assertion failed - mycount(=%d) <> 0", mycount); + } + + return delcount; +} + +/* Set/Get variable object display format */ + +enum varobj_display_formats +varobj_set_display_format (struct varobj *var, + enum varobj_display_formats format) +{ + switch (format) + { + case FORMAT_NATURAL: + case FORMAT_BINARY: + case FORMAT_DECIMAL: + case FORMAT_HEXADECIMAL: + case FORMAT_OCTAL: + var->format = format; + break; + + default: + var->format = variable_default_display (var); + } + + return var->format; +} + +enum varobj_display_formats +varobj_get_display_format (struct varobj *var) +{ + return var->format; +} + +int +varobj_get_num_children (struct varobj *var) +{ + if (var->num_children == -1) + var->num_children = number_of_children (var); + + return var->num_children; +} + +/* Creates a list of the immediate children of a variable object; + the return code is the number of such children or -1 on error */ + +int +varobj_list_children (struct varobj *var, struct varobj ***childlist) +{ + struct varobj *child; + char *name; + int i; + + /* sanity check: have we been passed a pointer? */ + if (childlist == NULL) + return -1; + + *childlist = NULL; + + if (var->num_children == -1) + var->num_children = number_of_children (var); + + /* List of children */ + *childlist = xmalloc ((var->num_children + 1) * sizeof (struct varobj *)); + + for (i = 0; i < var->num_children; i++) + { + /* Mark as the end in case we bail out */ + *((*childlist) + i) = NULL; + + /* check if child exists, if not create */ + name = name_of_child (var, i); + child = child_exists (var, name); + if (child == NULL) + child = create_child (var, i, name); + + *((*childlist) + i) = child; + } + + /* End of list is marked by a NULL pointer */ + *((*childlist) + i) = NULL; + + return var->num_children; +} + +/* Obtain the type of an object Variable as a string similar to the one gdb + prints on the console */ + +char * +varobj_get_type (struct varobj *var) +{ + value_ptr val; + struct cleanup *old_chain; + struct ui_file *stb; + char *thetype; + long length; + + /* For the "fake" variables, do not return a type. (It's type is + NULL, too.) */ + if (CPLUS_FAKE_CHILD (var)) + return NULL; + + stb = mem_fileopen (); + old_chain = make_cleanup_ui_file_delete (stb); + + /* To print the type, we simply create a zero value_ptr and + cast it to our type. We then typeprint this variable. */ + val = value_zero (var->type, not_lval); + type_print (VALUE_TYPE (val), "", stb, -1); + + thetype = ui_file_xstrdup (stb, &length); + do_cleanups (old_chain); + return thetype; +} + +enum varobj_languages +varobj_get_language (struct varobj *var) +{ + return variable_language (var); +} + +int +varobj_get_attributes (struct varobj *var) +{ + int attributes = 0; + + if (variable_editable (var)) + /* FIXME: define masks for attributes */ + attributes |= 0x00000001; /* Editable */ + + return attributes; +} + +char * +varobj_get_value (struct varobj *var) +{ + return my_value_of_variable (var); +} + +/* Set the value of an object variable (if it is editable) to the + value of the given expression */ +/* Note: Invokes functions that can call error() */ + +int +varobj_set_value (struct varobj *var, char *expression) +{ + value_ptr val; + int offset = 0; + + /* The argument "expression" contains the variable's new value. + We need to first construct a legal expression for this -- ugh! */ + /* Does this cover all the bases? */ + struct expression *exp; + value_ptr value; + int saved_input_radix = input_radix; + + if (variable_editable (var) && !var->error) + { + char *s = expression; + int i; + value_ptr temp; + + input_radix = 10; /* ALWAYS reset to decimal temporarily */ + /* FIXME: Callee may longjump */ + exp = parse_exp_1 (&s, 0, 0); + if (!gdb_evaluate_expression (exp, &value)) + { + /* We cannot proceed without a valid expression. */ + FREEIF (exp); + return 0; + } + + /* If our parent is "public", "private", or "protected", we could + be asking to modify the value of a baseclass. If so, we need to + adjust our address by the offset of our baseclass in the subclass, + since VALUE_ADDRESS (var->value) points at the start of the subclass. + For some reason, value_cast doesn't take care of this properly. */ + temp = var->value; + if (var->parent != NULL && CPLUS_FAKE_CHILD (var->parent)) + { + struct varobj *super, *sub; + struct type *type; + super = var->parent->parent; + sub = super->parent; + if (sub != NULL) + { + /* Yes, it is a baseclass */ + type = get_type_deref (sub); + + if (super->index < TYPE_N_BASECLASSES (type)) + { + temp = value_copy (var->value); + for (i = 0; i < super->index; i++) + offset += TYPE_LENGTH (TYPE_FIELD_TYPE (type, i)); + } + } + } + + VALUE_ADDRESS (temp) += offset; + val = value_assign (temp, value); + VALUE_ADDRESS (val) -= offset; + value_free (var->value); + release_value (val); + var->value = val; + input_radix = saved_input_radix; + return 1; + } + + return 0; +} + +/* Returns a malloc'ed list with all root variable objects */ +int +varobj_list (struct varobj ***varlist) +{ + struct varobj **cv; + struct varobj_root *croot; + int mycount = rootcount; + + /* Alloc (rootcount + 1) entries for the result */ + *varlist = xmalloc ((rootcount + 1) * sizeof (struct varobj *)); + + cv = *varlist; + croot = rootlist; + while ((croot != NULL) && (mycount > 0)) + { + *cv = croot->rootvar; + mycount--; + cv++; + croot = croot->next; + } + /* Mark the end of the list */ + *cv = NULL; + + if (mycount || (croot != NULL)) + warning ("varobj_list: assertion failed - wrong tally of root vars (%d:%d)", + rootcount, mycount); + + return rootcount; +} + +/* Update the values for a variable and its children. This is a + two-pronged attack. First, re-parse the value for the root's + expression to see if it's changed. Then go all the way + through its children, reconstructing them and noting if they've + changed. + + Only root variables can be updated... */ + +int +varobj_update (struct varobj *var, struct varobj ***changelist) +{ + int changed = 0; + int i; + int vleft; + int error2; + struct varobj *v; + struct varobj **cv; + struct varobj **templist; + value_ptr new; + struct vstack *stack = NULL; + struct vstack *result = NULL; + struct frame_info *old_fi; + + /* sanity check: have we been passed a pointer? */ + if (changelist == NULL) + return -1; + + /* Only root variables can be updated... */ + if (var->root->rootvar != var) + /* Not a root var */ + return -1; + + /* Save the selected stack frame, since we will need to change it + in order to evaluate expressions. */ + old_fi = selected_frame; + + /* Update the root variable. value_of_root can return NULL + if the variable is no longer around, i.e. we stepped out of + the frame in which a local existed. */ + new = value_of_root (var); + if (new == NULL) + return -1; + + /* Initialize a stack for temporary results */ + vpush (&result, NULL); + + if (!my_value_equal (var->value, new, &error2)) + { + /* Note that it's changed There a couple of exceptions here, + though. We don't want some types to be reported as "changed". */ + if (type_changeable (var)) + { + vpush (&result, var); + changed++; + } + } + /* error2 replaces var->error since this new value + WILL replace the old one. */ + var->error = error2; + + /* We must always keep around the new value for this root + variable expression, or we lose the updated children! */ + value_free (var->value); + var->value = new; + + /* Initialize a stack */ + vpush (&stack, NULL); + + /* Push the root's children */ + if (var->children != NULL) + { + struct varobj_child *c; + for (c = var->children; c != NULL; c = c->next) + vpush (&stack, c->child); + } + + /* Walk through the children, reconstructing them all. */ + v = vpop (&stack); + while (v != NULL) + { + /* Push any children */ + if (v->children != NULL) + { + struct varobj_child *c; + for (c = v->children; c != NULL; c = c->next) + vpush (&stack, c->child); + } + + /* Update this variable */ + new = value_of_child (v->parent, v->index); + if (type_changeable (v) && !my_value_equal (v->value, new, &error2)) + { + /* Note that it's changed */ + vpush (&result, v); + changed++; + } + /* error2 replaces v->error since this new value + WILL replace the old one. */ + v->error = error2; + + /* We must always keep new values, since children depend on it. */ + if (v->value != NULL) + value_free (v->value); + v->value = new; + + /* Get next child */ + v = vpop (&stack); + } + + /* Alloc (changed + 1) list entries */ + /* FIXME: add a cleanup for the allocated list(s) + because one day the select_frame called below can longjump */ + *changelist = xmalloc ((changed + 1) * sizeof (struct varobj *)); + if (changed > 1) + { + templist = xmalloc ((changed + 1) * sizeof (struct varobj *)); + cv = templist; + } + else + cv = *changelist; + + /* Copy from result stack to list */ + vleft = changed; + *cv = vpop (&result); + while ((*cv != NULL) && (vleft > 0)) + { + vleft--; + cv++; + *cv = vpop (&result); + } + if (vleft) + warning ("varobj_update: assertion failed - vleft <> 0"); + + if (changed > 1) + { + /* Now we revert the order. */ + for (i=0; i < changed; i++) + *(*changelist + i) = *(templist + changed -1 - i); + *(*changelist + changed) = NULL; + } + + /* Restore selected frame */ + select_frame (old_fi, -1); + + return changed; +} + + +/* Helper functions */ + +/* + * Variable object construction/destruction + */ + +static int +delete_variable (resultp, var, only_children_p) + struct cpstack **resultp; + struct varobj *var; + int only_children_p; +{ + int delcount = 0; + + delete_variable_1 (resultp, &delcount, var, + only_children_p, 1 /* remove_from_parent_p */ ); + + return delcount; +} + +/* Delete the variable object VAR and its children */ +/* IMPORTANT NOTE: If we delete a variable which is a child + and the parent is not removed we dump core. It must be always + initially called with remove_from_parent_p set */ +static void +delete_variable_1 (resultp, delcountp, var, + only_children_p, remove_from_parent_p) + struct cpstack **resultp; + int *delcountp; + struct varobj *var; + int only_children_p; + int remove_from_parent_p; +{ + struct varobj_child *vc; + struct varobj_child *next; + + /* Delete any children of this variable, too. */ + for (vc = var->children; vc != NULL; vc = next) + { + if (!remove_from_parent_p) + vc->child->parent = NULL; + delete_variable_1 (resultp, delcountp, vc->child, 0, only_children_p); + next = vc->next; + free (vc); + } + + /* if we were called to delete only the children we are done here */ + if (only_children_p) + return; + + /* Otherwise, add it to the list of deleted ones and proceed to do so */ + if (var->obj_name == NULL) + warning ("Assertion failed: NULL var->obj_name unexpectdly found"); + else + { + cppush (resultp, strdup (var->obj_name)); + *delcountp = *delcountp + 1; + } + + /* If this variable has a parent, remove it from its parent's list */ + /* OPTIMIZATION: if the parent of this variable is also being deleted, + (as indicated by remove_from_parent_p) we don't bother doing an + expensive list search to find the element to remove when we are + discarding the list afterwards */ + if ((remove_from_parent_p) && + (var->parent != NULL)) + { + remove_child_from_parent (var->parent, var); + } + + uninstall_variable (var); + + /* Free memory associated with this variable */ + free_variable (var); +} + +/* Install the given variable VAR with the object name VAR->OBJ_NAME. */ +static int +install_variable (var) + struct varobj *var; +{ + struct vlist *cv; + struct vlist *newvl; + const char *chp; + unsigned int index = 0; + unsigned int i = 1; + + for (chp = var->obj_name; *chp; chp++) + { + index = (index + (i++ * (unsigned int) *chp)) % VAROBJ_TABLE_SIZE; + } + + cv = *(varobj_table + index); + while ((cv != NULL) && (strcmp (cv->var->obj_name, var->obj_name) != 0)) + cv = cv->next; + + if (cv != NULL) + error ("Duplicate variable object name"); + + /* Add varobj to hash table */ + newvl = xmalloc (sizeof (struct vlist)); + newvl->next = *(varobj_table + index); + newvl->var = var; + *(varobj_table + index) = newvl; + + /* If root, add varobj to root list */ + if (var->root->rootvar == var) + { + /* Add to list of root variables */ + if (rootlist == NULL) + var->root->next = NULL; + else + var->root->next = rootlist; + rootlist = var->root; + rootcount++; + } + + return 1; /* OK */ +} + +/* Unistall the object VAR. */ +static void +uninstall_variable (var) + struct varobj *var; +{ + struct vlist *cv; + struct vlist *prev; + struct varobj_root *cr; + struct varobj_root *prer; + const char *chp; + unsigned int index = 0; + unsigned int i = 1; + + /* Remove varobj from hash table */ + for (chp = var->obj_name; *chp; chp++) + { + index = (index + (i++ * (unsigned int) *chp)) % VAROBJ_TABLE_SIZE; + } + + cv = *(varobj_table + index); + prev = NULL; + while ((cv != NULL) && (strcmp (cv->var->obj_name, var->obj_name) != 0)) + { + prev = cv; + cv = cv->next; + } + + if (varobjdebug) + fprintf_unfiltered (gdb_stdlog, "Deleting %s\n", var->obj_name); + + if (cv == NULL) + { + warning ("Assertion failed: Could not find variable object \"%s\" to delete", var->obj_name); + return; + } + + if (prev == NULL) + *(varobj_table + index) = cv->next; + else + prev->next = cv->next; + + free (cv); + + /* If root, remove varobj from root list */ + if (var->root->rootvar == var) + { + /* Remove from list of root variables */ + if (rootlist == var->root) + rootlist = var->root->next; + else + { + prer = NULL; + cr = rootlist; + while ((cr != NULL) && (cr->rootvar != var)) + { + prer = cr; + cr = cr->next; + } + if (cr == NULL) + { + warning ("Assertion failed: Could not find varobj \"%s\" in root list", var->obj_name); + return; + } + if (prer == NULL) + rootlist = NULL; + else + prer->next = cr->next; + } + rootcount--; + } + +} + +/* Does a child with the name NAME exist in VAR? If so, return its data. + If not, return NULL. */ +static struct varobj * +child_exists (var, name) + struct varobj *var; /* Parent */ + char *name; /* name of child */ +{ + struct varobj_child *vc; + + for (vc = var->children; vc != NULL; vc = vc->next) + { + if (STREQ (vc->child->name, name)) + return vc->child; + } + + return NULL; +} + +/* Create and install a child of the parent of the given name */ +static struct varobj * +create_child (parent, index, name) + struct varobj *parent; + int index; + char *name; +{ + struct varobj *child; + char *childs_name; + + child = new_variable (); + + /* name is allocated by name_of_child */ + child->name = name; + child->index = index; + child->value = value_of_child (parent, index); + if (child->value == NULL || parent->error) + child->error = 1; + child->parent = parent; + child->root = parent->root; + childs_name = (char *) xmalloc ((strlen (parent->obj_name) + strlen (name) + 2) + * sizeof (char)); + sprintf (childs_name, "%s.%s", parent->obj_name, name); + child->obj_name = childs_name; + install_variable (child); + + /* Save a pointer to this child in the parent */ + save_child_in_parent (parent, child); + + /* Note the type of this child */ + child->type = type_of_child (child); + + return child; +} + +/* FIXME: This should be a generic add to list */ +/* Save CHILD in the PARENT's data. */ +static void +save_child_in_parent (parent, child) + struct varobj *parent; + struct varobj *child; +{ + struct varobj_child *vc; + + /* Insert the child at the top */ + vc = parent->children; + parent->children = + (struct varobj_child *) xmalloc (sizeof (struct varobj_child)); + + parent->children->next = vc; + parent->children->child = child; +} + +/* FIXME: This should be a generic remove from list */ +/* Remove the CHILD from the PARENT's list of children. */ +static void +remove_child_from_parent (parent, child) + struct varobj *parent; + struct varobj *child; +{ + struct varobj_child *vc, *prev; + + /* Find the child in the parent's list */ + prev = NULL; + for (vc = parent->children; vc != NULL;) + { + if (vc->child == child) + break; + prev = vc; + vc = vc->next; + } + + if (prev == NULL) + parent->children = vc->next; + else + prev->next = vc->next; + +} + + +/* + * Miscellaneous utility functions. + */ + +/* Allocate memory and initialize a new variable */ +static struct varobj * +new_variable (void) +{ + struct varobj *var; + + var = (struct varobj *) xmalloc (sizeof (struct varobj)); + var->name = NULL; + var->obj_name = NULL; + var->index = -1; + var->type = NULL; + var->value = NULL; + var->error = 0; + var->num_children = -1; + var->parent = NULL; + var->children = NULL; + var->format = 0; + var->root = NULL; + + return var; +} + +/* Allocate memory and initialize a new root variable */ +static struct varobj * +new_root_variable (void) +{ + struct varobj *var = new_variable (); + var->root = (struct varobj_root *) xmalloc (sizeof (struct varobj_root));; + var->root->lang = NULL; + var->root->exp = NULL; + var->root->valid_block = NULL; + var->root->frame = (CORE_ADDR) -1; + var->root->rootvar = NULL; + + return var; +} + +/* Free any allocated memory associated with VAR. */ +static void +free_variable (var) + struct varobj *var; +{ + /* Free the expression if this is a root variable. */ + if (var->root->rootvar == var) + { + free_current_contents ((char **) &var->root->exp); + FREEIF (var->root); + } + + FREEIF (var->name); + FREEIF (var->obj_name); + FREEIF (var); +} + +/* This returns the type of the variable. This skips past typedefs + and returns the real type of the variable. It also dereferences + pointers and references. */ +static struct type * +get_type (var) + struct varobj *var; +{ + struct type *type; + type = var->type; + + while (type != NULL && TYPE_CODE (type) == TYPE_CODE_TYPEDEF) + type = TYPE_TARGET_TYPE (type); + + return type; +} + +/* This returns the type of the variable, dereferencing pointers, too. */ +static struct type * +get_type_deref (var) + struct varobj *var; +{ + struct type *type; + + type = get_type (var); + + if (type != NULL && (TYPE_CODE (type) == TYPE_CODE_PTR + || TYPE_CODE (type) == TYPE_CODE_REF)) + type = get_target_type (type); + + return type; +} + +/* This returns the target type (or NULL) of TYPE, also skipping + past typedefs, just like get_type (). */ +static struct type * +get_target_type (type) + struct type *type; +{ + if (type != NULL) + { + type = TYPE_TARGET_TYPE (type); + while (type != NULL && TYPE_CODE (type) == TYPE_CODE_TYPEDEF) + type = TYPE_TARGET_TYPE (type); + } + + return type; +} + +/* What is the default display for this variable? We assume that + everything is "natural". Any exceptions? */ +static enum varobj_display_formats +variable_default_display (var) + struct varobj *var; +{ + return FORMAT_NATURAL; +} + +/* This function is similar to gdb's value_equal, except that this + one is "safe" -- it NEVER longjmps. It determines if the VAR's + value is the same as VAL2. */ +static int +my_value_equal (val1, val2, error2) + value_ptr val1; + value_ptr val2; + int *error2; +{ + int r, err1, err2; + + *error2 = 0; + /* Special case: NULL values. If both are null, say + they're equal. */ + if (val1 == NULL && val2 == NULL) + return 1; + else if (val1 == NULL || val2 == NULL) + return 0; + + /* This is bogus, but unfortunately necessary. We must know + exactly what caused an error -- reading val1 or val2 -- so + that we can really determine if we think that something has changed. */ + err1 = 0; + err2 = 0; + /* We do need to catch errors here because the whole purpose + is to test if value_equal() has errored */ + if (!gdb_value_equal (val1, val1, &r)) + err1 = 1; + + if (!gdb_value_equal (val2, val2, &r)) + *error2 = err2 = 1; + + if (err1 != err2) + return 0; + + if (!gdb_value_equal (val1, val2, &r)) + { + /* An error occurred, this could have happened if + either val1 or val2 errored. ERR1 and ERR2 tell + us which of these it is. If both errored, then + we assume nothing has changed. If one of them is + valid, though, then something has changed. */ + if (err1 == err2) + { + /* both the old and new values caused errors, so + we say the value did not change */ + /* This is indeterminate, though. Perhaps we should + be safe and say, yes, it changed anyway?? */ + return 1; + } + else + { + return 0; + } + } + + return r; +} + +/* FIXME: The following should be generic for any pointer */ +static void +vpush (pstack, var) + struct vstack **pstack; + struct varobj *var; +{ + struct vstack *s; + + s = (struct vstack *) xmalloc (sizeof (struct vstack)); + s->var = var; + s->next = *pstack; + *pstack = s; +} + +/* FIXME: The following should be generic for any pointer */ +static struct varobj * +vpop (pstack) + struct vstack **pstack; +{ + struct vstack *s; + struct varobj *v; + + if ((*pstack)->var == NULL && (*pstack)->next == NULL) + return NULL; + + s = *pstack; + v = s->var; + *pstack = (*pstack)->next; + free (s); + + return v; +} + +/* FIXME: The following should be generic for any pointer */ +static void +cppush (pstack, name) + struct cpstack **pstack; + char *name; +{ + struct cpstack *s; + + s = (struct cpstack *) xmalloc (sizeof (struct cpstack)); + s->name = name; + s->next = *pstack; + *pstack = s; +} + +/* FIXME: The following should be generic for any pointer */ +static char * +cppop (pstack) + struct cpstack **pstack; +{ + struct cpstack *s; + char *v; + + if ((*pstack)->name == NULL && (*pstack)->next == NULL) + return NULL; + + s = *pstack; + v = s->name; + *pstack = (*pstack)->next; + free (s); + + return v; +} + +/* + * Language-dependencies + */ + +/* Common entry points */ + +/* Get the language of variable VAR. */ +static enum varobj_languages +variable_language (var) + struct varobj *var; +{ + enum varobj_languages lang; + + switch (var->root->exp->language_defn->la_language) + { + default: + case language_c: + lang = vlang_c; + break; + case language_cplus: + lang = vlang_cplus; + break; + case language_java: + lang = vlang_java; + break; + } + + return lang; +} + +/* Return the number of children for a given variable. + The result of this function is defined by the language + implementation. The number of children returned by this function + is the number of children that the user will see in the variable + display. */ +static int +number_of_children (var) + struct varobj *var; +{ + return (*var->root->lang->number_of_children) (var);; +} + +/* What is the expression for the root varobj VAR? Returns a malloc'd string. */ +static char * +name_of_variable (var) + struct varobj *var; +{ + return (*var->root->lang->name_of_variable) (var); +} + +/* What is the name of the INDEX'th child of VAR? Returns a malloc'd string. */ +static char * +name_of_child (var, index) + struct varobj *var; + int index; +{ + return (*var->root->lang->name_of_child) (var, index); +} + +/* What is the value_ptr of the root variable VAR? */ +static value_ptr +value_of_root (var) + struct varobj *var; +{ + return (*var->root->lang->value_of_root) (var); +} + +/* What is the value_ptr for the INDEX'th child of PARENT? */ +static value_ptr +value_of_child (parent, index) + struct varobj *parent; + int index; +{ + value_ptr value; + + value = (*parent->root->lang->value_of_child) (parent, index); + + /* If we're being lazy, fetch the real value of the variable. */ + if (value != NULL && VALUE_LAZY (value)) + gdb_value_fetch_lazy (value); + + return value; +} + +/* What is the type of VAR? */ +static struct type * +type_of_child (var) + struct varobj *var; +{ + + /* If the child had no evaluation errors, var->value + will be non-NULL and contain a valid type. */ + if (var->value != NULL) + return VALUE_TYPE (var->value); + + /* Otherwise, we must compute the type. */ + return (*var->root->lang->type_of_child) (var->parent, var->index); +} + +/* Is this variable editable? Use the variable's type to make + this determination. */ +static int +variable_editable (var) + struct varobj *var; +{ + return (*var->root->lang->variable_editable) (var); +} + +/* GDB already has a command called "value_of_variable". Sigh. */ +static char * +my_value_of_variable (var) + struct varobj *var; +{ + return (*var->root->lang->value_of_variable) (var); +} + +/* Is VAR something that can change? Depending on language, + some variable's values never change. For example, + struct and unions never change values. */ +static int +type_changeable (var) + struct varobj *var; +{ + int r; + struct type *type; + + if (CPLUS_FAKE_CHILD (var)) + return 0; + + type = get_type (var); + + switch (TYPE_CODE (type)) + { + case TYPE_CODE_STRUCT: + case TYPE_CODE_UNION: + r = 0; + break; + + default: + r = 1; + } + + return r; +} + +/* C */ +static int +c_number_of_children (var) + struct varobj *var; +{ + struct type *type; + struct type *target; + int children; + + type = get_type (var); + target = get_target_type (type); + children = 0; + + switch (TYPE_CODE (type)) + { + case TYPE_CODE_ARRAY: + if (TYPE_LENGTH (type) > 0 && TYPE_LENGTH (target) > 0 + && TYPE_ARRAY_UPPER_BOUND_TYPE (type) != BOUND_CANNOT_BE_DETERMINED) + children = TYPE_LENGTH (type) / TYPE_LENGTH (target); + else + children = -1; + break; + + case TYPE_CODE_STRUCT: + case TYPE_CODE_UNION: + children = TYPE_NFIELDS (type); + break; + + case TYPE_CODE_PTR: + /* This is where things get compilcated. All pointers have one child. + Except, of course, for struct and union ptr, which we automagically + dereference for the user and function ptrs, which have no children. */ + switch (TYPE_CODE (target)) + { + case TYPE_CODE_STRUCT: + case TYPE_CODE_UNION: + children = TYPE_NFIELDS (target); + break; + + case TYPE_CODE_FUNC: + children = 0; + break; + + default: + /* Don't dereference char* or void*. */ + if (TYPE_NAME (target) != NULL + && (STREQ (TYPE_NAME (target), "char") + || STREQ (TYPE_NAME (target), "void"))) + children = 0; + else + children = 1; + } + break; + + default: + /* Other types have no children */ + break; + } + + return children; +} + +static char * +c_name_of_variable (parent) + struct varobj *parent; +{ + return savestring (parent->name, strlen (parent->name)); +} + +static char * +c_name_of_child (parent, index) + struct varobj *parent; + int index; +{ + struct type *type; + struct type *target; + char *name; + char *string; + + type = get_type (parent); + target = get_target_type (type); + + switch (TYPE_CODE (type)) + { + case TYPE_CODE_ARRAY: + { + /* We never get here unless parent->num_children is greater than 0... */ + int len = 1; + while ((int) pow ((double) 10, (double) len) < index) + len++; + name = (char *) xmalloc (1 + len * sizeof (char)); + sprintf (name, "%d", index); + } + break; + + case TYPE_CODE_STRUCT: + case TYPE_CODE_UNION: + string = TYPE_FIELD_NAME (type, index); + name = savestring (string, strlen (string)); + break; + + case TYPE_CODE_PTR: + switch (TYPE_CODE (target)) + { + case TYPE_CODE_STRUCT: + case TYPE_CODE_UNION: + string = TYPE_FIELD_NAME (target, index); + name = savestring (string, strlen (string)); + break; + + default: + name = (char *) xmalloc ((strlen (parent->name) + 2) * sizeof (char)); + sprintf (name, "*%s", parent->name); + break; + } + break; + + default: + /* This should not happen */ + name = xstrdup ("???"); + } + + return name; +} + +static value_ptr +c_value_of_root (var) + struct varobj *var; +{ + value_ptr new_val; + struct frame_info *fi; + int within_scope; + + /* Determine whether the variable is still around. */ + if (var->root->valid_block == NULL) + within_scope = 1; + else + { + reinit_frame_cache (); + fi = find_frame_addr_in_frame_chain (var->root->frame); + within_scope = fi != NULL; + /* FIXME: select_frame could fail */ + if (within_scope) + select_frame (fi, -1); + } + + if (within_scope) + { + /* We need to catch errors here, because if evaluate expression fails + we just want to make val->error = 1 and go on */ + if (gdb_evaluate_expression (var->root->exp, &new_val)) + { + if (VALUE_LAZY (new_val)) + { + /* We need to catch errors because if value_fetch_lazy fails we + still want to continue (after making val->error = 1) */ + /* FIXME: Shouldn't be using VALUE_CONTENTS? The comment on + value_fetch_lazy() says it is only called from the macro... */ + if (!gdb_value_fetch_lazy (new_val)) + var->error = 1; + else + var->error = 0; + } + } + else + var->error = 1; + + release_value (new_val); + return new_val; + } + + return NULL; +} + +static value_ptr +c_value_of_child (parent, index) + struct varobj *parent; + int index; +{ + value_ptr value, temp; + struct type *type, *target; + char *name; + + type = get_type (parent); + target = get_target_type (type); + name = name_of_child (parent, index); + temp = parent->value; + value = NULL; + + if (temp != NULL) + { + switch (TYPE_CODE (type)) + { + case TYPE_CODE_ARRAY: + value = value_slice (temp, index, 1); + temp = value_coerce_array (value); + gdb_value_ind (temp, &value); + break; + + case TYPE_CODE_STRUCT: + case TYPE_CODE_UNION: + value = value_struct_elt (&temp, NULL, name, NULL, "vstructure"); + break; + + case TYPE_CODE_PTR: + switch (TYPE_CODE (target)) + { + case TYPE_CODE_STRUCT: + case TYPE_CODE_UNION: + value = value_struct_elt (&temp, NULL, name, NULL, "vstructure"); + break; + + default: + gdb_value_ind (temp, &value); + break; + } + break; + + default: + break; + } + } + + if (value != NULL) + release_value (value); + + return value; +} + +static struct type * +c_type_of_child (parent, index) + struct varobj *parent; + int index; +{ + struct type *type; + char *name = name_of_child (parent, index); + + switch (TYPE_CODE (parent->type)) + { + case TYPE_CODE_ARRAY: + type = TYPE_TARGET_TYPE (parent->type); + break; + + case TYPE_CODE_STRUCT: + case TYPE_CODE_UNION: + type = lookup_struct_elt_type (parent->type, name, 0); + break; + + case TYPE_CODE_PTR: + switch (TYPE_CODE (TYPE_TARGET_TYPE (parent->type))) + { + case TYPE_CODE_STRUCT: + case TYPE_CODE_UNION: + type = lookup_struct_elt_type (parent->type, name, 0); + break; + + default: + type = TYPE_TARGET_TYPE (parent->type); + break; + } + break; + + default: + /* This should not happen as only the above types have children */ + warning ("Child of parent whose type does not allow children"); + /* FIXME: Can we still go on? */ + type = NULL; + break; + } + + return type; +} + +static int +c_variable_editable (var) + struct varobj *var; +{ + switch (TYPE_CODE (get_type (var))) + { + case TYPE_CODE_STRUCT: + case TYPE_CODE_UNION: + case TYPE_CODE_ARRAY: + case TYPE_CODE_FUNC: + case TYPE_CODE_MEMBER: + case TYPE_CODE_METHOD: + return 0; + break; + + default: + return 1; + break; + } +} + +static char * +c_value_of_variable (var) + struct varobj *var; +{ + struct type *type; + value_ptr val; + + if (var->value != NULL) + val = var->value; + else + { + /* This can happen if we attempt to get the value of a struct + member when the parent is an invalid pointer. */ + return xstrdup ("???"); + } + + /* BOGUS: if val_print sees a struct/class, it will print out its + children instead of "{...}" */ + type = get_type (var); + switch (TYPE_CODE (type)) + { + case TYPE_CODE_STRUCT: + case TYPE_CODE_UNION: + return xstrdup ("{...}"); + /* break; */ + + case TYPE_CODE_ARRAY: + { + char number[18]; + sprintf (number, "[%d]", var->num_children); + return xstrdup (number); + } + /* break; */ + + default: + { + long dummy; + struct ui_file *stb = mem_fileopen (); + struct cleanup *old_chain = make_cleanup_ui_file_delete (stb); + char *thevalue; + + if (VALUE_LAZY (val)) + gdb_value_fetch_lazy (val); + val_print (VALUE_TYPE (val), VALUE_CONTENTS_RAW (val), 0, + VALUE_ADDRESS (val), + stb, format_code[(int) var->format], 1, 0, 0); + thevalue = ui_file_xstrdup (stb, &dummy); + do_cleanups (old_chain); + return thevalue; + } + /* break; */ + } +} + + +/* C++ */ + +static int +cplus_number_of_children (var) + struct varobj *var; +{ + struct type *type; + int children, dont_know; + + dont_know = 1; + children = 0; + + if (!CPLUS_FAKE_CHILD (var)) + { + type = get_type_deref (var); + + if (((TYPE_CODE (type)) == TYPE_CODE_STRUCT) || + ((TYPE_CODE (type)) == TYPE_CODE_UNION)) + { + int kids[3]; + + cplus_class_num_children (type, kids); + if (kids[v_public] != 0) + children++; + if (kids[v_private] != 0) + children++; + if (kids[v_protected] != 0) + children++; + + /* Add any baseclasses */ + children += TYPE_N_BASECLASSES (type); + dont_know = 0; + + /* FIXME: save children in var */ + } + } + else + { + int kids[3]; + + type = get_type_deref (var->parent); + + cplus_class_num_children (type, kids); + if (STREQ (var->name, "public")) + children = kids[v_public]; + else if (STREQ (var->name, "private")) + children = kids[v_private]; + else + children = kids[v_protected]; + dont_know = 0; + } + + if (dont_know) + children = c_number_of_children (var); + + return children; +} + +/* Compute # of public, private, and protected variables in this class. + That means we need to descend into all baseclasses and find out + how many are there, too. */ +static void +cplus_class_num_children (type, children) + struct type *type; + int children[3]; +{ + int i; + + children[v_public] = 0; + children[v_private] = 0; + children[v_protected] = 0; + + for (i = TYPE_N_BASECLASSES (type); i < TYPE_NFIELDS (type); i++) + { + /* If we have a virtual table pointer, omit it. */ + if (TYPE_VPTR_BASETYPE (type) == type + && TYPE_VPTR_FIELDNO (type) == i) + continue; + + if (TYPE_FIELD_PROTECTED (type, i)) + children[v_protected]++; + else if (TYPE_FIELD_PRIVATE (type, i)) + children[v_private]++; + else + children[v_public]++; + } +} + +static char * +cplus_name_of_variable (parent) + struct varobj *parent; +{ + return c_name_of_variable (parent); +} + +static char * +cplus_name_of_child (parent, index) + struct varobj *parent; + int index; +{ + char *name; + struct type *type; + int children[3]; + + if (CPLUS_FAKE_CHILD (parent)) + { + /* Looking for children of public, private, or protected. */ + type = get_type_deref (parent->parent); + } + else + type = get_type_deref (parent); + + name = NULL; + switch (TYPE_CODE (type)) + { + case TYPE_CODE_STRUCT: + case TYPE_CODE_UNION: + cplus_class_num_children (type, children); + + if (CPLUS_FAKE_CHILD (parent)) + { + /* FIXME: This assumes that type orders + inherited, public, private, protected */ + int i = index + TYPE_N_BASECLASSES (type); + if (STREQ (parent->name, "private") || STREQ (parent->name, "protected")) + i += children[v_public]; + if (STREQ (parent->name, "protected")) + i += children[v_private]; + + name = TYPE_FIELD_NAME (type, i); + } + else if (index < TYPE_N_BASECLASSES (type)) + name = TYPE_FIELD_NAME (type, index); + else + { + /* Everything beyond the baseclasses can + only be "public", "private", or "protected" */ + index -= TYPE_N_BASECLASSES (type); + switch (index) + { + case 0: + if (children[v_public] != 0) + { + name = "public"; + break; + } + case 1: + if (children[v_private] != 0) + { + name = "private"; + break; + } + case 2: + if (children[v_protected] != 0) + { + name = "protected"; + break; + } + default: + /* error! */ + break; + } + } + break; + + default: + break; + } + + if (name == NULL) + return c_name_of_child (parent, index); + else + { + if (name != NULL) + name = savestring (name, strlen (name)); + } + + return name; +} + +static value_ptr +cplus_value_of_root (var) + struct varobj *var; +{ + return c_value_of_root (var); +} + +static value_ptr +cplus_value_of_child (parent, index) + struct varobj *parent; + int index; +{ + struct type *type; + value_ptr value; + char *name; + + if (CPLUS_FAKE_CHILD (parent)) + type = get_type_deref (parent->parent); + else + type = get_type_deref (parent); + + value = NULL; + name = name_of_child (parent, index); + + if (((TYPE_CODE (type)) == TYPE_CODE_STRUCT) || + ((TYPE_CODE (type)) == TYPE_CODE_UNION)) + { + if (CPLUS_FAKE_CHILD (parent)) + { + value_ptr temp = parent->parent->value; + value = value_struct_elt (&temp, NULL, name, + NULL, "cplus_structure"); + release_value (value); + } + else if (index >= TYPE_N_BASECLASSES (type)) + { + /* public, private, or protected */ + return NULL; + } + else + { + /* Baseclass */ + if (parent->value != NULL) + { + value_ptr temp; + + if (TYPE_CODE (VALUE_TYPE (parent->value)) == TYPE_CODE_PTR + || TYPE_CODE (VALUE_TYPE (parent->value)) == TYPE_CODE_REF) + gdb_value_ind (parent->value, &temp); + else + temp = parent->value; + + value = value_cast (TYPE_FIELD_TYPE (type, index), temp); + release_value (value); + } + } + } + + if (value == NULL) + return c_value_of_child (parent, index); + + return value; +} + +static struct type * +cplus_type_of_child (parent, index) + struct varobj *parent; + int index; +{ + struct type *type, *t; + + t = get_type_deref (parent); + type = NULL; + switch (TYPE_CODE (t)) + { + case TYPE_CODE_STRUCT: + case TYPE_CODE_UNION: + if (index >= TYPE_N_BASECLASSES (t)) + { + /* special */ + return NULL; + } + else + { + /* Baseclass */ + type = TYPE_FIELD_TYPE (t, index); + } + break; + + default: + break; + } + + if (type == NULL) + return c_type_of_child (parent, index); + + return type; +} + +static int +cplus_variable_editable (var) + struct varobj *var; +{ + if (CPLUS_FAKE_CHILD (var)) + return 0; + + return c_variable_editable (var); +} + +static char * +cplus_value_of_variable (var) + struct varobj *var; +{ + + /* If we have one of our special types, don't print out + any value. */ + if (CPLUS_FAKE_CHILD (var)) + return xstrdup (""); + + return c_value_of_variable (var); +} + +/* Java */ + +static int +java_number_of_children (var) + struct varobj *var; +{ + return cplus_number_of_children (var); +} + +static char * +java_name_of_variable (parent) + struct varobj *parent; +{ + char *p, *name; + + name = cplus_name_of_variable (parent); + /* If the name has "-" in it, it is because we + needed to escape periods in the name... */ + p = name; + + while (*p != '\000') + { + if (*p == '-') + *p = '.'; + p++; + } + + return name; +} + +static char * +java_name_of_child (parent, index) + struct varobj *parent; + int index; +{ + char *name, *p; + + name = cplus_name_of_child (parent, index); + /* Escape any periods in the name... */ + p = name; + + while (*p != '\000') + { + if (*p == '.') + *p = '-'; + p++; + } + + return name; +} + +static value_ptr +java_value_of_root (var) + struct varobj *var; +{ + return cplus_value_of_root (var); +} + +static value_ptr +java_value_of_child (parent, index) + struct varobj *parent; + int index; +{ + return cplus_value_of_child (parent, index); +} + +static struct type * +java_type_of_child (parent, index) + struct varobj *parent; + int index; +{ + return cplus_type_of_child (parent, index); +} + +static int +java_variable_editable (var) + struct varobj *var; +{ + return cplus_variable_editable (var); +} + +static char * +java_value_of_variable (var) + struct varobj *var; +{ + return cplus_value_of_variable (var); +} + +extern void _initialize_varobj (void); +void +_initialize_varobj (void) +{ + int sizeof_table = sizeof (struct vlist *) * VAROBJ_TABLE_SIZE; + + varobj_table = xmalloc (sizeof_table); + memset (varobj_table, 0, sizeof_table); + + add_show_from_set ( + add_set_cmd ("debugvarobj", class_maintenance, var_zinteger, + (char *) &varobjdebug, + "Set varobj debugging.\n\ +When non-zero, varobj debugging is enabled.", &setlist), + &showlist); +} diff --git a/gdb/varobj.h b/gdb/varobj.h new file mode 100644 index 0000000..28c5fac --- /dev/null +++ b/gdb/varobj.h @@ -0,0 +1,92 @@ +/* GDB variable objects API. + Copyright 1999 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#ifndef VAROBJ_H +#define VAROBJ_H 1 + +#include "symtab.h" +#include "gdbtypes.h" + +/* Enumeration for the format types */ +enum varobj_display_formats + { + FORMAT_NATURAL, /* What gdb actually calls 'natural' */ + FORMAT_BINARY, /* Binary display */ + FORMAT_DECIMAL, /* Decimal display */ + FORMAT_HEXADECIMAL, /* Hex display */ + FORMAT_OCTAL /* Octal display */ + }; + +/* String representations of gdb's format codes (defined in varobj.c) */ +extern char *varobj_format_string[]; + +/* Languages supported by this variable objects system. */ +enum varobj_languages + { + vlang_unknown = 0, vlang_c, vlang_cplus, vlang_java, vlang_end + }; + +/* String representations of gdb's known languages (defined in varobj.c) */ +extern char *varobj_language_string[]; + +/* Struct thar describes a variable object instance */ +struct varobj; + +/* API functions */ + +extern struct varobj *varobj_create (char *objname, + char *expression, CORE_ADDR frame); + +extern char *varobj_gen_name (void); + +extern struct varobj *varobj_get_handle (char *name); + +extern char *varobj_get_objname (struct varobj *var); + +extern char *varobj_get_expression (struct varobj *var); + +extern int varobj_delete (struct varobj *var, char ***dellist, + int only_children); + +extern enum varobj_display_formats varobj_set_display_format ( + struct varobj *var, + enum varobj_display_formats format); + +extern enum varobj_display_formats varobj_get_display_format ( + struct varobj *var); + +extern int varobj_get_num_children (struct varobj *var); + +extern int varobj_list_children (struct varobj *var, + struct varobj ***childlist); + +extern char *varobj_get_type (struct varobj *var); + +extern enum varobj_languages varobj_get_language (struct varobj *var); + +extern int varobj_get_attributes (struct varobj *var); + +extern char *varobj_get_value (struct varobj *var); + +extern int varobj_set_value (struct varobj *var, char *expression); + +extern int varobj_list (struct varobj ***rootlist); + +extern int varobj_update (struct varobj *var, struct varobj ***changelist); + +#endif /* VAROBJ_H */ diff --git a/gdb/wrapper.c b/gdb/wrapper.c new file mode 100644 index 0000000..be7d4e2 --- /dev/null +++ b/gdb/wrapper.c @@ -0,0 +1,165 @@ +/* Longjump free calls to gdb internal routines. + Copyright 1999 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include "defs.h" +#include "value.h" +#include "frame.h" +#include "wrapper.h" + +/* Use this struct used to pass arguments to wrapper routines. We assume + (arbitrarily) that no gdb function takes more than ten arguments. */ +struct gdb_wrapper_arguments + { + + /* Pointer to some result from the gdb function call, if any */ + char *result; + + /* The list of arguments. */ + char *args[10]; + }; + +int gdb_evaluate_expression PARAMS ((struct expression *, value_ptr *)); +int wrap_evaluate_expression PARAMS ((char *)); + +int gdb_value_fetch_lazy PARAMS ((value_ptr)); +int wrap_value_fetch_lazy PARAMS ((char *)); + +int gdb_value_equal PARAMS ((value_ptr, value_ptr, int *)); +int wrap_value_equal PARAMS ((char *)); + +int gdb_value_ind PARAMS ((value_ptr val, value_ptr * rval)); +int wrap_value_ind PARAMS ((char *opaque_arg)); + +int +gdb_evaluate_expression (exp, value) + struct expression *exp; + value_ptr *value; +{ + struct gdb_wrapper_arguments args; + args.args[0] = (char *) exp; + + if (!catch_errors ((catch_errors_ftype *) wrap_evaluate_expression, &args, + "", RETURN_MASK_ERROR)) + { + /* An error occurred */ + return 0; + } + + *value = (value_ptr) args.result; + return 1; +} + +int +wrap_evaluate_expression (a) + char *a; +{ + struct gdb_wrapper_arguments *args = (struct gdb_wrapper_arguments *) a; + + (args)->result = + (char *) evaluate_expression ((struct expression *) (args)->args[0]); + return 1; +} + +int +gdb_value_fetch_lazy (value) + value_ptr value; +{ + struct gdb_wrapper_arguments args; + + args.args[0] = (char *) value; + return catch_errors ((catch_errors_ftype *) wrap_value_fetch_lazy, &args, + "", RETURN_MASK_ERROR); +} + +int +wrap_value_fetch_lazy (a) + char *a; +{ + struct gdb_wrapper_arguments *args = (struct gdb_wrapper_arguments *) a; + + value_fetch_lazy ((value_ptr) (args)->args[0]); + return 1; +} + +int +gdb_value_equal (val1, val2, result) + value_ptr val1; + value_ptr val2; + int *result; +{ + struct gdb_wrapper_arguments args; + + args.args[0] = (char *) val1; + args.args[1] = (char *) val2; + + if (!catch_errors ((catch_errors_ftype *) wrap_value_equal, &args, + "", RETURN_MASK_ERROR)) + { + /* An error occurred */ + return 0; + } + + *result = (int) args.result; + return 1; +} + +int +wrap_value_equal (a) + char *a; +{ + struct gdb_wrapper_arguments *args = (struct gdb_wrapper_arguments *) a; + value_ptr val1, val2; + + val1 = (value_ptr) (args)->args[0]; + val2 = (value_ptr) (args)->args[1]; + + (args)->result = (char *) value_equal (val1, val2); + return 1; +} + +int +gdb_value_ind (val, rval) + value_ptr val; + value_ptr *rval; +{ + struct gdb_wrapper_arguments args; + + args.args[0] = (char *) val; + + if (!catch_errors ((catch_errors_ftype *) wrap_value_ind, &args, + "", RETURN_MASK_ERROR)) + { + /* An error occurred */ + return 0; + } + + *rval = (value_ptr) args.result; + return 1; +} + +int +wrap_value_ind (opaque_arg) + char *opaque_arg; +{ + struct gdb_wrapper_arguments *args = (struct gdb_wrapper_arguments *) opaque_arg; + value_ptr val; + + val = (value_ptr) (args)->args[0]; + (args)->result = (char *) value_ind (val); + return 1; +} diff --git a/gdb/wrapper.h b/gdb/wrapper.h new file mode 100644 index 0000000..f4303b2 --- /dev/null +++ b/gdb/wrapper.h @@ -0,0 +1,37 @@ +/* Longjump free calls to gdb internal routines. + Copyright 1999 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#ifndef WRAPPER_H +#define WRAPPER_H 1 + +/* Use this struct used to pass arguments to wrapper routines. */ +struct gdb_wrapper_arguments; + +extern int gdb_evaluate_expression PARAMS ((struct expression *, value_ptr *)); +extern int wrap_evaluate_expression PARAMS ((char *)); + +extern int gdb_value_fetch_lazy PARAMS ((value_ptr)); +extern int wrap_value_fetch_lazy PARAMS ((char *)); + +extern int gdb_value_equal PARAMS ((value_ptr, value_ptr, int *)); +extern int wrap_value_equal PARAMS ((char *)); + +extern int gdb_value_ind PARAMS ((value_ptr val, value_ptr * rval)); +extern int wrap_value_ind PARAMS ((char *opaque_arg)); + +#endif /* WRAPPER_H */ -- 2.7.4