aboutsummaryrefslogtreecommitdiff
path: root/gdb
AgeCommit message (Collapse)AuthorFilesLines
2017-01-10Use gdbpy_enter_varobj in py-varobj.cTom Tromey2-11/+10
This converts the remaining functions in py-varobj.c to use gdbpy_enter_varobj. 2017-01-10 Tom Tromey <tom@tromey.com> * python/py-varobj.c (py_varobj_iter_dtor, py_varobj_iter_next): Use gdbpy_enter_varobj.
2017-01-10Introduce gdbpy_enter_varobj and use itTom Tromey4-13/+33
This introduces gdbpy_enter_varobj, a subclass of gdbpy_enter; then changes one function in py-varobj.c to use it. gdbpy_enter_varobj takes a varobj as an argument, similar to varobj_ensure_python_env. 2017-01-10 Tom Tromey <tom@tromey.com> * varobj.c (gdbpy_enter_varobj): New constructor. * python/python-internal.h (gdbpy_enter_varobj): New class. * python/py-varobj.c (py_varobj_get_iterator): Use gdbpy_enter_varobj.
2017-01-10Use gdbpy_enter in py-xmethod.cTom Tromey2-91/+83
This changes the remaining functions in py-xmethod.c to use gdbpy_enter; using gdbpy_ref and unique_xmalloc_ptr as appropriate. 2017-01-10 Tom Tromey <tom@tromey.com> * python/py-xmethods.c (gdbpy_get_xmethod_result_type): Use gdbpy_enter, gdbpy_ref, unique_xmalloc_ptr. (gdbpy_invoke_xmethod): Use gdbpy_ref, gdbpy_enter. (gdbpy_get_xmethod_arg_types): Use gdbpy_ref, unique_xmalloc_ptr. (gdbpy_get_xmethod_arg_types): Use gdbpy_ref, gdbpy_enter.
2017-01-10Use gdbpy_ref in invoke_match_methodTom Tromey2-38/+17
Change invoke_match_method to use gdbpy_ref. I neglected to convert this function in my earlier series. 2017-01-10 Tom Tromey <tom@tromey.com> * python/py-xmethods.c (invoke_match_method): Use gdbpy_ref.
2017-01-10Use gdbpy_enter in gdbpy_get_matching_xmethod_workersTom Tromey2-95/+63
Change gdbpy_get_matching_xmethod_workers to use gdbpy_enter and gdbpy_ref. 2017-01-10 Tom Tromey <tom@tromey.com> * python/py-xmethods.c (gdbpy_get_matching_xmethod_workers): use gdbpy_enter, gdbpy_ref.
2017-01-10Use gdbpy_enter in python_interactive_commandTom Tromey2-1/+5
This changes python_interactive_command to use gdbpy_enter. Previously this function was leaving a dangling cleanup -- this is sort of ok in a command function, but IMO it's still better to clean up. 2017-01-10 Tom Tromey <tom@tromey.com> * python/python.c (python_interactive_command): Use gdbpy_enter.
2017-01-10Use gdbpy_enter in gdbpy_before_prompt_hookTom Tromey2-39/+38
Change gdbpy_before_prompt_hook to use gdbpy_enter and gdbpy_ref. This also rearranges the function a tiny bit to make it more clear. 2017-01-10 Tom Tromey <tom@tromey.com> * python/python.c (gdbpy_before_prompt_hook): Use gdbpy_enter, gdbpy_ref.
2017-01-10Use gdbpy_enter in py-prettyprint.cTom Tromey2-30/+20
Change py-prettyprint.c to use gdbpy_enter. 2017-01-10 Tom Tromey <tom@tromey.com> * python/py-prettyprint.c (gdbpy_apply_val_pretty_printer): Use gdbpy_enter, gdbpy_ref, unique_xmalloc_ptr.
2017-01-10Introduce htab_up and use gdbpy_enter in py-framefilter.cTom Tromey3-34/+40
This introduces a new "htab_up" typedef, which is a std::unique_ptr that can call htab_delete. Then it changes some code in py-framefilter.c to use both gdbpy_enter and the new htab_up. 2017-01-10 Tom Tromey <tom@tromey.com> * utils.h (htab_deleter): New struct. (htab_up): New typedef. * python/py-framefilter.c (gdbpy_apply_frame_filter): Use gdbpy_enter, gdbpy_ref, htab_up.
2017-01-10Use gdbpy_enter in py-unwind.cTom Tromey2-39/+38
Change py-unwind.c to use gdbpy_enter. 2017-01-10 Tom Tromey <tom@tromey.com> * python/py-unwind.c (pending_frame_invalidate): Remove. (pyuw_sniffer): Use gdbpy_enter and gdbpy_ref.
2017-01-10Use gdbpy_enter in py-xmethods.cTom Tromey2-8/+7
Change the simple parts of py-xmethods.c to use gdbpy_enter. 2017-01-10 Tom Tromey <tom@tromey.com> * python/py-xmethods.c (gdbpy_free_xmethod_worker_data) (gdbpy_clone_xmethod_worker_data): Use gdbpy_enter.
2017-01-10Use gdbpy_enter in py-type.cTom Tromey2-4/+5
Change py-type.c to use gdbpy_enter. 2017-01-10 Tom Tromey <tom@tromey.com> * python/py-type.c (save_objfile_types): Use gdbpy_enter.
2017-01-10Use gdbpy_enter in python.cTom Tromey2-30/+16
Change the simple parts of python.c to use gdbpy_enter. 2017-01-10 Tom Tromey <tom@tromey.com> * python/python.c (gdbpy_eval_from_control_command) (gdbpy_source_script, gdbpy_run_events) (gdbpy_source_objfile_script, gdbpy_execute_objfile_script) (gdbpy_free_type_printers, gdbpy_finish_initialization): Use gdbpy_enter.
2017-01-10Use gdbpy_enter in py-progspace.cTom Tromey2-3/+5
Change py-progspace.c to use gdbpy_enter. 2017-01-10 Tom Tromey <tom@tromey.com> * python/py-progspace.c (py_free_pspace): Use gdbpy_enter.
2017-01-10Use gdbpy_enter in py-objfile.cTom Tromey2-3/+5
Change py-objfile.c to use gdbpy_enter. 2017-01-10 Tom Tromey <tom@tromey.com> * python/py-objfile.c (py_free_objfile): Use gdbpy_enter.
2017-01-10Use gdbpy_enter in py-inferior.cTom Tromey2-59/+23
Change py-inferior.c to use gdbpy_enter. 2017-01-10 Tom Tromey <tom@tromey.com> * python/py-inferior.c (python_on_normal_stop, python_on_resume) (python_on_inferior_call_pre, python_on_inferior_call_post) (python_on_memory_change, python_on_register_change) (python_inferior_exit, python_new_objfile, add_thread_object) (delete_thread_object, py_free_inferior): Use gdbpy_enter.
2017-01-10Use gdbpy_enter in py-finishbreakpoint.cTom Tromey2-8/+7
Change py-finishbreakpoint.c to use gdbpy_enter. 2017-01-10 Tom Tromey <tom@tromey.com> * python/py-finishbreakpoint.c (bpfinishpy_handle_stop) (bpfinishpy_handle_exit): Use gdbpy_enter.
2017-01-10Use gdbpy_enter in py-cmd.cTom Tromey2-10/+9
Change py-cmd.c to use gdbpy_enter. 2017-01-10 Tom Tromey <tom@tromey.com> * python/py-cmd.c (cmdpy_destroyer) (cmdpy_completer_handle_brkchars, cmdpy_completer): Use gdbpy_enter.
2017-01-10Use gdbpy_enter in py-breakpoint.cTom Tromey2-10/+10
Change py-breakpoint.c to use gdbpy_enter. 2017-01-10 Tom Tromey <tom@tromey.com> * python/py-breakpoint.c (gdbpy_breakpoint_cond_says_stop): Use gdbpy_enter. (gdbpy_breakpoint_has_cond): Likewise.
2017-01-10Introduce gdbpy_enterTom Tromey3-37/+64
This introduces gdbpy_enter, a class that can be used to acquire and release the Python GIL, and also set other Python-related globals used by gdb. ensure_python_env is rewritten in terms of this new class. 2017-01-10 Tom Tromey <tom@tromey.com> * python/python.c (gdbpy_enter): New constructor. (~gdbpy_enter): New destructor. (restore_python_env, ensure_python_env): Rewrite. * python/python-internal.h (gdbpy_enter): New class.
2017-01-10Use gdbpy_ref in gdbpy_lookup_symbolTom Tromey2-10/+12
This changes gdbpy_lookup_symbol to use gdbpy_ref. 2017-01-10 Tom Tromey <tom@tromey.com> * python/py-symbol.c (gdbpy_lookup_symbol): Use gdbpy_ref.
2017-01-10Use gdbpy_ref in py-value.cTom Tromey2-29/+20
This changes a few functions in py-value.c to use gdbpy_ref. 2017-01-10 Tom Tromey <tom@tromey.com> * python/py-value.c (value_has_field, get_field_flag) (get_field_type, valpy_getitem, convert_value_from_python): Use gdbpy_ref.
2017-01-10Use gdbpy_ref in python.cTom Tromey2-18/+16
This changes a couple of functions in python.c to use gdbpy_ref. 2017-01-10 Tom Tromey <tom@tromey.com> * python/python.c (gdbpy_progspaces, gdbpy_objfiles): Use gdbpy_ref.
2017-01-10Use gdbpy_ref in py-prettyprint.cTom Tromey2-62/+41
This changes several functions in py-prettyprint.c to use gdbpy_ref. 2017-01-10 Tom Tromey <tom@tromey.com> * python/py-prettyprint.c (search_pp_list) (find_pretty_printer_from_objfiles) (find_pretty_printer_from_progspace) (find_pretty_printer_from_gdb, find_pretty_printer) (gdbpy_get_display_hint, gdbpy_get_varobj_pretty_printer): Use gdbpy_ref.
2017-01-10Use gdbpy_ref in call_doc_functionTom Tromey2-6/+9
This changes call_doc_function to use gdbpy_ref. 2017-01-10 Tom Tromey <tom@tromey.com> * python/py-param.c (call_doc_function): Use gdbpy_ref.
2017-01-10Use gdbpy_ref in py-linetable.cTom Tromey2-37/+19
This changes some code in py-linetable.c to use gdbpy_ref. 2017-01-10 Tom Tromey <tom@tromey.com> * python/py-linetable.c (build_line_table_tuple_from_pcs) (ltpy_get_all_source_lines): Use gdbpy_ref.
2017-01-10Use gdbpy_ref in py-framefilter.cTom Tromey2-57/+35
This changes some code in py-framefilter.c to use gdbpy_ref. 2017-01-10 Tom Tromey <tom@tromey.com> * python/py-framefilter.c (extract_sym, extract_value) (get_py_iter_from_func, bootstrap_python_frame_filters): Use gdbpy_ref.
2017-01-10Use gdbpy_ref in gdbpy_breakpointsTom Tromey2-13/+9
This changes gdbpy_breakpoints to use gdbpy_ref. 2017-01-10 Tom Tromey <tom@tromey.com> * python/py-breakpoint.c (gdbpy_breakpoints): Use gdbpy_ref.
2017-01-10Use gdbpy_ref in gdbpy_inferiorsTom Tromey2-13/+9
This changes gdbpy_inferiors to use gdbpy_ref. 2017-01-10 Tom Tromey <tom@tromey.com> * python/py-inferior.c (gdbpy_inferiors): Use gdbpy_ref.
2017-01-10Use gdbpy_ref in py-function.cTom Tromey2-16/+16
This changes some code in py-function.c to use gdbpy_ref. 2017-01-10 Tom Tromey <tom@tromey.com> * python/py-function.c (convert_values_to_python, fnpy_init): Use gdbpy_ref.
2017-01-10Use gdbpy_ref in gdbpy_string_to_argvTom Tromey2-8/+9
This chanes gdbpy_string_to_argv to use gdbpy_ref. 2017-01-10 Tom Tromey <tom@tromey.com> * python/py-cmd.c (gdbpy_string_to_argv): Use gdbpy_ref.
2017-01-10Use gdbpy_ref in py-type.cTom Tromey2-117/+83
This changes py-type.c to use gdbpy_ref. This results in simpler logic and the removal of "goto"s. 2017-01-10 Tom Tromey <tom@tromey.com> * python/py-type.c (convert_field, make_fielditem, typy_fields) (typy_range): Use gdbpy_ref.
2017-01-10Change event code to use gdbpy_refTom Tromey12-272/+167
This changes the event code in the Python layer to use gdbpy_ref, simplifying the logic in many places. It also changes evpy_emit_event not to steal a reference to its argument. This is simpler to do now that gdbpy_ref is in use; it's also a reasonable cleanup in its own right. While doing this I realized that evpy_emit_event should not be calling gdbpy_print_stack (all the outermost callers do this if needed), so I removed this as well. 2017-01-10 Tom Tromey <tom@tromey.com> * python/py-threadevent.c (create_thread_event_object): Use gdbpy_ref. * python/py-stopevent.c (create_stop_event_object): Simplify. (emit_stop_event): Use gdbpy_ref. * python/py-signalevent.c (create_signal_event_object): Use gdbpy_ref. * python/py-newobjfileevent.c (create_new_objfile_event_object) (emit_new_objfile_event, create_clear_objfiles_event_object) (emit_clear_objfiles_event): Use gdbpy_ref. * python/py-infevents.c (create_inferior_call_event_object) (create_register_changed_event_object) (create_memory_changed_event_object, emit_inferior_call_event) (emit_memory_changed_event, emit_register_changed_event): Use gdbpy_ref. * python/py-exitedevent.c (create_exited_event_object) (emit_exited_event): Use gdbpy_ref. * python/py-event.h (evpy_emit_event): Remove CPYCHECKER_STEALS_REFERENCE_TO_ARG annotation. * python/py-event.c (evpy_emit_event): Use gdbpy_ref. * python/py-continueevent.c (emit_continue_event): Use gdbpy_ref. * python/py-breakpoint.c (gdbpy_breakpoint_created) (gdbpy_breakpoint_deleted, gdbpy_breakpoint_modified): Use gdbpy_ref. * python/py-bpevent.c (create_breakpoint_event_object): Use gdbpy_ref.
2017-01-10Introduce py-ref.hTom Tromey2-0/+163
This patch introduces class gdbpy_ref, which is a sort of smart pointer that owns a single Python reference to a PyObject. This class acts a bit like unique_ptr, but also a bit like shared_ptr (in that copies do what you might expect); I considered going solely with unique_ptr but it seemed quite strange to have a unique_ptr that actually manages a shared resource. Subsequent patches use this new class to simplify logic in the Python layer. 2017-01-10 Tom Tromey <tom@tromey.com> * python/py-ref.h: New file.
2017-01-10Change return type of ui_out redirect to voidSimon Marchi11-32/+34
All implementations of redirect/do_redirect in the ui_out subsystem always return 0 (success). We can therefore clean it up and make them return void. gdb/ChangeLog: * cli-out.c (cli_ui_out::do_redirect): Change return type to void. * cli-out.h (cli_ui_out::do_redirect): Likewise. * mi/mi-out.c (mi_ui_out::do_redirect): Likewise. * mi/mi-out.h (mi_ui_out::do_redirect): Likewise. * ui-out.c (ui_out::redirect): Likewise. * ui-out.h (ui_out::redirect, ui_out::do_redirect): Likewise. * cli/cli-logging.c (set_logging_redirect): Update call site of ui_out::redirect. (handle_redirections): Likewise. * scm-ports.c (ioscm_with_output_to_port_worker): Likewise. * top.c (execute_command_to_string): Likewise. * utils.c (do_ui_out_redirect_pop): Likewise.
2017-01-10Update help of the "frame" commandSimon Marchi2-3/+5
The help message of the "frame" command states that nothing is printed if the command is executed from the command file or user-defined command. My testing leads me to think that this is not true (at least today). (gdb) bt #0 bar (n=17) at test.c:9 #1 0x00000000004006e0 in foo (v=17) at test.c:13 #2 0x00000000004006f0 in main () at test.c:21 (gdb) frame #0 bar (n=17) at test.c:9 9 baz(n); (gdb) define foo Type commands for definition of "foo". End with a line saying just "end". >frame 1 >end (gdb) foo #1 0x00000000004006e0 in foo (v=17) at test.c:13 13 bar(v); This patch simply removes that bit from the help message. I didn't find anything corresponding to this in the documentation that needs to be fixed. The behavior change corresponding to this documentation change was done in commit b00771232fab861fb31e42dfd5f6643ba1b43cc9. gdb/ChangeLog: * stack.c (_initialize_stack): Update "frame" command help message.
2017-01-09Fix inferior memory reading in GDBServer for arm/aarch32Antoine Tremblay3-4/+12
Before this patch, some functions would read the inferior memory with (*the_target)->read_memory, which returns the raw memory, rather than the shadowed memory. This is wrong since these functions do not expect to read a breakpoint instruction and can lead to invalid behavior. Use of raw memory in get_next_pcs_read_memory_unsigned_integer for example could lead to get_next_pc returning an invalid pc. Here's how this would happen: In non-stop: the user issues: thread 1 step& thread 2 step& thread 3 step& In a similar way as non-stop-fair-events.exp (threads are looping). GDBServer: linux_resume is called GDBServer has pending events, threads are not resumed and single-step breakpoint for thread 1 not installed. linux_wait_1 is called with a pending event on thread 2 at pc A GDBServer handles the event and calls proceed_all_lwps This calls proceed_one_lwp and installs single-step breakpoints on all the threads that need one. Now since thread 1 needs to install a single-step breakpoint and is at pc B (different than thread 2), a step-over is not initiated and get_next_pc is called to figure out the next instruction from pc B. However it may just be that thread 3 as a single step breakpoint at pc B. And thus get_next_pc fails. This situation is tested with non-stop-fair-events.exp. In other words, single-step breakpoints are installed in proceed_one_lwp for each thread. GDBserver proceeds two threads for resume_step, as requested by GDB, and the thread proceeded later may see the single-step breakpoints installed for the thread proceeded just now. Tested on gdbserver-native/-m{thumb,arm} no regressions. gdb/gdbserver/ChangeLog: * linux-aarch32-low.c (arm_breakpoint_kind_from_pc): Use target_read_memory. * linux-arm-low.c (get_next_pcs_read_memory_unsigned_integer): Likewise. (get_next_pcs_syscall_next_pc): Likewise.
2017-01-08[D] Fix crash when debug expression enabled.Iain Buclaw4-6/+51
While casting works as expected with expression debugging turned off, this seems to be an indication that the D language parser function is doing something wrong in the building of the expression. Without changing the grammar, using UNOP_CAST_TYPE is the right thing to do here, as the TypeExp handler has already wrapped the type around a pair of OP_TYPE opcodes. gdb/ChangeLog: * d-exp.y (CastExpression): Emit UNOP_CAST_TYPE. gdb/testsuite/ChangeLog: * gdb.dlang/debug-expr.exp: New file.
2017-01-06Include gdb_proc_service.h in x86-linux-nat.hYao Qi2-0/+6
$ make check-headers CHECK_HEADERS="x86-linux-nat.h" ... ../../binutils-gdb/gdb/x86-linux-nat.h:29:8: error: 'ps_err_e' does not name a type extern ps_err_e x86_linux_get_thread_area (pid_t pid, void *addr, ^ gdb: 2017-01-06 Yao Qi <yao.qi@linaro.org> * x86-linux-nat.h: Include gdb_proc_service.h.
2017-01-06Include serial.h in ser-base.h.Yao Qi2-0/+6
$ make check-headers CHECK_HEADERS="ser-base.h" ... ../../binutils-gdb/gdb/ser-base.h:33:8: error: 'serial_ttystate' does not name a type extern serial_ttystate ser_base_get_tty_state (struct serial *scb); ^ gdb: 2017-01-06 Yao Qi <yao.qi@linaro.org> * ser-base.h: Include serial.h.
2017-01-06Include ppc-tdep.h in ppc-linux-tdep.hYao Qi2-0/+6
$ make check-headers CHECK_HEADERS="ppc-linux-tdep.h" ... ../../binutils-gdb/gdb/ppc-linux-tdep.h:34:24: error: 'PPC_NUM_REGS' was not declared in this scope PPC_ORIG_R3_REGNUM = PPC_NUM_REGS, ^ gdb: 2017-01-06 Yao Qi <yao.qi@linaro.org> * ppc-linux-tdep.h: Include ppc-tdep.h.
2017-01-06Include signal.h in nat/amd64-linux-siginfo.hYao Qi2-0/+6
$ make check-headers CHECK_HEADERS="nat/amd64-linux-siginfo.h" .... ../../binutils-gdb/gdb/nat/amd64-linux-siginfo.h:52:39: error: 'siginfo_t' was not declared in this scope int amd64_linux_siginfo_fixup_common (siginfo_t *native, gdb_byte *inf, ^ gdb: 2017-01-06 Yao Qi <yao.qi@linaro.org> * nat/amd64-linux-siginfo.h: Include signal.h.
2017-01-06Include break-common.h in nat/aarch64-linux-hw-point.hYao Qi2-0/+6
$ make check-headers CHECK_HEADERS="nat/aarch64-linux-hw-point.h" ... ../../binutils-gdb/gdb/nat/aarch64-linux-hw-point.h:169:37: error: use of enum 'target_hw_bp_type' without previous declaration int aarch64_handle_breakpoint (enum target_hw_bp_type type, CORE_ADDR addr, ^ gdb: 2017-01-06 Yao Qi <yao.qi@linaro.org> * nat/aarch64-linux-hw-point.h: Include break-common.h.
2017-01-06Include mi-cmds.h in mi-parse.hYao Qi2-0/+5
$ make check-headers CHECK_HEADERS="mi/mi-parse.h" ... ../../binutils-gdb/gdb/mi/mi-parse.h:77:6: error: use of enum 'print_values' without previous declaration enum print_values mi_parse_print_values (const char *name); ^ gdb: 2017-01-06 Yao Qi <yao.qi@linaro.org> * mi/mi-parse.h: Include mi-cmds.h.
2017-01-06Include target.h in inf-loop.hYao Qi3-1/+7
$ make check-headers CHECK_HEADERS="target.h inf-loop.h" ... ../../binutils-gdb/gdb/inf-loop.h:23:42: error: use of enum 'inferior_event_type' without previous declaration extern void inferior_event_handler (enum inferior_event_type event_type, ^ gdb: 2017-01-06 Yao Qi <yao.qi@linaro.org> * inf-loop.c: Don't include "target.h". * inf-loop.h: Include it here.
2017-01-06Include doublest.h and expression.h in dfp.hYao Qi2-0/+7
$ make check-headers CHECK_HEADERS="dfp.h" ... ../../binutils-gdb/gdb/dfp.h:39:8: error: 'DOUBLEST' does not name a type extern DOUBLEST decimal_to_doublest (const gdb_byte *from, int len, ^ ../../binutils-gdb/gdb/dfp.h:41:33: error: use of enum 'exp_opcode' without previous declaration extern void decimal_binop (enum exp_opcode, ^ gdb: 2017-01-06 Yao Qi <yao.qi@linaro.org> * dfp.h: Include "dboulest.h" and "expression.h".
2017-01-06Include ax.h in ax-gdb.hYao Qi2-0/+6
$ make check-headers CHECK_HEADERS="ax-gdb.h" ... ../../binutils-gdb/gdb/ax-gdb.h:104:8: error: 'agent_expr_up' does not name a type extern agent_expr_up gen_trace_for_expr (CORE_ADDR, struct expression *, ^ gdb: 2017-01-06 Yao Qi <yao.qi@linaro.org> * ax-gdb.h: Include "ax.h"
2017-01-06Update gdb_ptrace.h in HFILES_NO_SRCDIRYao Qi2-1/+6
Commit e379037 (Move gdb_ptrace.h to nat/), so we should update file name in HFILES_NO_SRCDIR too. Otherwise, 'make tags' complains, $ make tags make: *** No rule to make target `gdb_ptrace.h', needed by `TAGS'. Stop. gdb: 2017-01-06 Yao Qi <yao.qi@linaro.org> * Makefile.in (HFILES_NO_SRCDIR): Replace gdb_ptrace.h with nat/gdb_ptrace.h.
2017-01-05Fix ARI warningYao Qi2-4/+10
This patch splits the expression before the && operator instead of after it. gdb: 2017-01-05 Yao Qi <yao.qi@linaro.org> * mips-fbsd-tdep.c (mips_fbsd_sigframe_init): Move && to new line. (mips64_fbsd_sigframe_init): Likewise.
2017-01-04Use correct OSABI constant for FreeBSD/mips binaries.John Baldwin2-1/+6
gdb/ChangeLog: * mips-fbsd-tdep.c (_initialize_mips_fbsd_tdep): Use GDB_OSABI_FREEBSD instead of GDB_OSABI_FREEBSD_ELF.