Implement basic support for DW_TAG_GNU_call_site.
* block.c: Include gdbtypes.h and exceptions.h.
(call_site_for_pc): New function.
* block.h (call_site_for_pc): New declaration.
* defs.h: Include hashtab.h.
(make_cleanup_htab_delete, core_addr_hash, core_addr_eq): New
declarations.
* dwarf2-frame.c (dwarf2_frame_ctx_funcs): Install
ctx_no_push_dwarf_reg_entry_value.
* dwarf2expr.c (read_uleb128, read_sleb128): Support R as NULL.
(dwarf_block_to_dwarf_reg): New function.
(execute_stack_op) <DW_OP_GNU_entry_value>: Implement it.
(ctx_no_push_dwarf_reg_entry_value): New function.
* dwarf2expr.h (struct dwarf_expr_context_funcs): New field
push_dwarf_reg_entry_value.
(ctx_no_push_dwarf_reg_entry_value, dwarf_block_to_dwarf_reg): New
declarations.
* dwarf2loc.c: Include gdbcmd.h.
(dwarf_expr_ctx_funcs): New forward declaration.
(entry_values_debug, show_entry_values_debug, call_site_to_target_addr)
(dwarf_expr_reg_to_entry_parameter)
(dwarf_expr_push_dwarf_reg_entry_value): New.
(dwarf_expr_ctx_funcs): Install dwarf_expr_push_dwarf_reg_entry_value.
(dwarf2_evaluate_loc_desc_full): Handle NO_ENTRY_VALUE_ERROR.
(needs_dwarf_reg_entry_value): New function.
(needs_frame_ctx_funcs): Install it.
(_initialize_dwarf2loc): New function.
* dwarf2loc.h (entry_values_debug): New declaration.
* dwarf2read.c (struct dwarf2_cu): New field call_site_htab.
(read_call_site_scope): New forward declaration.
(process_full_comp_unit): Copy call_site_htab.
(process_die): Support DW_TAG_GNU_call_site.
(read_call_site_scope): New function.
(dwarf2_get_pc_bounds): Support NULL HIGHPC.
(dwarf_tag_name): Support DW_TAG_GNU_call_site.
(cleanup_htab): Delete.
(write_psymtabs_to_index): Use make_cleanup_htab_delete instead of it.
* exceptions.h (enum errors): New NO_ENTRY_VALUE_ERROR.
* gdb-gdb.py (StructMainTypePrettyPrinter): Support
FIELD_LOC_KIND_DWARF_BLOCK.
* gdbtypes.h (enum field_loc_kind): New entry
FIELD_LOC_KIND_DWARF_BLOCK.
(struct main_type): New loc entry dwarf_block.
(struct call_site, FIELD_DWARF_BLOCK, SET_FIELD_DWARF_BLOCK)
(TYPE_FIELD_DWARF_BLOCK): New.
* python/py-type.c: Include dwarf2loc.h.
(check_types_equal): Support FIELD_LOC_KIND_DWARF_BLOCK. New
internal_error call on unknown FIELD_LOC_KIND.
* symtab.h (struct symtab): New field call_site_htab.
* utils.c (do_htab_delete_cleanup, make_cleanup_htab_delete)
(core_addr_hash, core_addr_eq): New functions.
gdb/testsuite/
Implement basic support for DW_TAG_GNU_call_site.
* gdb.arch/Makefile.in (EXECUTABLES): Add amd64-entry-value.
* gdb.arch/amd64-entry-value.cc: New file.
* gdb.arch/amd64-entry-value.exp: New file.
PR python/12691: Add the inferior to Python exited event
* python/py-exitedevent.c (create_exited_event_object): Add inferior
to exited_event.
* python/py-event.h (emit_exited_event): Likewise
* python/-inferior.c (python_inferior_exit): Likewise
2011-10-04 Kevin Pouget <kevin.pouget@st.com>
PR python/12691: Add the inferior to Python exited event
* gdb.python/py-events.exp: Test the inferior attribute of exited
event with a fork.
* gdb.python/py-events.py: Print inferior number on exit.
* gdb.python/py-events.c: Fork the inferior.
2011-10-04 Kevin Pouget <kevin.pouget@st.com>
PR python/12691: Add the inferior to Python exited event
* gdb.texinfo (Events In Python): Describe exited inferior attribute.
gdb/ChangeLog:
* python/python.c (python_run_simple_file): New function.
(source_python_script, source_python_script_for_objfile):
Replace call to PyRun_SimpleFile by call to
python_run_simple_file.
Handle multiple breakpoint hits in Python interface:
* python/py-bpevent.c (create_breakpoint_event_object): Rename C/Python
variable to breakpoints.
* python/py-stopevent.c (emit_stop_event): Return a Python tuple of
bps instead of single breakpoint. Fix some space typos.
* python/py-stopevent.c (create_breakpoint_event_object): Rename
variable to breakpoints.
testsuite:
* gdb.python/py-events.exp: Set a duplicate breakpoint and check its
presence.
* gdb.python/py-events.py (breakpoint_stop_handler): Browse all the
breakpoint hits.
doc:
* gdb.texinfo (Events In Python): New function documentation:
gdb.BreakpointEvent.breakpoints. Indicate that
gdb.BreakpointEvent.breakpoint is now deprecated.
* findvar.c (read_var_value): Never return NULL, throw an error
instead. Update the function comment. State symbol name in the error
messages.
* python/py-frame.c (frapy_read_var): Remove handling of NULL from
read_var_value.
* stack.c (print_frame_args): Likewise.
* valops.c (value_of_variable): Likewise.
* event-top.h (MAXPROMPTS, struct prompts): Delete.
(set_async_annotation_level, set_async_prompt, pop_prompt)
(push_prompt, new_async_prompt): Delete declarations.
* top.h (get_prompt, set_prompt): Change prototype.
(get_prefix, set_prefix, get_suffix, set_suffix): Delete
declarations.
* top.c (command_loop):
(top_prompt): New global.
(get_prefix, set_prefix, get_suffix, ): Delete.
(get_prompt, set_prompt): Rewrite.
(show_new_async_prompt): Rename to ...
(show_prompt): ... this.
(init_main): Adjust. Don't handle --annotate=2 here.
* event-top.c (new_async_prompt): Delete.
(the_prompts): Delete.
(more_to_come): Make static.
(display_gdb_prompt): Use top_level_prompt() to compute the top
level prompt, and don't notify the before_prompt observers
directly here. Always trick readline into not trying to display
the prompt if sync_execution and displaying the primary prompt.
If displaying a local/secondary prompt, always show it, even if
sync_execution is set.
(change_annotation_level): Delete.
(top_level_prompt): New, based on change_annotation_level.
(push_prompt, pop_prompt): Delete.
(async_disable_stdin): No longer pushes prompt.
(command_line_handler): No longer pushes or pops prompt. If more
input is expected, call display_gdb_prompt with an explicit empty
prompt.
(async_stop_sig): Adjust.
(set_async_annotation_level, set_async_prompt): Delete.
* python/python.c (before_prompt_hook): Adjust.
* top.c: Include interps.h.
(execute_command): If the target can async, but the interpreter is
in sync mode, synchronously wait for the command to finish before
returning.
(execute_command_to_string): Force the interpreter to sync mode.
* infrun.c: Include interps.h.
(fetch_inferior_event): Don't restore the prompt yet if the
interpreter is in sync mode.
* interps.c (interpreter_async): New global.
* interps.h (interpreter_async): Declare.
* inf-loop.c: Include interps.h.
(inferior_event_handler): Don't print the language change or run
breakpoint commands yet if the interpreter in is sync mode.
* main.c (captured_command_loop): Flip the interpreter to async
mode.
* cli/cli-script.c: Include interps.h.
(execute_user_command, while_command, if_command): Force the
interpreter to sync mode.
* python/python.c: Include interps.h.
(python_command, execute_gdb_command): Force the interpreter to
sync mode.
* cp-name-parser.y (struct demangle_info): Remove unused
member PREV.
(d_grab): Likewise.
(allocate_info): Change return type to struct demangle_info *.
Always allocate a new demangle_info.
Remove unused PREV pointer.
(cp_new_demangle_parse_info): New function.
(cp_demangled_name_parse_free): New function.
(do_demangled_name_parse_free_cleanup): New function.
(make_cleanup_cp_demangled_name_parse_free): New function.
(cp_demangled_name_to_comp): Change return type to
struct demangle_parse_info *.
Allocate a new storage for each call.
(main): Update usage for cp_demangled_name_to_comp
API change.
* cp-support.h (struct demangle_parse_info): New structure.
(cp_demangled_name_to_comp): Update API change for
return type.
(cp_new_demangle_parse_info): Declare.
(make_cleanup_cp_demangled_name_parse_free): New declaration.
(cp_demangled_name_parse_free): Declare.
* cp-support.c (cp_canonicalize_string): Update API
change for cp_demangled_name_to_comp.
(mangled_name_to_comp): Likewise.
Return struct demangle_parse_info, too.
(cp_class_name_from_physname): Update mangled_name_to_comp
API change.
(method_name_from_physname): Likewise.
(cp_func_name): Update API change for cp_demangled_name_to_comp.
(cp_remove_params): Likewise.
* python/py-type.c (typy_legacy_template_argument): Likewise.
* cp-support.h (cp_canonicalize_string_no_typedefs): Declare.
(cp_merge_demangle_parse_infos): Declare.
* cp-support.c (ignore_typedefs): New file global.
(copy_string_to_obstack): New function.
(inspect_type): New function.
(replace_typedefs): New function.
(replace_typedefs_qualified_name): New function.
(cp_canonicalize_string_no_typedefs): New function.
* cp-name-parser.y (cp_merge_demangle_parse_infos): New function.
(cp_new_demangle__parse_info): Allocate and initialize the obstack.
* linespec.c (find_methods): Use cp_canonicalize_string_no_typedefs
instead of cp_canonicalize_string.
(find_method): Likewise.
(decode_compound): Before looking up the name, call
cp_canonicalize_string_no_typedefs.
(decode_variable): Likewise.
* python/lib/gdb/__init__.py: Auto-load files in command and
function directories.
* python/python.c (finish_python_initialization): Use
os.path.join.
* python/lib/gdb/command/pretty_printers.py: Self register
command.
* NEWS: Document auto-loading.
2011-08-09 Phil Muldoon <pmuldoon@redhat.com>
* gdb.texinfo (Python): Document command and function
auto-loading.
Implement most breakpoint_ops methods for all breakpoint types,
and move the default handlings to the proper callbacks.
gdb/
* breakpoint.c (update_watchpoint): Always call the breakpoint's
works_in_software_mode method.
(insert_bp_location): Go through breakpoint_ops->insert_location
for software and hardware watchpoints.
(create_internal_breakpoint): Pass bkpt_breakpoint_ops as
breakpoint_ops.
(remove_breakpoint_1): Go through breakpoint_ops->remove_location
for software and hardware watchpoints.
(print_it_typical): Delete.
(print_bp_stop_message): Always call the breakpoint_ops->print_it
method.
(watchpoint_check): Adjust comment.
(bpstat_check_location): Simply always call the breakpoint's
breakpoint_hit method.
(bpstat_stop_status): Always call the breakpoint's check_status
method. Remove special cases for watchpoints and internal event
breakpoints from here (moved to the check_status implementations).
(print_one_breakpoint_location): Assume b->ops is never NULL.
Remove static tracepoint marker id printing from here (moved to
the print_one_detail callback implementation of tracepoints).
(init_bp_location): Assert OPS is never NULL.
(allocate_bp_location): Always call the breakpoint's
allocate_location method, and remove the default code from here.
(free_bp_location): Always call the location's dtor method, and
remove the default code from here.
(init_raw_breakpoint_without_location): Assert OPS is never NULL.
(set_raw_breakpoint_without_location): Add new breakpoint_ops
parameter. Pass it down.
(set_raw_breakpoint): Ditto.
(print_it_catch_fork): Adjust to take a bpstat as argument.
(catch_fork_breakpoint_ops): Install methods.
(print_it_catch_vfork): Adjust to take a bpstat as argument.
(catch_vfork_breakpoint_ops): Install methods.
(dtor_catch_syscall): Call the base dtor.
(print_it_catch_syscall): Adjust to take a bpstat as argument.
(catch_syscall_breakpoint_ops): Install methods.
(dtor_catch_exec): Call the base dtor.
(print_it_catch_exec): Adjust to take a bpstat as argument.
(catch_exec_breakpoint_ops): Install methods.
(hw_breakpoint_used_count, hw_watchpoint_used_count): Always call
the breakpoint's resources_needed method, and remove the default
code from here.
(set_momentary_breakpoint): Pass bkpt_breakpoint_ops as
breakpoint_ops.
(clone_momentary_breakpoint): Clone the original's ops.
(mention): Always call the breakpoint's print_mention method, and
remove the default code from here.
(create_breakpoint_sal): Adjust to pass the ops to
set_raw_breakpoint rather than setting it manually.
(create_breakpoint): Assert ops is never NULL. Adjust to pass the
ops to set_raw_breakpoint_without_location rather than setting it
manually.
(break_command_1): Pass bkpt_breakpoint_ops as breakpoint_ops.
(print_it_ranged_breakpoint): Adjust to take a bpstat as argument.
(ranged_breakpoint_ops): Install methods.
(break_range_command): Adjust to pass the ops to
set_raw_breakpoint rather than setting it manually.
(re_set_watchpoint, breakpoint_hit_watchpoint)
(check_status_watchpoint, resources_needed_watchpoint)
(works_in_software_mode_watchpoint, print_it_watchpoint)
(print_mention_watchpoint, print_recreate_watchpoint): New
functions.
(watchpoint_breakpoint_ops): Install new methods.
(print_it_masked_watchpoint): New function.
(masked_watchpoint_breakpoint_ops): Install new methods.
(watch_command_1): Adjust to pass the right breakpoint_ops to
set_raw_breakpoint_without_location rather than setting it
manually later. Record the current pspace.
(print_it_exception_catchpoint): Adjust to take a bpstat as
argument.
(gnu_v3_exception_catchpoint_ops): Install new methods.
(say_where): New function.
(null_re_set, null_check_status, null_works_in_software_mode)
(null_resources_needed, null_print_one_detail, bp_location_dtor):
New functions.
(bp_location_ops): New global.
(bkpt_dtor, bkpt_allocate_location, bkpt_re_set)
(bkpt_insert_location, bkpt_remove_location, bkpt_breakpoint_hit)
(bkpt_check_status, bkpt_resources_needed)
(bkpt_works_in_software_mode, bkpt_print_it, bkpt_print_mention)
(bkpt_print_recreate): New functions.
(bkpt_breakpoint_ops): New global.
(tracepoint_re_set, tracepoint_insert_location)
(tracepoint_remove_location, tracepoint_breakpoint_hit)
(tracepoint_check_status, tracepoint_works_in_software_mode)
(tracepoint_print_it, tracepoint_print_one_detail)
(tracepoint_print_mention, tracepoint_print_recreate): New
functions.
(tracepoint_breakpoint_ops): New global.
(delete_breakpoint): Always call the breakpoint's dtor method, and
remove the default handling from here.
(breakpoint_re_set_default): Make static.
(breakpoint_re_set_one): Always call the breakpoints re_set
method, and remove the default handling from here.
(trace_command, ftrace_command, strace_command)
(create_tracepoint_from_upload): Pass appropriate breakpoints_ops
to create_breakpoint.
(save_breakpoints): Always call the breakpoint's print_recreate
method, and remove the default handling from here.
* ada-lang.c (dtor_exception): Call the base dtor.
(re_set_exception): Call the base method.
(print_it_exception, print_it_catch_exception): Adjust to take a
bpstat as argument.
(catch_exception_breakpoint_ops): Install methods.
(print_it_catch_exception_unhandled): Adjust to take a bpstat as
argument.
(catch_exception_unhandled_breakpoint_ops): Install methods.
(print_it_catch_assert): Adjust to take a bpstat as argument.
(catch_assert_breakpoint_ops): Install methods.
* breakpoint.h (struct breakpoint_ops): Adjust the print_it method
to take a bpstat as argument.
(enum print_stop_action): Add describing comments to each enum
value.
(breakpoint_re_set_default): Delete declaration.
(null_re_set, null_works_in_software_mode, null_resources_needed)
(null_check_status, null_print_one_detail): Declare.
(bkpt_breakpoint_ops): Declare.
(bkpt_dtor, bkpt_allocate_location, bkpt_re_set)
(bkpt_insert_location, bkpt_remove_location, bkpt_breakpoint_hit)
(bkpt_check_status, bkpt_resources_needed)
(bkpt_works_in_software_mode, bkpt_print_it)
(null_print_one_detail, bkpt_print_mention, bkpt_print_recreate):
Declare.
* mi/mi-cmd-break.c (mi_cmd_break_insert): Adjust to pass
bkpt_breakpoint_ops.
* python/py-breakpoint.c (bppy_init): Ditto.
* event-top.c (cli_command_loop): Use get_prompt, get_suffix,
get_prefix.
(display_gdb_prompt): Likewise.
(change_annotation_level): Likewise.
(push_prompt): Likewise.
(pop_prompt): Likewise.
(handle_stop_sig): Use get_prompt with a level.
* top.c (command_loop): Use get_prompt with a level.
(set_async_annotation_level): Use set_prompt with a level.
(get_prefix): New function.
(set_prefix): Ditto.
(set_suffix): Ditto.
(get_suffix): Ditto.
(get_prompt): Accept a level argument.
(set_prompt): Accept a level argument. Free old prompts. Set
new_async_prompt if level is 0.
(init_main): Use set_prompt with a level. Do not set
new_async_prompt.
* event-top.h (PROMPT, SUFFIX, PREFIX): Move to top.c
* top.h: Declare set_suffix, get_suffix, set_prefix, get_prefix.
Modify set_prompt, get_prompt to account for levels.
* tui/tui-interp.c (tui_command_loop): Use get_prompt with a
level
* python/python.c (before_prompt_hook): Use set_prompt.
* python/py-inferior.c (infpy_dealloc): New function.
(inferior_to_inferior_object): Return a new object, or a
new reference to the existing object.
(find_thread_object): Cleanup references to inferior.
(delete_thread_object): Ditto.
* python/py-infthread.c (create_thread_object): Do not increment
inferior reference count.
"No" for missing scripts.
(info_auto_load_scripts): Tweak "Loaded" column to fit "Missing".
doc/
* gdb.texinfo (Auto-loading): Document printing of missing scripts.
* python/py-auto-load.c (struct auto_load_pspace_info): New member
script_not_found_warning_printed.
(init_loaded_scripts_info): Renamed from create_loaded_scripts_hash,
all callers updated. Initialize script_not_found_warning_printed.
(get_auto_load_pspace_data_for_loading): New function.
(maybe_add_script): New function.
(source_section_scripts): Simplify. Only print one warning regardless
of the number of auto-load scripts not found.
(clear_section_scripts): Clear script_not_found_warning_printed.
(auto_load_objfile_script): Record script in hash table.
(count_matching_scripts): New function.
(maybe_print_script): Renamed from maybe_print_section_script, all
callers updated. Rewrite to use ui_out_*.
(info_auto_load_scripts): Renamed from
maintenance_print_section_scripts, all callers updated.
(gdbpy_initialize_auto_load): "maintenance print section-scripts"
renamed as "info auto-load-scripts".
doc/
* gdb.texinfo (Auto-loading): Document "info auto-load-scripts".
testsuite/
* gdb.python/py-objfile-script.exp: New file.
* gdb.python/py-objfile-script.c: New file.
* gdb.python/py-objfile-script-gdb.py: New file.
* testsuite/gdb.python/py-section-script.exp: Test
"info auto-load-scripts".
Put prototype declaration on same line as return type.
* objc-exp.y: Ditto.
* p-exp.y: Ditto.
* python/py-stopevent.h: Ditto.
For long function names, split parameters to allow function name
on same line as return type.
* solib-pa64.c: Ditto.
* varobj.c: Ditto.
* varobj.h: Ditto.
For long function declaration, use single line.
* hppa-tdep.h: Ditto.
* inferior.h: Ditto.
* gdb.texinfo (Breakpoints In Python): Add description and
example
of Python stop function operation.
2010-03-14 Phil Muldoon <pmuldoon@redhat.com>
* gdb.python/py-breakpoint.exp: Add Python stop operations
tests.
2011-03-14 Phil Muldoon <pmuldoon@redhat.com>
* python/python.h: Declare gdbpy_should_stop and
gdbpy_breakpoint_has_py_cond.
* python/python.c: Add python.h to includes. Remove
python.h from
HAVE_PYTHON definition
(gdbpy_should_stop): New dummy function.
(gdbpy_breakpoint_has_py_cond): New dummy function.
* python/py-breakpoint.c (bppy_init): Rewrite to allow
sub-classing capabilities.
(gdbpy_should_stop): New function.
(gdbpy_breakpoint_has_py_cond): New function.
(local_setattro): New function.
* breakpoint.c (condition_command): Add check for Python
'stop'
operation.
(bpstat_check_breakpoint_conditions): Execute Python
'stop'
operation function as part of stop/continue tests.
gdb/
* value.h (value_bytes_available): Declare.
(mark_value_bytes_unavailable): Declare.
* value.c (struct range): New struct.
(range_s): New typedef.
(ranges_overlap): New function.
(range_lessthan): New function.
(ranges_contain_p): New function.
(struct value) <unavailable>: New field.
(value_bytes_available): New function.
(mark_value_bytes_unavailable): New function.
(require_not_optimized_out): Constify parameter.
(require_available): New function.
(value_contents_all, value_contents): Require all bytes be
available.
(value_free): Free `unavailable'.
(value_copy): Copy `unavailable'.
* valprint.h (val_print_unavailable): Declare.
* valprint.c (valprint_check_validity): Rename `offset' parameter
to `embedded_offset'. If printing a scalar, check whether the
value chunk is available.
(val_print_unavailable): New.
(val_print_scalar_formatted): Check whether the value is
available.
* python/py-prettyprint.c (apply_val_pretty_printer): Refuse
pretty-printing unavailable values.
2011-02-04 Sami Wagiaalla <swagiaal@redhat.com>
* gdb.python/py-evthreads.c: New file.
* gdb.python/py-evthreads.exp: New file.
* gdb.python/py-events.py: New file.
* gdb.python/py-events.exp: New file.
* gdb.python/py-events.c: New file.
2011-02-04 Sami Wagiaalla <swagiaal@redhat.com>
Oguz Kayral <oguzkayral@gmail.com>
* python/py-inferior.c (python_on_normal_stop): New function.
(python_on_resume): New function.
(python_inferior_exit): New function.
(gdbpy_initialize_inferior): Add normal_stop, target_resumed, and
inferior_exit observers.
* python/py-evtregistry.c: New file.
* python/py-threadevent.c : New file.
* python/py-event.c: New file.
* python/py-evts.c: New file.
* python/py-continueevent.c: New file.
* python/py-bpevent.c: New file.
* python/py-signalevent.c: New file.
* python/py-exetiedevent.c: New file.
* python/py-breakpoint.c (gdbpy_breakpoint_from_bpstats): New function.
Move struct breakpoint_object from here...
* python/python-internal.h: ... to here.
* python/py-event.h: New file.
* python/py-events.h: New file.
* Makefile.in (SUBDIR_PYTHON_OBS): Add py-breakpointstopevent.o,
py-continueevent.o, py-event.o, py-eventregistry.o, py-events.o,
py-exitedevent.o, py-signalstopevent.o, and py-stopevent.o.
(SUBDIR_PYTHON_SRCS): Add py-breakpointstopevent.c,
py-continueevent.c, py-event.c, py-eventregistry.c, py-events.c,
py-exitedevent.c, py-signalstopevent.c, and py-stopevent.c.
Add build rules for all the above.
* python/python.c (execute_gdb_command): Call
prevent_dont_repeat.
* top.c (suppress_dont_repeat): New global.
(dont_repeat): Use it.
(prevent_dont_repeat): New function.
* command.h (prevent_dont_repeat): Declare.
This makes several adjustements to the configure python-config.py
scripts to deal with the differences between a Unix install of Python
and a Windows install of Python (as downloaded from the Python website).
Differences:
- The Python executable is directly in the python prefix directory
as opposed to inside the bin/ subdirectory.
- The name of the python library is does not have a dot in the version
number: On Unix, we have libpython2.7, while on Windows, it's
libpython27. So the regexp extracting the python version from
the Python lib filename had to be adjusted slightly.
Also, the tests checking the name of the libpython had to be
adjusted to allow for that.
- There are no link options following the -lpython<version> switch
on Windows, but the regexp extracting the python version was
using it as a delimiter. It had to be removed.
- python-config.py does not work on Windows, mostly because
some sysconfig variables are missing. They are not necessary
so the script was adapted to skip them if not defined.
- The paths returned by python-config.py follow the Windows filename
convention in terms of the directory separator, and this is causing
trouble when the build environment is cygwin (while the compiler
and Python are MinGW). We could have fixed that in the configure
script, but it felt simpler to do so in python-config.py
gdb/ChangeLog:
* configure.ac: Add handling of Python distribution on Windows.
* python-config.py: If the LIBS, SYSLIBS, LIBPL and/or LINKFORSHARED
sysconfig variables are not defined, then do not use them.
On Windows, if LIBPL is not defined, then use prefix + '/libs'
instead. On Windows, return all paths using forward-slashes
rather than backslashes.
This is preparation work for being able to build GDB with Python
support on MinGW.
So far, the "python<version>" subdirectory needs to be specified
when including a Python header file. In order to do that, we have
some special configury that tweaks the include path returned by
python-config.py such that the use of the subdirectory in the include
is necessary. This was done in order to protect ourselves from
possible filename conflicts, since some of the filenames chosen by
Python were a little generic.
The problem is that this cannot work with a standard Python install
on MinGW systems. On such systems, the .h files are located in
<python_prefix>/include. So, in preparation for allowing us to build
GDB on MinGW with Python support enabled, this patch changes the
requirement to provide the "python<version>" subdirectory in the
include directive.
The positive consequence is that we no longer need to have a set
of #include directives for each version of Python, since the include
directive is now the same for all versions of Python. However, the
downside is that we are losing the level of protection we were trying
to achieve by forcing the subdirectory in the include directive.
In order to reduce a bit the consequences of a possible conflict,
this patch also changes the location where the -I/path/to/python
switch goes, to be last in the list (suggested by Doug Evans).
One last change is the fact that we are now including Python.h
and all other Python include headers using angle brackets rather
than double-quotes. This fixes a problem on case-insensitive
systems where #include "Python.h" causes our gdb/python/python.h
header to be included instead of Python's <Python.h> header.
gdb/ChangeLog:
* configure.ac: Remove fallback behavior for building
against Python. Remove tweaking of Python include path.
Add PYTHON_CPPFLAGS and PYTHON_LIBS substitution.
(AC_TRY_LIBPYTHON): Adjust program used in linking test.
If link is successful, set PYTHON_CPPFLAGS and PYTHON_LIBS.
Always restore CPPFLAGS and LIBS after linking test.
* configure: Regenerated.
* Makefile.in (INTERNAL_CPPFLAGS): Add @PYTHON_CPPFLAGS@.
(INSTALLED_LIBS, CLIBS): Add @PYTHON_LIBS@.
* python/python-internal.h: Adjust includes of Python .h files.
PR python/12212
* python/py-inferior.c (find_thread_object): Check if PIDGET
returns 0.
2010-11-23 Phil Muldoon <pmuldoon@redhat.com>
PR python/12212
* gdb.python/python.exp: Check that selected_thread raises an
error when no inferior is loaded.
* python/py-breakpoint.c (BPPY_REQUIRE_VALID): Check if bp is
NULL.
(BPPY_SET_REQUIRE_VALID): Ditto.
(bpnum_is_valid): Delete function.
(bppy_get_visibility): New function.
(bppy_new): Parse for, and validate internal keyword. Pass
internal keyword to breakpoint or watchpoint functions.
(build_bp_list): New function.
(gdbpy_breakpoints): Rewrite. Use build_bp_list and
iterate_over_breakpoints.
(gdbpy_breakpoint_created): Rewrite. Do not store breakpoints in a
look-aside vector.
(gdbpy_breakpoint_deleted): Rewrite, defer breakpoint management
to internal breakpoint chain.
* breakpoint.c (set_breakpoint_number): New function.
(breakpoint_1): Check if breakpoint number is more than zero.
(set_raw_breakpoint_without_location): Set py_bp_object to NULL.
(create_breakpoint_sal): Take a new parameter called internal.
Call set_breakpoint_number with internal parameter. Do not
mention internal breakpoints. All callers updated.
(create_breakpoint): Ditto.
(create_breakpoints_sal): Ditto.
(watch_command_1): Ditto.
(watch_command_wrapper): Take a new parameter called internal.
All callers updated.
(rwatch_command_wrapper): Ditto.
(awatch_command_wrapper): Ditto.
(save_breakpoints): Update breakpoint save condition check.
(iterate_over_breakpoints): New function.
* breakpoint.h: Add conditional python includes. Add py_bp_object
and comment to struct breakpoint. Update all callers.
* defs.h: Add PyObject definition for GDB builds without Python.
2010-11-11 Phil Muldoon <pmuldoon@redhat.com>
* gdb.texinfo (Breakpoints In Python): Document "internal"
parameter, and visible attribute.
2010-11-11 Phil Muldoon <pmuldoon@redhat.com>
* gdb.python/py-breakpoint.exp: Add internal watchpoint and
breakpoint tests.
enable pretty-printer, disable pretty-printer.
* NEWS: Mention them.
* data-directory/Makefile.in (PYTHON_FILES): Add gdb/printing.py,
gdb/command/__init__.py, gdb/command/pretty_printers.py.
* python/lib/gdb/__init__.py: Install pretty-printer commands.
* python/lib/gdb/printing.py: New file.
* python/lib/gdb/command/__init__.py: New file.
* python/lib/gdb/command/pretty_printers.py: New file.
doc/
* gdb.texinfo (Pretty Printing): Expand into three sections,
introduction, example, and commands.
(Python API): Delete section Disabling Pretty-Printers, merge into
Selecting Pretty-Printers.
(Writing a Pretty-Printer): New section. Move the pretty-printer
example here, and reformat to match python coding style. Add a second
example using the gdb.printing module.
(Python modules): Add gdb.printing.
testsuite/
* gdb.python/py-pp-maint.c: New file.
* gdb.python/py-pp-maint.exp: New file.
* gdb.python/py-pp-maint.py: New file.
(gdb_init): Add a comment regarding initialize_all_files.
Call finish_python_initialization at the end.
* python/python.h (finish_python_initialization): Declare.
* python/python.c (finish_python_initialization): New function.
(_initialize_python): Move python-implemented initialization there
and call it.
(GdbMethods): Use #ifdef HAVE_PYTHON for consistency.
There were two types of errors, mostly compiler warnings:
1. _FILE_OFFSET_BITS being redefined in pyconfig.h;
This is a problem we're familiar with, having seen similar
issues on GNU/Linux systems. I used a similar solution.
2. GCC 4.5 complains that calls to PyEval_InitThreads and
PyEval_ReleaseLock have no effect. This is because our Python
is built without thread support, leading us to use the dummy
#define in python-internal.h which just gets replaced by `0'.
Since this function returns void (checked versions 2.4 and 2.7),
I simply removed the 0.
gdb/ChangeLog:
python/python-internal.h (_FILE_OFFSET_BITS): Undefine.
(PyEval_InitThreads): Remove duplicate. Define as nothing.
(PyEval_ReleaseLock): Define as nothing.
* python/py-breakpoint.c (bppy_set_condition): New comment.
* python/py-cmd.c (cmdpy_function): Call also gdbpy_print_stack for
failed PyUnicode_Decode.
(cmdpy_completer): Skip element for failed
python_string_to_host_string.
(cmdpy_init): Return -1 on failed python_string_to_host_string.
* python/py-frame.c (frapy_read_var): Extend the function comment.
* python/py-function.c (fnpy_init): Return -1 on failed
python_string_to_host_string.
* python/py-inferior.c (infpy_read_memory, infpy_write_memory): Extend
the function comment.
(infpy_search_memory): Extend the function comment. Remove the
PyErr_SetString call on already set error state.
* python/py-param.c (set_parameter_value): Extend the function
comment. Return -1 on failed python_string_to_host_string, twice.
(set_attr): Extend the function comment.
(compute_enum_values): Extend the function comment. New variable
back_to. Protect self->enumeration by BACK_TO cleanups. Return 0 on
failed python_string_to_host_string.
(get_doc_string): Call gdbpy_print_stack on failed
python_string_to_host_string.
(parmpy_init): Extend the function comment.
* python/py-prettyprint.c (pretty_print_one_value): Likewise.
(gdbpy_get_display_hint, print_children): Call gdbpy_print_stack on
failed python_string_to_host_string.
* python/py-value.c (valpy_new, valpy_getitem, valpy_call)
(valpy_binop, valpy_richcompare): Extend the function comment.
* python/python.c
(struct python_env) <error_type, error_value, error_traceback>: New
fields.
(restore_python_env): Handle PyErr_Occurred. Call PyErr_Restore.
(ensure_python_env): Call PyErr_Fetch.
* varobj.c (update_dynamic_varobj_children): Call gdbpy_print_stack on
failed convert_value_from_python.
(value_get_print_value): Call gdbpy_print_stack on failed
python_string_to_target_python_string.
gdb/testsuite/
* gdb.python/py-error.exp: New file.
* gdb.python/py-error.py: New file.
* Makefile.in (XML_SYSCALL_DIR, XML_SYSCALL_FILES): Moved to
data-directory/Makefile.in.
(SUBDIRS): Add data-directory.
(all): Remove xml-syscall-copy dependency.
(xml-syscall-copy): Moved to data-directory/Makefile.in as
stamp-syscalls.
(xml-syscall-install): Moved to data-directory/Makefile.in as
install-syscalls.
(install-only): Remove xml-syscall-install dependency.
(all-data-directory): New rule.
(data-directory/Makefile): New rule.
* configure.ac (AC_OUTPUT): Add data-directory/Makefile.
* configure: Regenerate.
* data-directory/Makefile.in: New file.
* python/lib/gdb/__init__.py: New file.
testsuite/
* gdb.base/catch-syscall.exp (do_syscall_tests): Update location
of syscall staging area.
Fix printing parameters of inlined functions.
* ada-lang.c (is_known_support_routine)
(ada_unhandled_exception_name_addr_from_raise): Provide NULL parameter
for find_frame_funname.
* python/py-frame.c (frapy_name): Likewise.
* stack.c (find_frame_funname): New parameter funcp. Update the
function comment. Fill it in.
(print_frame): New variable func. Initialize it by
find_frame_funname. Print arguments only if FUNC is not NULL. Use
FUNC as the parameter of print_args_stub.
* stack.h (find_frame_funname): New parameter funcp. Remove the
function declaration comment.
gdb/testsuite/
Fix printing parameters of inlined functions.
* gdb.dwarf2/dw2-inline-param.exp: New file.
* gdb.dwarf2/dw2-inline-param-main.c: New file.
* gdb.dwarf2/dw2-inline-param.S: New file.
* breakpoint.c (save_breakpoints): Use RETURN_MASK_ALL.
* cli-out.c: Include vec.h.
(cli_field_fmt, cli_spaces, cli_text, cli_message, cli_flush): New
variable stream, initialize it, use it.
(cli_redirect): New function comment. Replace the stream and
original_stream fields by the new streams field. Remove the
original_stream != NULL conditional, assert error on NULL instead.
(out_field_fmt, field_separator): New variable stream, initialize it, use it.
(cli_out_data_ctor): Assert non-NULL stream. Replace the stream and
original_stream fields by the new streams field.
(cli_out_set_stream): Replace the stream field by the new streams
field.
* cli-out.h: Include vec.h.
(ui_filep): New typedef, call DEF_VEC_P for it.
(struct cli_ui_out_data): Replace the stream and original_stream
fields by the new streams field.
* cli/cli-logging.c (set_logging_redirect): Call ui_out_redirect with
NULL first. Extend the comment.
(handle_redirections): Call ui_out_redirect with output.
* python/py-breakpoint.c (bppy_get_commands): Move ui_out_redirect
calls outside of the TRY_CATCH block.
gdb/testsuite/
* gdb.base/ui-redirect.exp: New file.
2010-08-25 Sami Wagiaalla <swagiaal@redhat.com>
* psymtab.c (add_psymbol_to_bcache): Remove 'static' from
'static partial_symbol psymbol'.
(psymbol_hash): New function.
(psymbol_compare): New function.
* bcache.c (hash_continue): New.
(hash): Use hash_continue.
* bcache.c: Add hash_function and compare_function
pointers to bcache struct.
(bcache_full): Use bcache->hash_function, and
bcache->compare_function.
(bcache_compare): New function.
(bcache_xmalloc): Take hash_function and
compare_function arguments and initialize the
bcach's pointers.
Updated comment.
* objfiles.c (allocate_objfile): Updated.
* symfile.c (reread_symbols): Updated.
* python/py-type.c (typy_richcompare): Updated.
(gdbpy_event_fds): Change type to `struct serial *' a array from
int array.
(gdbpy_run_events): Change parameters. Use serial_readchar in
place of read.
(gdbpy_post_event): Use serial_write in place of write.
(gdbpy_initialize_events): Use serial_pipe instead of pipe, and
serial_async in place of add_file_handler.
PR python/11060:
* python/py-type.c (typy_legacy_template_argument): New function,
extracted from typy_template_argument.
(typy_template_argument): Use TYPE_TEMPLATE_ARGUMENT. Return a
value when needed.
gdb/testsuite
PR python/11060:
* gdb.python/py-type.c (Temargs): New template.
(temvar): New variable.
* gdb.python/py-type.exp (test_template): New proc.
* python/py-value.c (valpy_call): New Function.
2010-07-27 Phil Muldoon <pmuldoon@redhat.com>
* gdb.python/py-value.exp (test_inferior_function_call): New function.
* gdb.python/py-value.c (func1): New function.
(func2): Likewise.
2010-07-27 Phil Muldoon <pmuldoon@redhat.com>
* gdb.texinfo (Values From Inferior): Add value inferior function
call description.
This is just a copy of the Python 2.7 version of python-config.py.
Tested with versions 2.5 and 2.6. It's nearly identical to the
previous version, except it's written in a more pythonic way,
so it should be fine for 2.4 as well.
gdb/ChangeLog:
* python/python-config.py: Resync with Python 2.7 version of this
script.
The debugger fails to build when configure with --python-python=<path>
where <path> is a non-system location. The reason is a warning made
fatal due to the definition of _XOPEN_SOURCE inside pyconfig.h. This
is exactly the same problem as with _POSIX_C_SOURCE, handled in
python-internal.h as follow:
| /* /usr/include/features.h on linux systems will define _POSIX_C_SOURCE
| if it sees _GNU_SOURCE (which config.h will define).
| pyconfig.h defines _POSIX_C_SOURCE to a different value than
| /usr/include/features.h does causing compilation to fail.
| To work around this, undef _POSIX_C_SOURCE before we include Python.h. */
| #undef _POSIX_C_SOURCE
This patch fixes this problem the same way.
2010-06-30 Joel Brobecker <brobecker@adacore.com>
* python/python-internal.h (_XOPEN_SOURCE): Undefine before
including Python.h.
Python scripts to be used by GDB can be stored in that directory,
and will be automatically found by the interpreter when importing them.
This patch also sets up <gdb_pythondir>/gdb as the directory where gdb
submodules can be stored. For now, there is nothing there, but it can
now be added easily without further code changes.
gdb/ChangeLog:
2010-06-24 Joel Brobecker <brobecker@adacore.com>
* python/python.c (_initialize_python): Add new "constant"
PYTHONDIR in gdb module. Insert this path at the head of
sys.path. Set gdb.__path__ to gdb.PYTHONDIR + '/gdb' and
exec its __init__.py script if it exists in that directory.
* acinclude.m4 (GDB_AC_DEFINE_RELOCATABLE): New function.
(GDB_AC_WITH_DIR): Call it.
* configure.ac: Define WITH_PYTHON_PATH if we can find the
python installation directory.
* config.in: Regenerate.
* configure: Regenerate.
* defs.h (python_libdir): Declare.
* main.c (python_libdir): Define.
(captured_main): Initialize python_libdir.
* python/python.c (_initialize_python): #ifdef WITH_PYTHON_PATH,
call Py_SetProgramName to make sure python can find its libraries
and modules.
* NEWS: Document them.
* python/py-cmd.c (cmdpy_function): Don't print a traceback if
the exception is gdb.GdbError. Print a second traceback if there's
an error computing the error message.
(gdbpy_string_to_argv): New function.
* python/py-utils.c (gdbpy_obj_to_string): New function.
(gdbpy_exception_to_string): New function.
* python/python-internal.h (gdbpy_string_to_argv): Declare.
(gdbpy_obj_to_string, gdbpy_exception_to_string): Declare.
(gdbpy_gdberror_exc): Declare.
* python/python.c (gdbpy_gdberror_exc): New global.
(_initialize_python): Initialize gdbpy_gdberror_exc and create
gdb.GdbError.
(GdbMethods): Add string_to_argv.
doc/
* gdb.texinfo (Exception Handling): Document gdb.GdbError.
(Commands In Python): Document gdb.string_to_argv.
testsuite/
* gdb.python/py-cmd.exp: Add tests for gdb.GdbError and
gdb.string_to_argv.
* python/py-auto-load.c: White space.
* python/py-block.c: White space.
* python/py-breakpoint.c: White space.
* python/py-cmd.c: White space.
* python/py-function.c: White space.
* python/py-lazy-string.c: White space.
* python/py-objfile.c: White space.
* python/py-param.c: White space.
* python/py-prettyprint.c: White space.
* python/py-progspace.c: White space.
* python/py-symtab.c: White space.
* python/python.c: White space.
* python/py-type.c: White space.
* python/py-utils.c: White space.
* python/py-value.c: White space.
Tom Tromey <tromey@redhat.com>
Thiago Jung Bauermann <bauerman@br.ibm.com>
* Makefile.in (SUBDIR_PYTHON_OBS): Add py-parameter.
(SUBDIR_PYTHON_SRCS): Likewise.
(py-parameter.o): New rule.
* python/py-parameter.c: New file.
* python/python-internal.h (gdbpy_initialize_parameter)
(gdbpy_parameter, gdbpy_parameter_value)
(gdbpy_parse_command_name): Declare.
* python/py-cmd.c (parse_command_name): Rename to
gdbpy_parse_command_name.
(gdbpy_parse_command_name): Accept a starting list parameter and
use over cmdlist.
(cmdpy_init): Use gdbpy_parse_command_name.
* python/python.c (parameter_to_python): Rename to
gdbpy_parameter_to_python. Accept enum var_types and value.
(gdbpy_parameter): Use gdbpy_parameter_value.
(_initialize_python): Call gdbpy_initialize_parameters.
2010-04-29 Phil Muldoon <pmuldoon@redhat.com>
* gdb.python/py-param.exp: New File.
2010-04-29 Phil Muldoon <pmuldoon@redhat.com>
Tom Tromey <tromey@redhat.com>
Thiago Jung Bauermann <bauerman@br.ibm.com>
* gdb.texinfo (Parameters In Python): New Node.
PR python/11381
* python/py-prettyprint.c (pretty_print_one_value): Test for
Py_None.
(print_string_repr): Test for Py_None. Set flags accordingly.
Return value depending on return type.
(print_children): Take a value indicating whether data was printed
before this function was called. Alter output accordingly.
(apply_val_pretty_printer): Capture return value from
print_string_repr and pass to print_children.
2010-04-14 Phil Muldoon <pmuldoon@redhat.com>
* gdb.python/py-prettyprint.py (NoStringContainerPrinter): New printer.
* gdb.python/py-prettyprint.c: Add justchildren struct, typedefs.
* gdb.python/py-prettyprint.exp: New test for to_string returning None.
* gdb.python/py-mi.exp: New test for to_string returning None.
2010-04-14 Phil Muldoon <pmuldoon@redhat.com>
* gdb.texinfo (Pretty Printing): Document behaviour when to_string
returns None.
PR python/11417
* python/py-lazy-string.c (stpy_convert_to_value): Check for
a NULL address.
(gdbpy_create_lazy_string_object): Allow strings with a NULL
address and a zero length.
2010-04-08 Phil Muldoon <pmuldoon@redhat.com>
* gdb.python/py-value: Add null string variable.
(test_lazy_string): Test zero length, NULL address lazy
strings.
PR python/11036
* python/py-frame.c (frapy_read_var): Add block argument and logic
to cope with user provided blocks.
2010-02-28 Phil Muldoon <pmuldoon@redhat.com>
* gdb.texinfo (Frames In Python): Add block parameter and
description to read_var text.
2010-02-28 Phil Muldoon <pmuldoon@redhat.com>
* gdb.python/py-frame.exp: Add read_var block tests.
* gdb.python/py-frame.c (block): New function.
Tom Tromey <tromey@redhat.com>
* python/py-type.c (typy_lookup_typename): Add in block argument.
If provided restrict lookup to specified blocks.
(gdbpy_lookup_type): Likewise.
(typy_lookup_type): Likewise.
2010-02-26 Phil Muldoon <pmuldoon@redhat.com>
Tom Tromey <tromey@redhat.com>
* gdb.texinfo (Types In Python): Describe block argument in
template_argument and gdb.lookup_type.
PR python/10804
* python/py-type.c (typy_range): New Function.
2009-12-08 Phil Muldoon <pmuldoon@redhat.com>
* gdb.python/py-type.exp (test_range): New test.
2009-12-08 Phil Muldoon <pmuldoon@redhat.com>
* gdb.texinfo (Types In Python): Describe range function.
* python/py-value.c (valpy_getitem): Test value before allowing
subscript operation.
2009-09-21 Phil Muldoon <pmuldoon@redhat.com>
* gdb.python/py-value.exp (test_subscript_regression): New
function. Test for invalid subscripts.
* gdb.python/py-value.c (main): Add test array, and pointer to it.
(ptr_ref): New function.
with save, free.
(register_objfile_data_with_cleanup): Delete arg cleanup and replace
with save, free. All callers updated.
(clear_objfile_data): Replace cleanup loop with separate save and
free loops.
* objfiles.h (register_objfile_data_with_cleanup): Update.
* arm-tdep.c (arm_objfile_data_free): Renamed from
arm_objfile_data_cleanup, all callers updated.
* dwarf2read.c (dwarf2_per_objfile_free): Renamed from
dwarf2_per_objfile_cleanup, all callers updated.
* python/py-objfile.c (py_free_objfile): Renamed from clean_up_objfile,
all callers updated.
* python/py-type.c (save_objfile_types): Renamed from
clean_up_objfile_types, all callers updated.
smash_to_memberptr_type, lookup_array_range_type, check_stub_method):
Use type architecture instead of current_gdbarch.
* gdbtypes.h (address_space_name_to_int, address_space_int_to_name):
Add GDBARCH paramter.
* gdbtypes.c (address_space_name_to_int, address_space_int_to_name):
Add GDBARCH parameter. Use it instead of current_gdbarch.
* c-typeprint.c (c_type_print_modifier): Update call.
* parse.c (push_type_address_space): Likewise.
* findvar.c (extract_typed_address, store_typed_address): Use type
architecture instead of current_gdbarch.
* value.c (value_as_address, unpack_field_as_long): Use type architecture
instead of current_gdbarch.
* doublest.c (floatformat_from_length): Add GDBARCH argument. Use it
instead of current_gdbarch.
(floatformat_from_type): Pass type architecture.
* infcall.c (find_function_addr): Use type architecture instead
of current_gdbarch.
* valarith.c (value_bitstring_subscript, value_x_binop, value_neg,
value_bit_index): Use type architecture instead of current_gdbarch.
* valops.c (value_cast, value_slice): Likewise.
* value.h (modify_field): Add TYPE argument.
* value.c (modify_field): Add TYPE argument. Use type architecture
instead of current_gdbarch.
(set_internalvar_component): Likewise.
* eval.c (evaluate_struct_tuple): Update call.
* valops.c (value_assign): Likewise.
* ada-lang.c (modify_general_field): Likewise. Add TYPE argument.
(make_array_descriptor): Update calls.
(move_bits): Add BITS_BIG_ENDIAN_P argument. Use it instead of
current_gdbarch.
(ada_value_assign, value_assign_to_component): Update calls.
(decode_packed_array, ada_value_primitive_packed_val, ada_value_assign,
value_assign_to_component): Use type arch instead of current_gdbarch.
* printcmd.c (float_type_from_length): Remove GDBARCH argument,
use type architecture instead.
(print_scalar_formatted, printf_command): Update calls. Use type
architecture instead of current_gdbarch.
* valprint.c (val_print_type_code_int): Use type architecture
instead of current_gdbarch.
* varobj.c (value_get_print_value): Likewise.
* python/python-prettyprint.c (print_string_repr): Add GDBARCH
argument. Use it instead of current_gdbarch.
(apply_val_pretty_printer): Update call.
* ada-valprint.c (ada_val_print_1): Use type architecture instead
of current_gdbarch.
* c-valprint.c (print_function_pointer_address): Add GDBARCH argument.
Use it instead of current_gdbarch.
(c_val_print): Update calls passing type architecture.
* f-valprint.c (f_val_print): Use type architecture instead of
current_gdbarch.
* jv-valprint (java_value_print): Likewise.
* m2-valprint.c (print_function_pointer_address): Add GDBARCH argument.
Use it instead of current_gdbarch.
(print_unpacked_pointer): Update calls passing type architecture.
* scm-valprint.c (scm_scmval_print): Use type architecture instead of
current_gdbarch.
* gnu-v3-abi.c (get_class_arch): Remove.
(gnuv3_rtti_type): Use get_type_arch instead of get_class_arch. Remove
special-case check for Java classes.
(gnuv3_virtual_fn_field, gnuv3_baseclass_offset, gnuv3_print_method_ptr,
gnuv3_method_ptr_size, gnuv3_make_method_ptr, gnuv3_method_ptr_to_value):
Use get_type_arch instead of get_class_arch.
value_bitstring_subscript, value_ptradd): Use LONGEST instead
of value as type of the index argument.
(value_ptrsub): Remove.
* valarith.c (value_subscript, value_subscripted_rvalue,
value_bitstring_subscript, value_ptradd): Use LONGEST instead
of value as type of the index argument.
(value_ptrsub): Remove.
* wrapper.h (gdb_value_subscript): Use LONGEST instead of
value as type of the index argument.
* wrapper.c (gdb_value_subscript): Likewise.
Update calls to gdb_value_subscript, value_subscript,
value_subscripted_rvalue, value_bitstring_subscript and
value_ptradd to use LONGEST instead of value as index
argument type. Use value_ptradd instead of value_ptrsub.
* ada-lang.c (ada_value_subscript, ada_value_ptr_subscript,
ada_tag_name_2): Update.
* ada-tasks.c (read_atcb): Update.
* eval.c (evaluate_subexp_standard): Update.
* valarith.c (value_subscript): Update.
* gnu-v2-abi.c (gnuv2_virtual_fn_field): Update.
* gnu-v3-abi.c (gnuv3_get_virtual_fn, gnuv3_baseclass_offset,
gnuv3_method_ptr_to_value): Update.
* jv-lang.c (evaluate_subexp_java): Update.
* m2-lang.c (evaluate_subexp_modula2): Update.
* python/python-value.c (valpy_getitem, valpy_binop): Update.
* wrapper.c (gdb_value_subscript): Update.
* varobj.c (c_describe_child): Update.
* gdbtypes.h (create_string_type): Add character type argument.
* dwarf2read.c (read_tag_string_type): Pass character type to
create_string_type.
* value.h (value_string): Add character type argument.
* valops.c (value_string): Add character type argument. Pass it to
create_string_type. Do not allocate space in inferior.
* valarith.c (value_concat): Pass character type to value_string.
* value.h (value_typed_string): Rename to ...
(value_cstring): ... this.
* valops.c (value_typed_string): Rename to ...
(value_cstring): ... this.
* c-lang.c (evaluate_subexp_c): Update.
* python/python-value.c (builtin_type_pychar): New define.
(convert_value_from_python): Call value_cstring instead
of value_from_string.
* value.c (value_from_string): Remove.
* value.h (value_from_string): Remove.
* eval.c (evaluate_subexp_standard): Pass character type to
value_string. Pass expression architecture to value_nsstring
and lookup_child_selector.
* objc-lang.h (lookup_objc_class): Add GDBARCH parameter.
(lookup_child_selector): Likewise.
(value_nsstring): Likewise.
* objc-lang.c (lookup_objc_class): Add GDBARCH parameter.
Pass character type to value_string..
(lookup_child_selector): Likewise.
(value_nsstring): Add GDBARCH parameter, use it instead of
objfile architecture. Pass architecture to lookup_objc_class
and lookup_child_selector. Pass character type to value_string.
(end_msglist): Pass architecture to lookup_objc_class.
* objc-exp.y: Pass architecture to lookup_objc_class.
(lookup_typename): Add LANGUAGE and GDBARCH parameters.
(lookup_unsigned_typename): Likewise.
(lookup_signed_typename): Likewise.
* gdbtypes.c (lookup_typename): Add LANGUAGE and GDBARCH parameters.
Use them instead of current_language and current_gdbarch.
(lookup_unsigned_typename): Add LANGUAGE and GDBARCH parameters.
Pass them to lookup_typename.
(lookup_signed_typename): Likewise.
* c-exp.y: Pass parse_language and parse_gdbarch to
lookup_unsigned_typename and lookup_signed_typename.
* objc-exp.y: Likewise.
* m2-exp.y: Pass parse_language and parse_gdbarch to lookup_typename.
* c-lang.c (evaluate_subexp_c): Pass expression language and
gdbarch to lookup_typename.
* printcmd.c (printf_command): Pass current language and
gdbarch to lookup_typename.
* python/python-type.c (typy_lookup_typename): Likewise.
Include "language.h".
* python/python-frame.c (frapy_richcompare): Return
Py_NotImplemented, not an error. Handle Py_NE as well.
gdb/testsuite
* gdb.python/python-frame.exp (gdb_py_test_silent_cmd): Test !=
operator on Frame.
Change gdb.Value.address from a method to an attribute.
* python/python-value.c (value_object): Add `address' element.
(valpy_dealloc): Decrement reference to self->address if set.
(valpy_new): Initialize val_obj->address.
(valpy_address): Rename to ...
(valpy_get_address): ... this. Change signature from method to
attribute. Update self->address if not set.
(value_to_value_object): Initialize val_obj->address.
(value_object_getset): Add `address' element.
(value_object_methods): Remove `address' element.
gdb/testsuite/
* gdb.python/python-value.exp: Add tests for the address
attribute.
gdb/doc/
* gdb.texinfo (Values From Inferior): Change gdb.Value.address
from a method to an attribute.
2009-03-21 Jan Kratochvil <jan.kratochvil@redhat.com>
Jim Blandy <jimb@red-bean.com>
Thiago Jung Bauermann <bauerman@br.ibm.com>
Tom Tromey <tromey@redhat.com>
Miscellaneous fixes to the Python code.
* python/python-cmd.c (cmdpy_init): Accept keyword
arguments.
* python/python-value.c (valpy_string): Accept keyword
arguments.
(valpy_binop): Use `break' to exit from the TRY_CATCH block.
Do not call value_to_value_object on NULL RES_VAL.
(value_object_methods): Change `string' entry to also accept
keyword arguments.
(convert_value_from_python): Return a copy of the value if obj is
a gdb.Value object.
(value_object_methods): Mark the `string' method as accepting
keywords, and show method "prototype" in the doc string.
* python/python.c (get_parameter): Don't return inside a
TRY_CATCH.
gdb/doc/
2009-03-21 Thiago Jung Bauermann <bauerman@br.ibm.com>
* gdb.texinfo (Values From Inferior): Fix optional arguments
markup.
(Commands In Python): Adjust argument names of gdb.Command.__init__
to what the function accepts as keywords.
gdb/testsuite/
2009-03-21 Thiago Jung Bauermann <bauerman@br.ibm.com>
* gdb.python/python-cmd.exp: Add tests for keyword arguments.
* gdb.python/python-function.exp: Add test for function returning
a GDB value.
* python/python-utils.c (python_string_to_unicode): Always return
a new reference.
(python_string_to_target_string): Decrement transient python
instance.
(python_string_to_host_string): Likewise.
Silence a few -Wmissing-prototypes warnings.
PR build/9877:
* amd64-nat.c: Include "amd64-nat.h".
* fork-child.c (_initialize_fork_child): Ditto.
* gcore.c (_initialize_gcore): Ditto.
* inf-ptrace.c: Include "inf-ptrace.h".
(inf_ptrace_store_registers): Make it static.
* linux-nat.c (linux_nat_terminal_ours): Make it static.
(_initialize_linux_nat): Declare before definition.
* linux-tdep.c: Include "linux-tdep.h".
* linux-thread-db.c (_initialize_thread_db): Declare before
definition.
* proc-service.c (_initialize_proc_service): Ditto.
* remote.c (remote_send_printf): Make it static.
* solib.c: Include "solib.h".
* symfile-mem.c (_initialize_symfile_mem): Declare before
definition.
* ada-lang.c (ada_la_decode, ada_match_name)
(ada_suppress_symbol_printing, ada_is_array_type)
(ada_value_ptr_subscript, ada_array_length)
(ada_to_static_fixed_value): Make them static.
(_initialize_ada_language): Declare before definition.
* ada-tasks.c (ada_get_task_number, ada_get_environment_task)
(ada_task_list_changed, ada_new_objfile_observer): Make them
static.
(_initialize_tasks): Declare before definition.
* addrmap.c (_initialize_addrmap): Declare before definition.
* auxv.c (default_auxv_parse): Make it static.
* bfd-target.c (target_bfd_xfer_partial, target_bfd_xclose): Make
them static.
* breakpoint.c (remove_sal): Add line break.
(expand_line_sal_maybe): Make it static.
* cp-name-parser.y: Include "cp-support.h".
* cp-valprint.c (cp_find_class_member): Make it static.
* eval.c (value_f90_subarray): Ditto.
* exceptions.c (print_any_exception): Ditto.
* findcmd.c (_initialize_mem_search): Declare before definition.
* frame.c (frame_observer_target_changed): Make it static.
* gnu-v3-abi.c (gnuv3_find_method_in): Make it static.
* inf-child.c: Include "inf-child.h".
* inferior.h (valid_inferior_id): Rename to ...
(valid_gdb_inferior_id): ... this.
* infrun.c (infrun_thread_stop_requested, siginfo_make_value):
Make them static.
* jv-lang.c (java_language_arch_info): Make it static.
* m2-typeprint.c (m2_get_discrete_bounds): Ditto.
* osdata.c (info_osdata_command): Make it static.
* regcache.c (regcache_observer_target_changed): Make it static.
* reverse.c (_initialize_reverse): Declare before definition.
* stabsread.c (cleanup_undefined_types_noname)
(cleanup_undefined_types_1): Make them static.
* symfile.c (place_section): Make it static.
* symtab.c (find_pc_sect_psymtab_closer): Make it static.
* target-descriptions.c (_initialize_target_descriptions): Declare
before definition.
* target.c (default_get_ada_task_ptid, find_default_can_async_p)
(find_default_is_async_p, find_default_supports_non_stop): Make
them static.
(target_supports_non_stop): Add prototype.
(dummy_pid_to_str): Make it static.
* utils.c (_initialize_utils): Declare before definition.
* ada-exp.y (_initialize_ada_exp): Declare before definition.
* solib-svr4.c (HAS_LM_DYNAMIC_FROM_LINK_MAP): Add a prototype.
* target.h (struct target_ops): Add a prototype to the
to_can_execute_reverse callback.
* macroscope.c (_initialize_macroscope): Declare before definition.
* cp-namespace.c (_initialize_cp_namespace): Declare before definition.
* python/python.c (_initialize_python): Declare before definition.
* tui/tui-command.c: Include "tui/tui-command.h".
* tui/tui-data.c (init_content_element, init_win_info): Make them
static.
* tui/tui-disasm.c: Include "tui/tui-disasm.h".
* tui/tui-interp.c (_initialize_tui_interp): Declare before
definition.
* tui/tui-layout.c: Include "tui/tui-layout.h".
(_initialize_tui_layout): Declare before definition.
* tui/tui-regs.c: Include "tui/tui-regs.h".
(tui_display_reg_element_at_line): Make it static.
(_initialize_tui_regs): Declare before definition.
* tui/tui-stack.c (_initialize_tui_stack): Declare before
definition.
* tui/tui-win.c: Include "tui/tui-win.h".
(_initialize_tui_win): Declare before definition.
(tui_sigwinch_handler): Make it static. Wrap in ifdef SIGWINCH.
* tui/tui-win.h (tui_sigwinch_handler): Delete declaration.
(tui_get_cmd_list): Add a prototype.
* tui/tui-windata.c: Include tui-windata.h.
* tui/tui-wingeneral.c (box_win): Make it static.
* cli/cli-logging.c (show_logging_command): Make it static.
(_initialize_cli_logging): Declare before definition.
* mi/mi-common.c (_initialize_gdb_mi_common): Declare before
definition.
2009-02-04 Tom Tromey <tromey@redhat.com>
Thiago Jung Bauermann <bauerman@br.ibm.com>
Phil Muldoon <pmuldoon@redhat.com>
* python/python-internal.h (gdbpy_get_value_from_history): Rename
prototype to gdbpy_history.
(gdbpy_is_string): Declare.
(python_string_to_host_string): Declare.
* python/python-utils.c (gdbpy_is_string): New function.
(unicode_to_encoded_string): New function.
(unicode_to_target_string): Use it.
(python_string_to_host_string): New function.
* python/python-value.c (valpy_address): New function.
(convert_value_from_python): Use gdbpy_is_string. Change to throw
Python exception instead of a GDB exception on error. Properly check
Python booleans.
(valpy_getitem): Convert field name to host string. Handle array
accesses. Adapt to new behaviour of convert_value_from_python.
(valpy_new): Adapt to new behaviour of convert_value_from_python.
(enum valpy_opcode) <VALPY_LSH, VALPY_RSH, VALPY_BITAND,
VALPY_BITXOR, VALPY_BITOR>: New constants.
(valpy_binop): Update. Adapt to new behaviour of
convert_value_from_python.
(valpy_invert): New function.
(valpy_lsh): Likewise.
(valpy_rsh): Likewise.
(valpy_and): Likewise.
(valpy_or): Likewise.
(valpy_xor): Likewise.
(valpy_richcompare): Call convert_value_from_python instead of doing
conversions itself.
(is_intlike, valpy_int, valpy_long, valpy_float): New functions.
(gdbpy_get_value_from_history): Rename
function to gdbpy_history.
(gdbpy_initialize_values): Don't set tp_new.
(value_object_type): Add valpy_new.
(value_object_methods): Add `address' entry.
(value_object_as_number): Update for new methods.
* python/python.c (GdbMethods): Rename entry from
`get_value_from_history' to `history'.
gdb/doc/
2009-02-04 Tom Tromey <tromey@redhat.com>
* gdb.texinfo (Basic Python): Document gdb.history.
gdb/testsuite/
2009-02-04 Tom Tromey <tromey@redhat.com>
Thiago Jung Bauermann <bauerman@br.ibm.com>
* gdb.python/python-value.exp: Use `gdb.history' instead of
`gdb.value_from_history'.
(test_value_numeric_ops): Add test for conversion of enum constant.
* gdb.python/python-value.c (enum e): New type.
(evalue): New global.
(main): Use argv.
* breakpoint.h (bpstat_do_actions): Remove bpstat* argument.
* breakpoint.c (bpstat_do_actions): Rename to ...
(bpstat_do_actions_1): ... this. Make static. Change return type
to int. Return true if a breakpoint proceeded.
(bpstat_do_actions): New, as wrapper around bpstat_do_actions_1.
(delete_breakpoint): Don't reference the global stop_bpstat; it's
gone.
* gdbthread.h (struct thread_info): Add stop_bpstat.
(save_infrun_state, load_infrun_state): Remove stop_bpstat
argument.
* thread.c (load_infrun_state, save_infrun_state): Remove
stop_bpstat argument, and the code referencing it.
* infcall.c: Include "gdbthread.h".
(call_function_by_hand): Adjust.
* exceptions.c: Include "gdbthread.h".
(throw_exception): Adjust.
* infcmd.c (stop_bpstat): Delete.
(continue_command): In all-stop, set the ignore count on the
thread that reported the stop. In non-stop, set it on the current
thread.
(finish_command_continuation): Adjust.
(program_info): Adjust.
* infrun.c (clear_proceed_status): Adjust.
(context_switch): Don't context-switch stop_bpstat.
(handle_inferior_event): Adjust.
(normal_stop): Adjust.
(save_inferior_status, restore_inferior_status): Adjust.
* inf-loop.c (inferior_event_handler): Remove parameter to
bpstat_do_actions call.
* top.c (command_loop): Remove parameter to bpstat_do_actions
call. Call it unconditionally.
* event-top.c (command_handler): Ditto.
* python/python.c (execute_gdb_command): Ditto.