Commit Graph

271 Commits

Author SHA1 Message Date
David Blaikie 2abc3f8d59 Ensure unreferenced static symbols aren't omitted by clang (either marking them __attribute__((used)) or making them non-static)
gdb/testsuite/
       * gdb.base/catch-syscall.c: Make unreferenced statics non-static to
       ensure clang would not discard them.
       * gdb.base/gdbvars.c: Ditto.
       * gdb.base/memattr.c: Ditto.
       * gdb.base/whatis.c: Ditto.
       * gdb.python/py-prettyprint.c: Ditto.
       * gdb.trace/actions.c: Ditto.
       * gdb.cp/ptype-cv-cp.cc: Mark unused global const int as used to
       ensure clang would not discard it.
2014-04-24 22:33:46 -07:00
David Blaikie 56083b99d7 Fix and XFAIL test due to GCC PR55641, passes with clang
gdb/testsuite/
	* gdb.python/lib-types.exp: Fix test and xfail under gcc due to gcc/55641.
2014-04-24 13:22:10 -07:00
Pedro Alves 51d481464e Fix PR backtrace/15558
This PR is about an assertion failure in GDB that can be triggered by
setting "backtrace limit" to a value that causes GDB to stop unwinding
after an inline frame.  In this case, an assertion in
inline_frame_this_id will trigger:

  /* We need a valid frame ID, so we need to be based on a valid
     frame.  (...).  */
  gdb_assert (frame_id_p (*this_id));

Looking at the function:

 static void
 inline_frame_this_id (struct frame_info *this_frame,
		       void **this_cache,
		       struct frame_id *this_id)
 {
   struct symbol *func;

   /* In order to have a stable frame ID for a given inline function,
      we must get the stack / special addresses from the underlying
      real frame's this_id method.  So we must call get_prev_frame.
      Because we are inlined into some function, there must be previous
      frames, so this is safe - as long as we're careful not to
      create any cycles.  */
   *this_id = get_frame_id (get_prev_frame (this_frame));

we see we're computing the frame id for the inline frame.  If this is
an inline frame, which is a virtual frame constructed based on debug
info, on top of a real stack frame, we should _always_ be able to find
where the frame was inlined into, as that ultimately just means
peeling off the virtual frames on top of the real stack frame.  If
there ultimately was no prev (real) stack frame, then we wouldn't have
been able to construct the inline frame either, by design.  That's
what the assertion catches.

So we have an inline frame, we should _always_ be able to compute its
ID, even if that means bypassing the user backtrace limits to get at
the real stack frame's info.  The problem is that inline_frame_id
calls get_prev_frame, and that takes user backtrace limits into
account.  Code that wants to bypass the limits calls get_prev_frame_1
instead.

Note how get_prev_frame_1 already skips all checks for inline frames:

   /* If we are unwinding from an inline frame, all of the below tests
      were already performed when we unwound from the next non-inline
      frame.  We must skip them, since we can not get THIS_FRAME's ID
      until we have unwound all the way down to the previous non-inline
      frame.  */
   if (get_frame_type (this_frame) == INLINE_FRAME)
     return get_prev_frame_if_no_cycle (this_frame);

And note how the related frame_unwind_caller_id function also uses
get_prev_frame_1:

 struct frame_id
 frame_unwind_caller_id (struct frame_info *next_frame)
 {
   struct frame_info *this_frame;

   /* Use get_prev_frame_1, and not get_prev_frame.  The latter will truncate
      the frame chain, leading to this function unintentionally
      returning a null_frame_id (e.g., when a caller requests the frame
      ID of "main()"s caller.  */

   next_frame = skip_artificial_frames (next_frame);
   this_frame = get_prev_frame_1 (next_frame);
   if (this_frame)
     return get_frame_id (skip_artificial_frames (this_frame));
   else
     return null_frame_id;
 }

get_prev_frame_1 is currently static in frame.c.  As a _1 suffix is
not a good name for an extern function, I've renamed it.

Tested on x86-64 Fedora 17.

gdb/
2014-04-18  Pedro alves  <palves@redhat.com>
	    Tom Tromey  <tromey@redhat.com>

	PR backtrace/15558
	* frame.c (get_prev_frame_1): Rename to ...
	(get_prev_frame_always): ... this, and make extern.  Adjust.
	(skip_artificial_frames): Use get_prev_frame_always.
	(frame_unwind_caller_id, frame_pop, get_prev_frame)
	(get_frame_unwind_stop_reason): Adjust to rename.
	* frame.h (get_prev_frame_always): Declare.
	* inline-frame.c: Include frame.h.
	(inline_frame_this_id): Use get_prev_frame_always.

gdb/testsuite/
2014-04-18  Tom Tromey  <palves@redhat.com>
	    Pedro alves  <tromey@redhat.com>

	PR backtrace/15558
	* gdb.opt/inline-bt.exp: Test backtracing from an inline function
	with a backtrace limit.
	* gdb.python/py-frame-inline.exp: Test running to an inline
	function with a backtrace limit, and printing the newest frame.
	* gdb.python/py-frame-inline.c (main): Call f.
2014-04-18 10:34:09 +01:00
Siva Chandra 7af389b892 [python] Fix gdb.Value.dynamic_type for reference values.
gdb.Value.dynamic_type is supposed to work for reference and pointer
values.  However, the value object in the function 'valpy_get_dynamic_type'
was being dereferenced using 'value_ind' irrespective of the value type
being TYPE_CODE_PTR or TYPE_CODE_REF.  This patch fixes that to use
'coerce_ref' for TYPE_CODE_REF values.

ChangeLog:

	* python/py-value.c (valpy_get_dynamic_type): Use coerce_ref to
	dereference TYPE_CODE_REF values.

	testsuite/
	* gdb.python/py-value.c: Improve test case.
	* gdb.python/py-value.exp: Add new test.
2014-04-07 14:18:44 -07:00
Yao Qi 0d4d0e772a Skip tests on completion and readline when readline lib isn't used
The completion feature and other features on readline depend on the
readline library.  However, readline library is not always used, for
example, running testsuite like

  make check RUNTESTFLAGS="--host_board=local-remote-host"

the input stream is not a tty, and GDB doesn't use readline library
as a result.

This patch is to skip tests on completion and readline if
'show editing' is off, which means readline isn't used.  Note that
some tests in gdb.base/completion.exp test command complete, which
isn't related to readline, so these tests aren't affected by readline
library.  This patch also moves these tests up, run them
unconditionally, and run the rest if readline library is used.

gdb/testsuite:

2014-03-26  Yao Qi  <yao@codesourcery.com>

	* lib/gdb.exp (readline_is_used): New proc.
	* gdb.base/completion.exp: Move tests on command complete up.
	Skip the rest of tests if readline is not used.
	* gdb.ada/complete.exp: Skp the test if readline is not
	used.
	* gdb.base/filesym.exp: Likewise.
	* gdb.base/macscp.exp: Likewise.
	* gdb.base/readline-ask.exp: Likewise.
	* gdb.base/readline.exp: Likewise.
	* gdb.python/py-cmd.exp: Likewise.
	* gdb.trace/tfile.exp: Likewise.
2014-03-26 21:11:08 +08:00
Doug Evans feef67abfa * extension.c (eval_ext_lang_from_control_command): Avoid dereferencing
NULL pointer.

	testsuite/
	* gdb.python/python.exp (python not supported): Verify multi-line
	python command issues an error.
2014-03-22 02:44:39 -04:00
Joel Brobecker 1b58801583 [Python] Make regexp collection printers work with typedefs as well.
Consider the following type for which we would like to provide
a pretty-printer and manage it via RegexpCollectionPrettyPrinter:

        typedef long time_t;

Currently, this does not work because this framework only considers
the type's tag name:

        typename = gdb.types.get_basic_type(val.type).tag
        if not typename:
            return None

This patch extends it to use the type's name if the basic type
does not have a tag name, thus allowing the framework to also
work with typedefs like the above.

gdb/ChangeLog:

        * python/lib/gdb/printing.py (RegexpCollectionPrettyPrinter):
        Use the type's name if its basic type does not have a tag.

gdb/testsuite/ChangeLog:

        * testsuite/gdb.python/py-pp-re-notag.c: New file.
        * testsuite/gdb.python/py-pp-re-notag.ex: New file.
        * testsuite/gdb.python/py-pp-re-notag.p: New file.
2014-02-26 11:04:12 -08:00
Siva Chandra f7bd0f7854 Call overloaded operators to perform operations on gdb.Value objects.
* NEWS: Add entry for the new feature
	* python/py-value.c (valpy_binop): Call value_x_binop for struct
	and class values.

	testsuite/
	* gdb.python/py-value-cc.cc: Improve test case to enable testing
	operations on gdb.Value objects.
	* gdb.python/py-value-cc.exp: Add new test to test operations on
	gdb.Value objects.

	doc/
	* python.texi (Values From Inferior): Add description about the
	new feature.
2014-02-19 15:47:45 -08:00
Andreas Schwab 6c46644734 Fix typo in test name
* gdb.python/py-framefilter.exp: Fix typo.
2014-02-08 10:44:11 +01:00
Doug Evans 6dddc817c1 Extension Language API
* configure.ac (libpython checking): Remove all but python.o from
	CONFIG_OBS.  Remove all but python.c from CONFIG_SRCS.
	* configure: Regenerate.

	* Makefile.in (SFILES): Add extension.c.
	(HFILES_NO_SRCDIR): Add extension.h, extension-priv.h
	(COMMON_OBS): Add extension.o.
	* extension.h: New file.
	* extension-priv.h: New file.
	* extension.c: New file.

	* python/python-internal.h: #include "extension.h".
	(gdbpy_auto_load_enabled): Declare.
	(gdbpy_apply_val_pretty_printer): Declare.
	(gdbpy_apply_frame_filter): Declare.
	(gdbpy_preserve_values): Declare.
	(gdbpy_breakpoint_cond_says_stop): Declare.
	(gdbpy_breakpoint_has_cond): Declare.
	(void source_python_script_for_objfile): Delete.
	* python/python.c: #include "extension-priv.h".
	Delete inclusion of "observer.h".
	(extension_language_python): Moved here and renamed from
	script_language_python in py-auto-load.c.
	Redefined to be of type extension_language_defn.
	(python_extension_script_ops): New global.
	(python_extension_ops): New global.
	(struct python_env): New member previous_active.
	(restore_python_env): Call restore_active_ext_lang.
	(ensure_python_env): Call set_active_ext_lang.
	(gdbpy_clear_quit_flag): Renamed from clear_quit_flag, made static.
	New arg extlang.
	(gdbpy_set_quit_flag): Renamed from set_quit_flag, made static.
	New arg extlang.
	(gdbpy_check_quit_flag): Renamed from check_quit_flag, made static.
	New arg extlang.
	(gdbpy_eval_from_control_command): Renamed from
	eval_python_from_control_command, made static.  New arg extlang.
	(gdbpy_source_script) Renamed from source_python_script, made static.
	New arg extlang.
	(gdbpy_before_prompt_hook): Renamed from before_prompt_hook.  Change
	result to int.  New arg extlang.
	(gdbpy_source_objfile_script): Renamed from
	source_python_script_for_objfile, made static.  New arg extlang.
	(gdbpy_start_type_printers): Renamed from start_type_printers, made
	static.  New args extlang, extlang_printers.  Change result type to
	"void".
	(gdbpy_apply_type_printers): Renamed from apply_type_printers, made
	static.  New arg extlang.  Rename arg printers to extlang_printers
	and change type to ext_lang_type_printers *.
	(gdbpy_free_type_printers): Renamed from free_type_printers, made
	static.  Replace argument arg with extlang, extlang_printers.
	(!HAVE_PYTHON, eval_python_from_control_command): Delete.
	(!HAVE_PYTHON, source_python_script): Delete.
	(!HAVE_PYTHON, gdbpy_should_stop): Delete.
	(!HAVE_PYTHON, gdbpy_breakpoint_has_py_cond): Delete.
	(!HAVE_PYTHON, start_type_printers): Delete.
	(!HAVE_PYTHON, apply_type_printers): Delete.
	(!HAVE_PYTHON, free_type_printers): Delete.
	(_initialize_python): Delete call to observer_attach_before_prompt.
	(finalize_python): Set/restore active extension language.
	(gdbpy_finish_initialization) Renamed from
	finish_python_initialization, made static.  New arg extlang.
	(gdbpy_initialized): New function.
	* python/python.h: #include "extension.h".  Delete #include
	"value.h", "mi/mi-cmds.h".
	(extension_language_python): Declare.
	(GDBPY_AUTO_FILE_NAME): Delete.
	(enum py_bt_status): Moved to extension.h and renamed to
	ext_lang_bt_status.
	(enum frame_filter_flags): Moved to extension.h.
	(enum py_frame_args): Moved to extension.h and renamed to
	ext_lang_frame_args.
	(finish_python_initialization): Delete.
	(eval_python_from_control_command): Delete.
	(source_python_script): Delete.
	(apply_val_pretty_printer): Delete.
	(apply_frame_filter): Delete.
	(preserve_python_values): Delete.
	(gdbpy_script_language_defn): Delete.
	(gdbpy_should_stop, gdbpy_breakpoint_has_py_cond): Delete.
	(start_type_printers, apply_type_printers, free_type_printers): Delete.

	* auto-load.c: #include "extension.h".
	(GDB_AUTO_FILE_NAME): Delete.
	(auto_load_gdb_scripts_enabled): Make public.  New arg extlang.
	(script_language_gdb): Delete, moved to extension.c and renamed to
	extension_language_gdb.
	(source_gdb_script_for_objfile): Delete.
	(auto_load_pspace_info): New member unsupported_script_warning_printed.
	(loaded_script): Change type of language member to
	struct extension_language_defn *.
	(init_loaded_scripts_info): Initialize
	unsupported_script_warning_printed.
	(maybe_add_script): Make static.  Change type of language arg to
	struct extension_language_defn *.
	(clear_section_scripts): Reset unsupported_script_warning_printed.
	(auto_load_objfile_script_1): Rewrite to use extension language API.
	(auto_load_objfile_script): Make public.  Remove support-compiled-in
	and auto-load-enabled checks, moved to auto_load_scripts_for_objfile.
	(source_section_scripts): Rewrite to use extension language API.
	(load_auto_scripts_for_objfile): Rewrite to use
	auto_load_scripts_for_objfile.
	(collect_matching_scripts_data): Change type of language member to
	struct extension_language_defn *.
	(auto_load_info_scripts): Change type of language arg to
	struct extension_language_defn *.
	(unsupported_script_warning_print): New function.
	(script_not_found_warning_print): Make static.
	(_initialize_auto_load): Rewrite construction of scripts-directory
	help.
	* auto-load.h (struct objfile): Add forward decl.
	(struct script_language): Delete.
	(struct auto_load_pspace_info): Add forward decl.
	(struct extension_language_defn): Add forward decl.
	(maybe_add_script): Delete.
	(auto_load_objfile_script): Declare.
	(script_not_found_warning_print): Delete.
	(auto_load_info_scripts): Update prototype.
	(auto_load_gdb_scripts_enabled): Declare.
	* python/py-auto-load.c (gdbpy_auto_load_enabled): Renamed from
	auto_load_python_scripts_enabled and made public.
	(script_language_python): Delete, moved to python.c.
	(gdbpy_script_language_defn): Delete.
	(info_auto_load_python_scripts): Update to use
	extension_language_python.

	* breakpoint.c (condition_command): Replace call to
	gdbpy_breakpoint_has_py_cond with call to get_breakpoint_cond_ext_lang.
	(bpstat_check_breakpoint_conditions): Replace call to gdbpy_should_stop
	with call to breakpoint_ext_lang_cond_says_stop.
	* python/py-breakpoint.c (gdbpy_breakpoint_cond_says_stop): Renamed
	from gdbpy_should_stop.  Change result type to enum scr_bp_stop.
	New arg slang.  Return SCR_BP_STOP_UNSET if py_bp_object is NULL.
	(gdbpy_breakpoint_has_cond): Renamed from gdbpy_breakpoint_has_py_cond.
	New arg slang.
	(local_setattro): Print name of extension language with existing
	stop condition.

	* valprint.c (val_print, value_print): Update to call
	apply_ext_lang_val_pretty_printer.
	* cp-valprint.c (cp_print_value): Update call to
	apply_ext_lang_val_pretty_printer.
	* python/py-prettyprint.c: Remove #ifdef HAVE_PYTHON.
	(gdbpy_apply_val_pretty_printer): Renamed from
	apply_val_pretty_printer.  New arg extlang.
	(!HAVE_PYTHON, apply_val_pretty_printer): Delete.

	* cli/cli-cmds.c (source_script_from_stream): Rewrite to use
	extension language API.
	* cli/cli-script.c (execute_control_command): Update to call
	eval_ext_lang_from_control_command.

	* mi/mi-cmd-stack.c (mi_cmd_stack_list_frames): Update to use
	enum ext_lang_bt_status values.  Update call to
	apply_ext_lang_frame_filter.
	(mi_cmd_stack_list_locals): Ditto.
	(mi_cmd_stack_list_args): Ditto.
	(mi_cmd_stack_list_variables): Ditto.
	* mi/mi-main.c: Delete #include "python/python-internal.h".
	Add #include "extension.h".
	(mi_cmd_list_features): Replace reference to python internal variable
	gdb_python_initialized with call to ext_lang_initialized_p.

	* stack.c (backtrace_command_1): Update to use enum ext_lang_bt_status.
	Update to use enum ext_lang_frame_args.  Update to call
	apply_ext_lang_frame_filter.
	* python/py-framefilter.c (extract_sym): Update to use enum
	ext_lang_bt_status.
	(extract_value, py_print_type, py_print_value): Ditto.
	(py_print_single_arg, enumerate_args, enumerate_locals): Ditto.
	(py_mi_print_variables, py_print_locals, py_print_args): Ditto.
	(py_print_frame): Ditto.
	(gdbpy_apply_frame_filter): Renamed from apply_frame_filter.
	New arg extlang.  Update to use enum ext_lang_bt_status.

	* top.c (gdb_init): Delete #ifdef HAVE_PYTHON call to
	finish_python_initialization.  Replace with call to
	finish_ext_lang_initialization.

	* typeprint.c (do_free_global_table): Update to call
	free_ext_lang_type_printers.
	(create_global_typedef_table): Update to call
	start_ext_lang_type_printers.
	(find_global_typedef): Update to call apply_ext_lang_type_printers.
	* typeprint.h (struct ext_lang_type_printers): Add forward decl.
	(type_print_options): Change type of global_printers from "void *"
	to "struct ext_lang_type_printers *".

	* value.c (preserve_values): Update to call preserve_ext_lang_values.
	* python/py-value.c: Remove #ifdef HAVE_PYTHON.
	(gdbpy_preserve_values): Renamed from preserve_python_values.
	New arg extlang.
	(!HAVE_PYTHON, preserve_python_values): Delete.

	* utils.c (quit_flag): Delete, moved to extension.c.
	(clear_quit_flag, set_quit_flag, check_quit_flag): Delete, moved to
	extension.c.

	* eval.c: Delete #include "python/python.h".
	* main.c: Delete #include "python/python.h".

	* defs.h: Update comment.

	testsuite/

	* gdb.python/py-breakpoint.exp (test_bkpt_eval_funcs): Update expected
	output.

	* gdb.gdb/python-interrupts.exp: New file.
2014-02-05 19:27:58 -08:00
Tom Tromey 0740f8d82d fix erroneous error-handling in frame filter code
This fixes PR python/16487.

The bug here is that the function-name-handling code in py_print_frame
had a small logic error (really a misplaced closing brace).  This
error could lead to a Py_DECREF(NULL), which crashes.

This patch fixes the bug in the obvious way.

Built and regtested on x86-64 Fedora 18.  New test case included.

2014-01-23  Tom Tromey  <tromey@redhat.com>

	PR python/16487:
	* python/py-framefilter.c (py_print_frame): Don't call Py_DECREF
	on a NULL pointer.  Move "goto error" to correct place.

2014-01-23  Tom Tromey  <tromey@redhat.com>

	PR python/16487:
	* gdb.python/py-framefilter.exp: Add test using "Error" filter.
	* gdb.python/py-framefilter.py (ErrorInName, ErrorFilter): New
	classes.
2014-01-23 08:03:51 -07:00
Tom Tromey 21909fa1c6 fix crash in frame filters
apply_frame_filter calls ensure_python_env before computing the
gdbarch to use.  This means that python_gdbarch can be NULL while in
Python code, and if a frame filter depends on this somehow (easy to
do), gdb will crash.

The fix is to compute the gdbarch first.

Built and regtested on x86-64 Fedora 18.
New test case included.

2014-01-23  Tom Tromey  <tromey@redhat.com>

	PR python/16491:
	* python/py-framefilter.c (apply_frame_filter): Call
	ensure_python_env after computing gdbarch.

2014-01-23  Tom Tromey  <tromey@redhat.com>

	PR python/16491:
	* gdb.python/py-framefilter.py (Reverse_Function.function): Read a
	string from an inferior frame.
	* gdb.python/py-framefilter-mi.exp: Update.
2014-01-23 08:03:50 -07:00
Siva Chandra b5b08fb4ff Use bitpos and type to lookup a gdb.Field object when its name is 'None'.
PR python/15464
	PR python/16113
	* valops.c (value_struct_elt_bitpos): New function
	* py-type.c (convert_field): Set 'name' attribute of a gdb.Field
	object to 'None' if the field name is an empty string ("").
	* python/py-value.c (valpy_getitem): Use 'bitpos' and 'type'
	attribute to look for a field when 'name' is 'None'.
	(get_field_type): New function

	testsuite/
	* gdb.python/py-type.c: Enhance test case.
	* gdb.python/py-value-cc.cc: Likewise
	* gdb.python/py-type.exp: Add new tests.
	* gdb.python/py-value-cc.exp: Likewise
2014-01-13 17:35:56 -08:00
Joel Brobecker 4e23fced81 Remove path from gdb.python/py-pp-integral.exp "source" test.
gdb/testsuite/ChangeLog:

	* gdb.python/py-pp-integral.exp: Remove path from "source" test.
2014-01-10 07:57:09 +04:00
Joel Brobecker c0d4881122 [python] Add gdb.Type.name attribute.
Consider the following declarations:

    typedef long our_time_t;
    our_time_t current_time = 1384395743;

The purpose of this patch is to allow the use of a pretty-printer
for variables of type our_time_t.  Normally, pretty-printing sniffers
use the tag name in order to determine which, if any, pretty-printer
should be used. But in the case above, the tag name is not set, since
it does not apply to integral types.

This patch extends the gdb.Type list of attributes to also include
the name of the type, thus allowing the sniffer to match against
that name. With that change, I was able to write a pretty-printer
which displays our variable as follow:

    (gdb) print current_time
    $1 = Thu Nov 14 02:22:23 2013 (1384395743)

gdb/ChangeLog:

        * python/py-type.c (typy_get_name): New function.
        (type_object_getset): Add entry for attribute "name".
        * NEWS: Add entry mentioning this new attribute.

gdb/doc/ChangeLog:

        * gdb.texinfo (Types In Python): Document new attribute Types.name.

gdb/testsuite:

        * gdb.python/py-pp-integral.c: New file.
        * gdb.python/py-pp-integral.py: New file.
        * gdb.python/py-pp-integral.exp: New file.

Tested on x86_64-linux.
2014-01-07 07:11:17 +04:00
Joel Brobecker ecd75fc8ee Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
Siva Chandra a16b0e220d 2013-12-12 Siva Chandra Reddy <sivachandra@google.com>
PR python/16113
	* NEWS (Python Scripting): Add entry for the new feature and the
	new attribute of gdb.Field objects.
	* python/py-type.c (gdbpy_is_field): New function
	(convert_field): Add 'parent_type' attribute to gdb.Field
	objects.
	* python/py-value.c (valpy_getitem): Allow subscript value to be
	a gdb.Field object.
	(value_has_field): New function
	(get_field_flag): New function
	* python/python-internal.h (gdbpy_is_field): Add declaration.

	testsuite/
	* gdb.python/py-value-cc.cc: Improve test case.
	* gdb.python/py-value-cc.exp: Add new tests to test usage of
	gdb.Field objects as subscripts on gdb.Value objects.

	doc/
	* gdb.texinfo (Values From Inferior): Add a note about using
	gdb.Field objects as subscripts on gdb.Value objects.
	(Types In Python): Add description about the new attribute
	"parent_type" of gdb.Field objects.
2013-12-12 15:21:53 -08:00
Doug Evans 0987cf3512 PR 16286
* c-lang.c (c_get_string): Ignore the declared size of the object
	if a specific length is requested.

	testsuite/
	* gdb.python/py-value.c: #include stdlib.h, string.h.
	(str): New struct.
	(main): New local xstr.
	* gdb.python/py-value.exp (test_value_in_inferior): Add test to
	fetch a value as a string with a length beyond the declared length
	of the array.
2013-12-10 16:20:08 -08:00
Doug Evans 35720eaabd Test name tweaks for py-value.exp.
* gdb.python/py-value.exp (test_lazy_strings): Tweak test names.
	(test_subscript_regression): Ditto.
	(top level): Run test_subscript_regression for c++ with "c++" prefix.
2013-11-23 16:03:47 -08:00
Doug Evans 3cd14e4575 * gdb.python/py-type.exp (test_enums): Fix typo. 2013-11-23 15:54:05 -08:00
Doug Evans 985c818c2d * gdb.python/py-symbol.exp: Add some comments. Make all test names unique. 2013-11-23 15:45:43 -08:00
Doug Evans f873dd7ade * gdb.python/py-symbol.exp: Fix whitespace. 2013-11-23 15:20:42 -08:00
Doug Evans 38a502a410 * gdb.python/python.exp: Don't call skip_python_tests, we still want
to test some things in the case where python is not configured in.
2013-11-23 15:08:28 -08:00
Yao Qi 0a1e61210c Check has_more in mi_create_dynamic_varobj
Hi,
I find "has_more" is not checked when a dynamic varobj is created in
proc mi_create_dynamic_varobj.  This patch adds the check to
"has_more".

gdb/testsuite:

2013-11-22  Yao Qi  <yao@codesourcery.com>

	* lib/mi-support.exp (mi_create_dynamic_varobj): Update
	comment and add one more argument "has_more".
	* gdb.python/py-mi.exp: Callers update.
2013-11-22 08:34:42 +08:00
Yao Qi 0061ea2440 Use mi_create_floating_varobj
In gdb.python/py-mi.exp, two varobjs container and nscont are created
when pretty-printing is still not enabled, so they are not dynamic
varobj, IIUC.  In this patch, we use mi_create_floating_varobj instead
of mi_create_dynamic_varobj.

gdb/testsuite:

2013-11-22  Yao Qi  <yao@codesourcery.com>

	* gdb.python/py-mi.exp: Use mi_create_floating_varobj instead
	of mi_create_dynamic_varobj.
2013-11-22 08:34:22 +08:00
Walfred Tedeschi 09748966c1 Add pretty-printer for MPX bnd registers.
Boundary length is simpler implemented by means of a pretty
printer. This simplifies users life when examining a bound register.

Changelog:
2013-11-20  Walfred Tedeschi  <walfred.tedeschi@intel.com>

	* python/lib/gdb/command/bound_register.py: New file.
	* gdb/data-directory/Makefile.in: copy bond_register.py to the right path to
	be initialized at gdb startup.
testsuite/
	* gdb.python/py-pp-maint.exp: Consider new pretty-print added for registers.

Change-Id: Id4f39845e5ece56c370a1fd4343648909f08b731
Signed-off-by: Walfred Tedeschi <walfred.tedeschi@intel.com>

Conflicts:

	gdb/ChangeLog
2013-11-20 14:42:53 +01:00
Doug Evans 9abb1bd666 * gdb.python/py-breakpoint.exp: Make tests have unique names. 2013-11-14 23:07:55 -08:00
Doug Evans 8abea1a1d2 * gdb.python/py-breakpoint.exp: Reformat for 80 columns. 2013-11-14 22:36:19 -08:00
Doug Evans 330a7fce4a * gdb.python/py-breakpoint.exp: Split up into several functions,
each with their own test prefix.
2013-11-14 22:23:16 -08:00
Phil Muldoon bc79de95db 2013-11-11 Phil Muldoon <pmuldoon@redhat.com>
PR python/15629
	* NEWS: Add linetable feature.
	* Makefile.in (SUBDIR_PYTHON_OBS): Add py-linetable entries.
	* python/py-linetable.c: New file.
	* python/py-symtab.c (stpy_get_linetable): New function.
	* python/python-internal.h (symtab_to_linetable_object): Declare.
	(gdbpy_initialize_linetable): Ditto.
	* python/python.c (_initialize_python): Call
	gdbpy_initialize_linetable.

2013-11-11  Phil Muldoon  <pmuldoon@redhat.com>

 	* gdb.python/py-linetable.S: New file.
	* gdb.python/py-linetable.c: New file.
 	* gdb.python/py-linetable.exp: New file.

2013-11-11  Phil Muldoon  <pmuldoon@redhat.com>

	* gdb.texinfo (Symbol Tables In Python): Add linetable method entry.
	(Line Tables In Python): New node.
2013-11-11 19:49:45 +00:00
Phil Muldoon 92e32e33f1 2013-11-07 Phil Muldoon <pmuldoon@redhat.com>
PR python/15747
        * python/py-cmd.c: Add COMPLETE_EXPRESSION constant.

2013-11-07  Phil Muldoon  <pmuldoon@redhat.com>

        * gdb.python/py-cmd.exp: Add COMPLETE_EXPRESSION tests.
        * gdb.python/py-cmd.c: New File.

2013-11-07  Phil Muldoon  <pmuldoon@redhat.com>

        * gdb.texinfo (Commands In Python): Document COMPLETE_EXPRESSION
        constant.
2013-11-07 12:32:31 +00:00
Phil Muldoon f76c27b5bd 2013-11-07 Phil Muldoon <pmuldoon@redhat.com>
* python/py-breakpoint.c (bppy_get_temporary): New function.
	(bppy_init): New keyword: temporary. Parse it and set breakpoint
	to temporary if True.

2013-11-07  Phil Muldoon  <pmuldoon@redhat.com>

	* gdb.python/py-breakpoint.exp: Add temporary breakpoint tests.

2013-11-07  Phil Muldoon  <pmuldoon@redhat.com>

	* gdb.texinfo (Breakpoints In Python): Document temporary
	option in breakpoint constructor, and add documentation to the
	temporary attribute.
2013-11-07 12:04:45 +00:00
Doug Evans 01e48c0ce1 * gdb.python/py-arch.exp: Tweak test name for bad memory access test. 2013-11-06 22:39:27 -08:00
Pedro Alves 578d3588ee Stop using errno values around target_xfer interfaces and memory errors.
target_read_memory & friends build on top of target_read (thus on top
of the target_xfer machinery), but turn all errors to EIO, an errno
value.  I think we'd better convert all these to return a
target_xfer_error too, like target_xfer_partial in a previous patch.
The patch starts by doing that.

(The patch does not add a enum target_xfer_error value for '0'/no
error, and likewise does not change the return type of several of
these functions to enum target_xfer_error, because different functions
return '0' with different semantics.)

I audited the tree for memory_error calls, EIO checks, places where
GDB hardcodes 'errno = EIO', and also for strerror calls.  What I
found is that nowadays there's really no need to handle random errno
values, other than the EIOs gdb itself hardcodes.  No doubt errno
values would appear in common code back in the day when
target_xfer_memory was the main interface to access memory, but
nowadays, any errno value that deprecated interface could return is
just absorved by default_xfer_partial:

      else if (xfered == 0 && errno == 0)
	/* "deprecated_xfer_memory" uses 0, cross checked against
           ERRNO as one indication of an error.  */
	return 0;
      else
	return -1;

There are two places in the code that check for EIO and print "out of
bounds", and defer to strerror for other errors.  That's
c-lang.c:c_get_string, and valprint.c.:val_print_string.  AFAICT, the
strerror branch can never be reached nowadays, as the only error
possible to get at those points is EIO, given that it's GDB itself
that set that errno value (in target_read_memory, etc.).

breakpoint.c:insert_bp_location always prints the error val as if an
errno, returned by target_insert_breakpoint, with strerr.  Now the
error here is either always EIO for mem-break.c targets (again
hardcoded by the target_read_memory/target_write_memory functions), so
this always prints "Input/output error" or similar (depending on
host), or, for remote targets (and probably others), this gem:

  Error accessing memory address 0x80200400: Unknown error -1.

This patch makes these 3 places print the exact same error
memory_error prints.  This changes output, but I think this is better,
for making memory error output consistent with other commands, and, it
means we have a central place to tweak for memory errors.

E.g., this changes:

 Cannot insert breakpoint 1.
 Error accessing memory address 0x5fc660: Input/output error.

to:

 Cannot insert breakpoint 1.
 Cannot access memory at address 0x5fc660

Which I find pretty much acceptable.

Surprisingly, only py-prettyprint.exp had a regression, for needing an
adjustment.  I also grepped the testsuite for the old errors, and
found no other hits.

Now that errno values aren't used anywhere in any of these memory
access related routines, I made memory_error itself take a
target_xfer_error instead of an errno.  The new
target_xfer_memory_error function added recently is no longer
necessary, and is thus removed.

Tested on x86_64 Fedora 17, native and gdbserver.

gdb/
2013-10-09  Pedro Alves  <palves@redhat.com>

	* breakpoint.c (insert_bp_location): Use memory_error_message to
	build the memory error string.
	* c-lang.c: Include "gdbcore.h".
	(c_get_string): Use memory_error to throw error.
	(target_xfer_memory_error): Delete.
	(memory_error_message): New, factored out from
	target_xfer_memory_error.
	(memory_error): Change parameter type to target_xfer_error.
	Rewrite.
	(read_memory): Use memory_error instead of
	target_xfer_memory_error.
	* gdbcore.h: Include "target.h".
	(memory_error): Change parameter type to target_xfer_error.
	(memory_error_message): Declare function.
	* target.c (target_read_memory, target_read_stack)
	(target_write_memory, target_write_raw_memory): Return
	TARGET_XFER_E_IO on error.  Adjust comments.
	(get_target_memory): Pass TARGET_XFER_E_IO to memory_error,
	instead of EIO.
	* target.h (target_read, target_insert_breakpoint)
	(target_remove_breakpoint): Adjust comments.
	* valprint.c (partial_memory_read): Rename parameter, and adjust
	comment.
	(val_print_string): Use memory_error_message to build the memory
	error string.

gdb/testsuite/
2013-10-09  Pedro Alves  <palves@redhat.com>

	* gdb.python/py-prettyprint.exp (run_lang_tests): Adjust expected
	output.
2013-10-09 17:00:00 +00:00
Doug Evans a49bed3ad9 * gdb.python/python.exp: Remove redundant print-stack tests.
Make all print-stack test names unique.  Fix spelling of print-stack.
2013-10-01 20:36:01 +00:00
Doug Evans dc59cba6fc * gdb.python/py-events.py (new_objfile_handler): Remove accidentally
added code to print event.inferior.
2013-09-12 22:39:26 +00:00
Doug Evans 314bb8c368 * gdb.python/py-events.py (exit_handler): Verify we get the expected
event.
	(continue_handler, new_objfile_handler): Ditto.
	(test_events): Rename command to "test-events".
	(test_newobj_events): Rename command to "test-objfile-events".
	* gdb.python/py-events.exp: Update.
	* gdb.python/py-evsignal.exp: Update.
	* gdb.python/py-evthreads.exp: Update.
2013-09-04 23:49:21 +00:00
Phil Muldoon 96d9056e29 2013-08-30 Phil Muldoon <pmuldoon@redhat.com>
PR python/15461

	* python/py-arch.c (ARCHPY_REQUIRE_VALID): New macro.
	(archpy_name): Check for valid architecture.
	(archpy_disassemble): Ditto.


2013-08-30  Phil Muldoon  <pmuldoon@redhat.com>

	* gdb.python/py-arch.exp: Tests for invalid architecture.
2013-08-30 10:12:19 +00:00
Phil Muldoon 5b791bb530 2013-08-29 Phil Muldoon <pmuldoon@redhat.com>
* gdb.python/py-arch.exp: Load gdb-python.exp.
2013-08-29 10:20:03 +00:00
Phil Muldoon 8f28f5226e 2013-08-29 Phil Muldoon <pmuldoon@redhat.com>
* python/py-framefilter.c (py_print_frame): Remove usage of
	PyString_AsString.  Use python_string_to_host_string instead.
	Refactor function to work with a string as a new allocation
	instead of a pointer.
	(py_print_frame): Ditto.
	* python/lib/gdb/frames.py (return_list): Cain iterators together
	instead of adding them as a list.
	(_sort_list): Call return_list, and remove duplicate code.
	(execute_frame_filters): Convert iterator to a list with list().
	* python/lib/gdb/command/frame_filters.py
	(SetFrameFilterPriority._set_filter_priority): Convert priority
	attribute to an integer.
	* python/lib/gdb/FrameIterator.py (FrameIterator.next): Define
	wrapper function __next__.
	* python/lib/gdb/FrameDecorator.py: If basestring not defined,
	define as "str".

2013-08-29  Phil Muldoon  <pmuldoon@redhat.com>

	* gdb.python/py-framefilter.py (FrameFilter.filter): Check
	itertools for imap attribute.  Otherwise use map().
	(ElidingIterator): Define wrapper function __next__.
	* gdb.python/py-framefilter-mi.exp: Do not use execfile,
	use exec (open (read ())) instead.
	* gdb.python/py-framefilter.exp: Ditto.
	* gdb.python/py-arch.exp: Update print based test to Python 3.x
	compliance.
	* gdb.python/py-frame.exp: Ditto.
	* gdb.python/py-type.exp: Ditto.
2013-08-29 10:06:18 +00:00
Tom Tromey 8448e842cd fix gdb.python to be parallel-safe
This fixes gdb.python to be parallel-safe, mostly by changing it to
use gdb_remote_download.

Tested on x86-64 Fedora 18.

	* gdb.python/py-error.exp: Use gdb_remote_download.
	* gdb.python/py-mi.exp: Use gdb_remote_download.
	* gdb.python/py-objfile-script.exp: Use standard_output_file.
	* gdb.python/py-prettyprint.exp: Use gdb_remote_download.
	(run_lang_tests): Likewise.
	* gdb.python/py-section-script.c: Use SCRIPT_FILE rather than
	filename.
	* gdb.python/py-section-script.exp: Set SCRIPT_FILE when
	compiling.  Use gdb_remote_download.  Update some tests.
	* gdb.python/py-strfns.exp (test_strfns_core_file): Use
	standard_output_file.
	* gdb.python/py-typeprint.exp: Use gdb_remote_download.
	* gdb.python/py-frame-args.exp: Use gdb_remote_download.
	* gdb.python/py-framefilter-mi.exp: Use gdb_remote_download.
	* gdb.python/py-framefilter.exp: Use gdb_remote_download,
	standard_output_file.
2013-08-22 13:51:08 +00:00
Doug Evans ac52f9a22a * gdb.python/py-value-cc.cc: Renamed from py-value.cc.
* gdb.python/py-value-cc.exp: Update.
	* gdb.python/py-value.exp: Use different names for .o files for
	C and C++.  Only perform C++ tests if !skip_cplus_tests.
2013-08-07 23:51:45 +00:00
Yao Qi 67d21849b0 gdb/testsuite/
* gdb.python/py-sync-interp.c: New.
	* gdb.python/py-sync-interp.exp: New.
2013-08-01 06:38:28 +00:00
Doug Evans e704570352 * NEWS: Mention "set print raw frame-arguments".
* gdbcmd.h (setprintrawlist, showprintrawlist): Declare.
	* stack.c (print_raw_frame_arguments): New static global.
	(print_frame_arg): Set opts.raw from print_raw_frame_arguments.
	(_initialize_stack): New command "set/show print raw frame-arguments".
	* valprint.c (setprintrawlist, showprintrawlist): New globals.
	(set_print_raw, show_print_raw): New functions.
	(_initialize_valprint): New prefix command "set/show print raw".
	* valprint.h (value_print_options): Improve comments.

	doc/
	* gdb.texinfo (Print Settings): Document "print raw frame-arguments".

	testsuite/
	* gdb.python/py-frame-args.c: New file.
	* gdb.python/py-frame-args.py: New file.
	* gdb.python/py-frame-args.exp New file.
2013-07-17 20:35:11 +00:00
Andrew Burgess 1953058fe9 Add $gdb_prompt to test regexp.
http://sourceware.org/ml/gdb-patches/2013-07/msg00173.html

	* gdb.python/py-explore.exp: Add $gdb_prompt to test regexp.
2013-07-08 11:16:01 +00:00
Pedro Alves 4ec7020176 Remove superfluous semicolons from testsuite throughout.
A few months ago semicolons after "return" were removed throughout the
testsuite.  However, as I pointed out in review, they're unnecessary
not just after "return", but pretty much after any tcl command.  ';'
is the command separator, and you only need it if there's another
command on the same line afterwards.

This patch was written by running:

 $ find . -name "*.exp" | xargs grep -l ";\s*$" | xargs sed -i 's/\([^#][^\s*;]*\)\s*;\s*$/\1/'

and then undoing changes to comments, and lib/future.exp.

Tested on x86_64 Fedora 17.

gdb/testsuite/
2013-06-07  Pedro Alves  <palves@redhat.com>

	* boards/native-extended-gdbserver.exp: Remove semicolon.
	* config/arm-ice.exp: Likewise.
	* config/bfin.exp: Likewise.
	* config/cygmon.exp: Likewise.
	* config/h8300.exp: Likewise.
	* config/monitor.exp: Likewise.
	* config/sid.exp: Likewise.
	* config/sim.exp: Likewise.
	* config/slite.exp: Likewise.
	* config/vx.exp: Likewise.
	* gdb.arch/i386-bp_permanent.exp: Likewise.
	* gdb.asm/asm-source.exp: Likewise.
	* gdb.base/args.exp: Likewise.
	* gdb.base/attach-pie-misread.exp: Likewise.
	* gdb.base/auxv.exp: Likewise.
	* gdb.base/bigcore.exp: Likewise.
	* gdb.base/bitfields2.exp: Likewise.
	* gdb.base/bitfields.exp: Likewise.
	* gdb.base/break.exp: Likewise.
	* gdb.base/break-interp.exp: Likewise.
	* gdb.base/callfuncs.exp: Likewise.
	* gdb.base/call-sc.exp: Likewise.
	* gdb.base/commands.exp: Likewise.
	* gdb.base/corefile.exp: Likewise.
	* gdb.base/dbx.exp: Likewise.
	* gdb.base/ending-run.exp: Likewise.
	* gdb.base/exprs.exp: Likewise.
	* gdb.base/funcargs.exp: Likewise.
	* gdb.base/hbreak2.exp: Likewise.
	* gdb.base/huge.exp: Likewise.
	* gdb.base/list.exp: Likewise.
	* gdb.base/memattr.exp: Likewise.
	* gdb.base/overlays.exp: Likewise.
	* gdb.base/printcmds.exp: Likewise.
	* gdb.base/recurse.exp: Likewise.
	* gdb.base/remotetimeout.exp: Likewise.
	* gdb.base/reread.exp: Likewise.
	* gdb.base/savedregs.exp: Likewise.
	* gdb.base/scope.exp: Likewise.
	* gdb.base/sepdebug.exp: Likewise.
	* gdb.base/setshow.exp: Likewise.
	* gdb.base/setvar.exp: Likewise.
	* gdb.base/sigaltstack.exp: Likewise.
	* gdb.base/siginfo-addr.exp: Likewise.
	* gdb.base/siginfo.exp: Likewise.
	* gdb.base/siginfo-obj.exp: Likewise.
	* gdb.base/sigrepeat.exp: Likewise.
	* gdb.base/sigstep.exp: Likewise.
	* gdb.base/structs.exp: Likewise.
	* gdb.base/testenv.exp: Likewise.
	* gdb.base/twice.exp: Likewise.
	* gdb.base/valgrind-db-attach.exp: Likewise.
	* gdb.base/valgrind-infcall.exp: Likewise.
	* gdb.base/varargs.exp: Likewise.
	* gdb.base/watchpoint.exp: Likewise.
	* gdb.cp/gdb1355.exp: Likewise.
	* gdb.cp/misc.exp: Likewise.
	* gdb.disasm/hppa.exp: Likewise.
	* gdb.disasm/t01_mov.exp: Likewise.
	* gdb.disasm/t02_mova.exp: Likewise.
	* gdb.disasm/t03_add.exp: Likewise.
	* gdb.disasm/t04_sub.exp: Likewise.
	* gdb.disasm/t05_cmp.exp: Likewise.
	* gdb.disasm/t06_ari2.exp: Likewise.
	* gdb.disasm/t07_ari3.exp: Likewise.
	* gdb.disasm/t08_or.exp: Likewise.
	* gdb.disasm/t09_xor.exp: Likewise.
	* gdb.disasm/t10_and.exp: Likewise.
	* gdb.disasm/t11_logs.exp: Likewise.
	* gdb.disasm/t12_bit.exp: Likewise.
	* gdb.disasm/t13_otr.exp: Likewise.
	* gdb.gdb/selftest.exp: Likewise.
	* gdb.hp/gdb.base-hp/callfwmall.exp: Likewise.
	* gdb.mi/mi-reverse.exp: Likewise.
	* gdb.pascal/floats.exp: Likewise.
	* gdb.python/py-inferior.exp: Likewise.
	* gdb.threads/attach-into-signal.exp: Likewise.
	* gdb.threads/pthreads.exp: Likewise.
	* gdb.threads/thread_events.exp: Likewise.
	* gdb.threads/watchthreads.exp: Likewise.
	* gdb.trace/actions-changed.exp: Likewise.
	* gdb.trace/actions.exp: Likewise.
	* gdb.trace/ax.exp: Likewise.
	* gdb.trace/backtrace.exp: Likewise.
	* gdb.trace/change-loc.exp: Likewise.
	* gdb.trace/deltrace.exp: Likewise.
	* gdb.trace/disconnected-tracing.exp: Likewise.
	* gdb.trace/ftrace.exp: Likewise.
	* gdb.trace/infotrace.exp: Likewise.
	* gdb.trace/passc-dyn.exp: Likewise.
	* gdb.trace/passcount.exp: Likewise.
	* gdb.trace/pending.exp: Likewise.
	* gdb.trace/qtro.exp: Likewise.
	* gdb.trace/range-stepping.exp: Likewise.
	* gdb.trace/report.exp: Likewise.
	* gdb.trace/save-trace.exp: Likewise.
	* gdb.trace/status-stop.exp: Likewise.
	* gdb.trace/strace.exp: Likewise.
	* gdb.trace/tfile.exp: Likewise.
	* gdb.trace/tfind.exp: Likewise.
	* gdb.trace/trace-break.exp: Likewise.
	* gdb.trace/tracecmd.exp: Likewise.
	* gdb.trace/trace-mt.exp: Likewise.
	* gdb.trace/tspeed.exp: Likewise.
	* gdb.trace/tsv.exp: Likewise.
	* gdb.trace/while-stepping.exp: Likewise.
	* lib/gdb.exp: Likewise.
	* lib/gdbserver-support.exp: Likewise.
	* lib/java.exp: Likewise.
	* lib/mi-support.exp: Likewise.
	* lib/pascal.exp: Likewise.
	* lib/prompt.exp: Likewise.
	* lib/trace-support.exp: Likewise.
2013-06-07 17:31:09 +00:00
Pedro Alves 47d4871188 Fix formating in copyright headers.
File list found with:
$ grep "along with this program" * -A 1 -rn \
	| grep "*/" \
	| grep -v "along with this program" \
	| sed 's,-[0-9]\+-.*,,g'

Tested on x86_64 Fedora 17.

gdb/
2013-06-07  Pedro Alves  <palves@redhat.com>

	* darwin-nat.c: Fix formating in copyright header.
	* darwin-nat.h: Likewise.
	* gnu-nat.c: Likewise.
	* machoread.c: Likewise.

gdb/testsuite/
2013-06-07  Pedro Alves  <palves@redhat.com>

	* gdb.ada/info_types.c: Fix formating in copyright header.
	* gdb.base/break-on-linker-gcd-function.cc: Likewise.
	* gdb.base/float.c: Likewise.
	* gdb.base/inferior-died.c: Likewise.
	* gdb.base/interp.c: Likewise.
	* gdb.base/jit-main.c: Likewise.
	* gdb.base/jit-solib.c: Likewise.
	* gdb.base/long_long.c: Likewise.
	* gdb.base/longjmp.c: Likewise.
	* gdb.base/nextoverexit.c: Likewise.
	* gdb.base/pr11022.c: Likewise.
	* gdb.base/prelink-lib.c: Likewise.
	* gdb.base/prelink.c: Likewise.
	* gdb.base/prologue.c: Likewise.
	* gdb.base/restore.c: Likewise.
	* gdb.base/sigchld.c: Likewise.
	* gdb.base/solib-search-lib1.c: Likewise.
	* gdb.base/solib-search-lib2.c: Likewise.
	* gdb.base/solib-search.c: Likewise.
	* gdb.base/solib-search.h: Likewise.
	* gdb.base/whatis.c: Likewise.
	* gdb.cp/abstract-origin.cc: Likewise.
	* gdb.cp/anon-struct.cc: Likewise.
	* gdb.cp/baseenum.cc: Likewise.
	* gdb.cp/bs15503.cc: Likewise.
	* gdb.cp/call-c-1.c: Likewise.
	* gdb.cp/call-c.cc: Likewise.
	* gdb.cp/class2.cc: Likewise.
	* gdb.cp/classes.cc: Likewise.
	* gdb.cp/cttiadd.cc: Likewise.
	* gdb.cp/cttiadd1.cc: Likewise.
	* gdb.cp/cttiadd2.cc: Likewise.
	* gdb.cp/cttiadd3.cc: Likewise.
	* gdb.cp/derivation.cc: Likewise.
	* gdb.cp/derivation2.cc: Likewise.
	* gdb.cp/dispcxx.cc: Likewise.
	* gdb.cp/exception.cc: Likewise.
	* gdb.cp/gdb2384-base.cc: Likewise.
	* gdb.cp/gdb2384-base.h: Likewise.
	* gdb.cp/gdb2384.cc: Likewise.
	* gdb.cp/gdb2495.cc: Likewise.
	* gdb.cp/mb-inline.h: Likewise.
	* gdb.cp/mb-inline1.cc: Likewise.
	* gdb.cp/mb-inline2.cc: Likewise.
	* gdb.cp/member-name.cc: Likewise.
	* gdb.cp/member-ptr.cc: Likewise.
	* gdb.cp/misc.cc: Likewise.
	* gdb.cp/namespace1.cc: Likewise.
	* gdb.cp/nextoverthrow.cc: Likewise.
	* gdb.cp/pr-574.cc: Likewise.
	* gdb.cp/pr9631.cc: Likewise.
	* gdb.cp/printmethod.cc: Likewise.
	* gdb.cp/psmang1.cc: Likewise.
	* gdb.cp/psmang2.cc: Likewise.
	* gdb.cp/psymtab-parameter.cc: Likewise.
	* gdb.cp/ptype-flags.cc: Likewise.
	* gdb.cp/ref-params.cc: Likewise.
	* gdb.cp/ref-types.cc: Likewise.
	* gdb.cp/smartp.cc: Likewise.
	* gdb.cp/try_catch.cc: Likewise.
	* gdb.cp/userdef.cc: Likewise.
	* gdb.cp/using-crash.cc: Likewise.
	* gdb.cp/virtfunc.cc: Likewise.
	* gdb.cp/virtfunc2.cc: Likewise.
	* gdb.dwarf2/callframecfa.S: Likewise.
	* gdb.dwarf2/dw2-ranges.c: Likewise.
	* gdb.dwarf2/dw2-ranges2.c: Likewise.
	* gdb.dwarf2/dw2-ranges3.c: Likewise.
	* gdb.dwarf2/dw2-restore.S: Likewise.
	* gdb.dwarf2/pieces.S: Likewise.
	* gdb.dwarf2/valop.S: Likewise.
	* gdb.java/jnpe.java: Likewise.
	* gdb.mi/mi-stepn.c: Likewise.
	* gdb.mi/mi-var-cp.cc: Likewise.
	* gdb.mi/mi-var-rtti.cc: Likewise.
	* gdb.mi/ns-stale-regcache.c: Likewise.
	* gdb.mi/pr11022.c: Likewise.
	* gdb.mi/solib-lib.c: Likewise.
	* gdb.mi/solib-main.c: Likewise.
	* gdb.python/py-arch.c: Likewise.
	* gdb.python/py-block.c: Likewise.
	* gdb.python/py-breakpoint.c: Likewise.
	* gdb.python/py-events.c: Likewise.
	* gdb.python/py-evthreads.c: Likewise.
	* gdb.python/py-explore.c: Likewise.
	* gdb.python/py-explore.cc: Likewise.
	* gdb.python/py-finish-breakpoint.c: Likewise.
	* gdb.python/py-finish-breakpoint2.cc: Likewise.
	* gdb.python/py-symbol.c: Likewise.
	* gdb.threads/execl.c: Likewise.
	* gdb.threads/execl1.c: Likewise.
2013-06-07 14:39:33 +00:00
Phil Muldoon 1e611234ee 2013-05-10 Phil Muldoon <pmuldoon@redhat.com>
* stack.c (backtrace_command_1): Add "no-filters", and Python frame
	filter logic.
	(backtrace_command): Add "no-filters" option parsing.
	(_initialize_stack): Alter help to reflect "no-filters" option.
	* Makefile.in (SUBDIR_PYTHON_OBS): Add py-framefilter.o
	(SUBDIR_PYTHON_SRCS): Add py-framefilter.c
	(py-frame.o): Add target
	* data-directory/Makefile.in (PYTHON_DIR): Add Python frame
	filter files.
	* python/python.h: Add new frame filter constants, and flag enum.
	(apply_frame_filter): Add definition.
	* python/python.c (apply_frame_filter): New non-Python
	enabled function.
	* python/py-utils.c (py_xdecref): New function.
	(make_cleanup_py_xdecref): Ditto.
	* python/py-objfile.c: Declare frame_filters dictionary.
	(objfpy_dealloc): Add frame_filters dealloc.
	(objfpy_new): Initialize frame_filters attribute.
	(objfile_to_objfile_object): Ditto.
	(objfpy_get_frame_filters): New function.
	(objfpy_set_frame_filters): New function.
	* python/py-progspace.c: Declare frame_filters dictionary.
	(pspy_dealloc): Add frame_filters dealloc.
	(pspy_new): Initialize frame_filters attribute.
	(pspacee_to_pspace_object): Ditto.
	(pspy_get_frame_filters): New function.
	(pspy_set_frame_filters): New function.
	* python/py-framefilter.c: New file.
	* python/lib/gdb/command/frame_filters.py: New file.
	* python/lib/gdb/frames.py: New file.
	* python/lib/gdb/__init__.py: Initialize global frame_filters
	dictionary
	* python/lib/gdb/FrameDecorator.py: New file.
	* python/lib/gdb/FrameIterator.py: New file.
	* mi/mi-cmds.c (mi_cmds): Add frame filters command.
	* mi/mi-cmds.h: Declare.
	* mi/mi-cmd-stack.c (mi_cmd_stack_list_frames): Add
	--no-frame-filter logic, and Python frame filter logic.
	(stack_enable_frame_filters): New function.
	(parse_no_frame_option): Ditto.
	(mi_cmd_stack_list_frames): Add --no-frame-filter and Python frame
	filter logic.
	(mi_cmd_stack_list_locals): Ditto.
	(mi_cmd_stack_list_args): Ditto.
	(mi_cmd_stack_list_variables): Ditto.
	* NEWS: Add frame filter note.

2013-05-10  Phil Muldoon  <pmuldoon@redhat.com>

	* gdb.python/py-framefilter.py: New File.
	* gdb.python/py-framefilter-mi.exp: Ditto.
	* gdb.python/py-framefilter.c: Ditto.
	* gdb.python/py-framefilter-mi.exp: Ditto.
	* gdb.python/py-framefilter-mi.c: Ditto,
	* gdb.python/py-framefilter-gdb.py.in: Ditto.

2013-05-10 Phil Muldoon  <pmuldoon@redhat.com>

	* gdb.texinfo (Backtrace): Add "no-filter" argument.
	(Python API): Add Frame	Filters API, Frame Wrapper API,
	Writing a Frame Filter/Wrapper,	Managing Management of Frame
	Filters chapter entries.
	(Frame Filters API): New Node.
	(Frame Wrapper API): New Node.
	(Writing a Frame Filter): New Node.
	(Managing Frame Filters): New Node.
	(Progspaces In Python): Add note about frame_filters attribute.
	(Objfiles in Python): Ditto.
	(GDB/MI Stack Manipulation): Add -enable-frame-filters command,
	@anchors and --no-frame-filters option to -stack-list-variables,
	-stack-list-frames, -stack-list-locals and -stack-list-arguments
	commands.
2013-05-10 10:26:03 +00:00
Yao Qi ae59b1da21 gdb/testsuite/
* config/monitor.exp (gdb_target_cmd): Remove semicolon after
	'return'.
	(gdb_target_monitor, gdb_load): Likewise.
	* config/sid.exp (gdb_load): Likewise.
	* config/slite.exp (gdb_load): Likewise.
	* config/vx.exp (gdb_start, spawn_vxgdb): Likewise.
	* gdb.ada/arrayidx.exp, gdb.ada/null_array.exp: Likewise.
	* gdb.arch/mips-octeon-bbit.exp (single_step): Likewise.
	(single_step_until): Likewise.
	* gdb.arch/powerpc-d128-regs.exp: Likewise.
	* gdb.arch/system-gcore.exp: Likewise.
	* gdb.base/bigcore.exp (extract_heap): Likewise.
	* gdb.base/break-on-linker-gcd-function.exp: Likewise.
	* gdb.base/call-ar-st.exp: Likewise.
	* gdb.base/call-rt-st.exp: Likewise.
	* gdb.base/call-sc.exp, gdb.base/call-strs.exp: Likewise.
	* gdb.base/callfuncs.exp, gdb.base/completion.exp: Likewise.
	* gdb.base/condbreak.exp, gdb.base/constvars.exp: Likewise.
	* gdb.base/corefile.exp: Likewise.
	* gdb.base/dbx.exp (gdb_file_cmd): Likewise.
	* gdb.base/exprs.exp, gdb.base/fileio.exp: Likewise.
	* gdb.base/fixsection.exp: Likewise.
	* gdb.base/funcargs.exp: Likewise.
	* gdb.base/gcore-buffer-overflow.exp: Likewise.
	* gdb.base/gcore-relro.exp: Likewise.
	* gdb.base/gcore.exp, gdb.base/gdb11530.exp: Likewise.
	* gdb.base/gdb11531.exp, gdb.base/gnu-ifunc.exp: Likewise.
	* gdb.base/info-os.exp, gdb.base/info-proc.exp: Likewise.
	* gdb.base/interp.exp, gdb.base/langs.exp:: Likewise.
	* gdb.base/list.exp: Likewise.
	(set_listsize): Likewise.
	* gdb.base/logical.exp, gdb.base/mips_pro.exp: Likewise.
	* gdb.base/miscexprs.exp, gdb.base/nodebug.exp: Likewise.
	* gdb.base/opaque.exp, gdb.base/pointers.exp: Likewise.
	* gdb.base/psymtab.exp, gdb.base/ptype.exp: Likewise.
	* gdb.base/relational.exp, gdb.base/scope.exp: Likewise.
	* gdb.base/setvar.exp: Likewise.
	(test_set): Likewise.
	* gdb.base/signals.exp, gdb.base/sizeof.exp: Likewise.
	* gdb.base/solib-overlap.exp: Likewise.
	* gdb.base/store.exp, gdb.base/structs.exp: Likewise.
	* gdb.base/structs2.exp, gdb.base/volatile.exp: Likewise.
	* gdb.base/watchpoint.exp (initialize): Likewise.
	(test_simple_watchpoint): Likewise.
	(test_disabling_watchpoints): Likewise.
	(test_watchpoint_triggered_in_syscall): Likewise.
	* gdb.base/whatis.exp, gdb.cp/ambiguous.exp: Likewise.
	* gdb.cp/casts.exp, gdb.cp/ctti.exp: Likewise.
	* gdb.cp/namespace.exp, gdb.cp/nsdecl.exp: Likewise.
	* gdb.cp/psmang.exp, gdb.dwarf2/dw2-ranges.exp: Likewise.
	* gdb.hp/gdb.aCC/optimize.exp: Likewise.
	* gdb.hp/gdb.aCC/watch-cmd.exp: Likewise.
	* gdb.hp/gdb.base-hp/callfwmall.exp: Likewise.
	* gdb.hp/gdb.base-hp/pxdb.exp: Likewise.
	* gdb.hp/gdb.compat/xdb1.exp: Likewise.
	* gdb.hp/gdb.compat/xdb2.exp: Likewise.
	* gdb.hp/gdb.compat/xdb3.exp: Likewise.
	* gdb.hp/gdb.defects/bs14602.exp: Likewise.
	* gdb.hp/gdb.defects/solib-d.exp: Likewise.
	* gdb.mi/gdb792.exp: Likewise.
	* gdb.mi/mi-inheritance-syntax-error.exp: Likewise.
	* gdb.mi/mi-logging.exp, gdb.mi/mi-var-cp.exp : Likewise.
	* gdb.mi/mi-var-rtti.exp, gdb.python/py-type.exp: Likewise.
	* gdb.threads/gcore-thread.exp: Likewise.
	(load_core): Likewise.
	* gdb.threads/pthreads.exp (all_threads_running): Likewise.
	(test_startup, check_control_c): Likewise.
	* gdb.threads/sigstep-threads.exp: Likewise.
	* gdb.threads/thread_check.exp: Likewise.
	* gdb.trace/backtrace.exp, gdb.trace/change-loc.exp: Likewise.
	* gdb.trace/circ.exp (run_trace_experiment): Likewise.
	(set_a_tracepoint, trace_buffer_normal): Likewise.
	(gdb_trace_circular_tests): Likewise.
	* gdb.trace/collection.exp: Likewise.
	* gdb.trace/disconnected-tracing.exp: Likewise.
	* gdb.trace/infotrace.exp: Likewise.
	* gdb.trace/mi-traceframe-changed.exp: Likewise.
	* gdb.trace/mi-tracepoint-changed.exp: Likewise.
	* gdb.trace/mi-tsv-changed.exp (test_create_delete_modify_tsv): Likewise.
	* gdb.trace/packetlen.exp, gdb.trace/passc-dyn.exp: Likewise.
	* gdb.trace/pending.exp, gdb.trace/report.exp: Likewise.
	* gdb.trace/stap-trace.exp: Likewise.
	* gdb.trace/status-stop.exp,gdb.trace/strace.exp: Likewise.
	* gdb.trace/tfind.exp, gdb.trace/trace-break.exp: Likewise.
	* gdb.trace/trace-buffer-size.exp: Likewise.
	* gdb.trace/tspeed.exp, gdb.trace/tsv.exp: Likewise.
	* gdb.trace/unavailable.exp: Likewise.
	* gdb.trace/while-dyn.exp: Likewise.
	* lib/fortran.exp (set_lang_fortran): Likewise.
	* lib/gdb.exp (default_gdb_version, gdb_start_cmd): Likewise.
	(gdb_breakpoint, gdb_reinitialize_dir): Likewise.
	(default_gdb_start, get_compiler_info): Likewise.
	(gdb_compile, gdb_compile_objc, gdb_reload, gdb_init): Likewise.
	(get_debug_format, setup_xfail_format): Likewise.
	(rerun_to_main, gdb_skip_float_test): Likewise.
	(build_id_debug_filename_get, get_remotetimeout): Likewise.
	* lib/java.exp (set_lang_java): Likewise.
	* lib/mi-support.exp (default_mi_gdb_start): Likewise.
	(mi_gdb_reinitialize_dir, mi_gdb_target_cmd): Likewise.
	(mi_gdb_file_cmd, mi_gdb_test): Likewise.
	(mi_run_cmd_full, mi_expect_interrupt): Likewise.
	* lib/objc.exp (set_lang_objc): Likewise.
	* lib/pascal.exp (set_lang_pascal): Likewise.
	* lib/prompt.exp (default_prompt_gdb_start): Likewise.
	* lib/trace-support.exp (gdb_trace_setactions, gdb_tfind_test): Likewise.
	(gdb_readexpr, gdb_gettpnum, gdb_find_recursion_test_baseline): Likewise.
2013-03-14 13:34:06 +00:00
Siva Chandra Reddy 9f44fbc034 Add a new method 'disassemble' to gdb.Architecture class.
* python/py-arch.c (archpy_disassmble): Implementation of the
	new method gdb.Architecture.disassemble.
	(arch_object_methods): Add entry for the new method.

	* doc/gdb.texinfo (Architectures In Python): Add description
	about the new method gdb.Architecture.disassemble.

	* testsuite/gdb.python/py-arch.c: New test case
	* testsuite/gdb.python/py-arch.exp: New tests to test
	gdb.Architecture.disassemble
	* testsuite/gdb.python/Makefile.in: Add py-arch to the list of
	EXECUTABLES.
2013-02-21 01:46:57 +00:00