Age | Commit message (Collapse) | Author | Files | Lines |
|
The test in gdb.python/python.exp tests "extended-prompt" and expects
working directory is printed. However, working directory on remote
host doesn't have "gdb/testsuite", so the test fails on remote host
like:
set extended-prompt \w ^M
^M
/home/yao FAIL: gdb.python/python.exp: set extended prompt working directory (timeout)
This patch is to get the working directory first, and use it to match
the output of "set extended-prompt \\w ". It works for remote host
and non remote host.
gdb/testsuite:
2014-11-02 Yao Qi <yao@codesourcery.com>
* gdb.python/python.exp: Get working directory and match the
output of "set extended-prompt \\w " with it.
|
|
gdb/ChangeLog:
* NEWS: Mention ability add attributes to gdb.Objfile and
gdb.Progspace objects.
* python/py-objfile.c (objfile_object): New member dict.
(objfpy_dealloc): Py_XDECREF dict.
(objfpy_initialize): Initialize dict.
(objfile_getset): Add __dict__.
(objfile_object_type): Set tp_dictoffset member.
* python/py-progspace.c (progspace_object): New member dict.
(pspy_dealloc): Py_XDECREF dict.
(pspy_initialize): Initialize dict.
(pspace_getset): Add __dict__.
(pspace_object_type): Set tp_dictoffset member.
gdb/doc/ChangeLog:
* python.texi (Progspaces In Python): Document ability to add
random attributes to gdb.Progspace objects.
(Objfiles In Python): Document ability to add random attributes to
gdb.objfile objects.
gdb/testsuite/ChangeLog:
* gdb.python/py-objfile.exp: Add tests for setting random attributes
in objfiles.
* gdb.python/py-progspace.exp: Add tests for setting random attributes
in progspaces.
|
|
This is more of a readline/terminal issue than a Python one.
PR17372 is a regression in 7.8 caused by the fix for PR17072:
commit 0017922d0292d8c374584f6100874580659c9973
Author: Pedro Alves <palves@redhat.com>
Date: Mon Jul 14 19:55:32 2014 +0100
Background execution + pagination aborts readline/gdb
gdb_readline_wrapper_line removes the handler after a line is
processed. Usually, we'll end up re-displaying the prompt, and that
reinstalls the handler. But if the output is coming out of handling
a stop event, we don't re-display the prompt, and nothing restores the
handler. So the next input wakes up the event loop and calls into
readline, which aborts.
...
gdb/
2014-07-14 Pedro Alves <palves@redhat.com>
PR gdb/17072
* top.c (gdb_readline_wrapper_line): Tweak comment.
(gdb_readline_wrapper_cleanup): If readline is enabled, reinstall
the input handler callback.
The problem is that installing the input handler callback also preps
the terminal, putting it in raw mode and with echo disabled, which is
bad if we're going to call a command that assumes cooked/canonical
mode, and echo enabled, like in the case of the PR, Python's
interactive shell. Another example I came up with that doesn't depend
on Python is starting a subshell with "(gdb) shell /bin/sh" from a
multi-line command. Tests covering both these examples are added.
The fix is to revert the original fix for PR gdb/17072, and instead
restore the callback handler after processing an asynchronous target
event.
Furthermore, calling rl_callback_handler_install when we already have
some input in readline's line buffer discards that input, which is
obviously a bad thing to do while the user is typing. No specific
test is added for that, because I first tried calling it even if the
callback handler was still installed and that resulted in hundreds of
failures in the testsuite.
gdb/
2014-10-29 Pedro Alves <palves@redhat.com>
PR python/17372
* event-top.c (change_line_handler): Call
gdb_rl_callback_handler_remove instead of
rl_callback_handler_remove.
(callback_handler_installed): New global.
(gdb_rl_callback_handler_remove, gdb_rl_callback_handler_install)
(gdb_rl_callback_handler_reinstall): New functions.
(display_gdb_prompt): Call gdb_rl_callback_handler_remove and
gdb_rl_callback_handler_install instead of
rl_callback_handler_remove and rl_callback_handler_install.
(gdb_disable_readline): Call gdb_rl_callback_handler_remove
instead of rl_callback_handler_remove.
* event-top.h (gdb_rl_callback_handler_remove)
(gdb_rl_callback_handler_install)
(gdb_rl_callback_handler_reinstall): New declarations.
* infrun.c (reinstall_readline_callback_handler_cleanup): New
cleanup function.
(fetch_inferior_event): Install it.
* top.c (gdb_readline_wrapper_line) Call
gdb_rl_callback_handler_remove instead of
rl_callback_handler_remove.
(gdb_readline_wrapper_cleanup): Don't call
rl_callback_handler_install.
gdb/testsuite/
2014-10-29 Pedro Alves <palves@redhat.com>
PR python/17372
* gdb.python/python.exp: Test a multi-line command that spawns
interactive Python.
* gdb.base/multi-line-starts-subshell.exp: New file.
|
|
Patch <https://sourceware.org/ml/gdb-patches/2011-07/msg00225.html> was
to fix the problem that py-objfile-script-gdb.py is removed after an
in-tree build and test. As a result of the previous patch (we don't
remove files copied to host any more), this patch is no longer needed.
This patch is to revert it logically.
gdb/testsuite:
2014-10-20 Yao Qi <yao@codesourcery.com>
* gdb.python/py-objfile-script-gdb.py.in: Rename it to ...
* gdb.python/py-objfile-script-gdb.py: New file.
* gdb.python/py-objfile-script.exp: Update reference to
py-objfile-script-gdb.py.in. Use gdb_remote_donwload instead
of remote_download. Remove the dest file.
|
|
Nowadays, if we do in-tree build and run tests sequentially, some source
files are removed, due to the following pattern:
set pi_txt [gdb_remote_download host ${srcdir}/${subdir}/pi.txt]
remote_exec host "rm -f $pi_txt"
If testing is run sequentially, file ${srcdir}/${subdir}/pi.txt is
copied to ${objdir}/${subdir}/pi.txt. However, ${objdir} is ${srcdir}
in the in-tree build/test, so the file is coped to itself, as a nop.
As a result, the file in source is removed at the end of test.
This patch fixes this problem by not removing files copied to host in
each test. This patch also addresses the question we've had that why
don't we keep files copied to host because they are needed to reproduce
certain fails.
gdb/testsuite:
2014-10-20 Yao Qi <yao@codesourcery.com>
* gdb.base/checkpoint.exp: Don't remove file copied on host.
* gdb.base/step-line.exp: Likewise.
* gdb.dwarf2/dw2-anonymous-func.exp: Likewise.
* gdb.dwarf2/dw2-basic.exp: Likewise.
* gdb.dwarf2/dw2-compressed.exp: Likewise.
* gdb.dwarf2/dw2-filename.exp: Likewise.
* gdb.dwarf2/dw2-intercu.exp: Likewise.
* gdb.dwarf2/dw2-intermix.exp: Likewise.
* gdb.dwarf2/dw2-producer.exp: Likewise.
* gdb.dwarf2/mac-fileno.exp: Likewise.
* gdb.python/py-frame-args.exp: Likewise.
* gdb.python/py-framefilter.exp: Likewise.
* gdb.python/py-mi.exp: Likewise.
* gdb.python/py-objfile-script.exp: Likewise
* gdb.python/py-pp-integral.exp: Likewise.
* gdb.python/py-pp-re-notag.exp: Likewise.
* gdb.python/py-prettyprint.exp: Likewise.
* gdb.python/py-section-script.exp: Likewise.
* gdb.python/py-typeprint.exp: Likewise.
* gdb.python/py-xmethods.exp: Likewise.
* gdb.stabs/weird.exp: Likewise.
* gdb.xml/tdesc-regs.exp: Likewise.
|
|
I see the following two fails on arm-none-eabi target, because argv[0]
isn't available.
print argv[0]^M
$1 = 0x1f78 "/dev/null"^M
(gdb) FAIL: gdb.base/argv0-symlink.exp: kept file symbolic link name
print argv[0]^M
$1 = 0x1f78 "/dev/null"^M
(gdb) FAIL: gdb.base/argv0-symlink.exp: kept directory symbolic link name
My first thought is to check [target_info exists noargs], and skip the
test if it returns true. However, noargs is set in gdbserver board
files, so argv0-symlink.exp will be skipped on gdbserver board file.
The change is too aggressive.
When the program is running with gdbserver, argv[1] to argv[N] aren't
available, but argv[0] is. Fortunately, argv0-symlink.exp only
requires argv[0]. argv0-symlink.exp can be run with gdbserver board
file, as what we do now.
What we need to check is whether argv[0] is available, so I add a new
proc gdb_has_argv0 to do so by starting a program, and check
argc/argv[0] to see whether argv[0] is available.
Dan fixed the similar problem by checking noargs, which is too strong.
https://sourceware.org/ml/gdb-patches/2010-02/msg00398.html as a
result, the test is skipped on gdbserver. This patch fixed it too.
gdb/testsuite:
2014-10-18 Yao Qi <yao@codesourcery.com>
* gdb.base/argv0-symlink.exp: Check argv[0] value if
gdb_has_argv0 return true.
* gdb.guile/scm-value.exp (test_value_in_inferior): Don't
check [target_info exists noargs], check [gdb_has_argv0]
instead.
* gdb.python/py-value.exp (test_value_in_inferior): Likewise.
* lib/gdb.exp (gdb_has_argv0, gdb_has_argv0_1): New
procedures.
|
|
If one is watching new_objfile events in python, it helps to know
when the list of objfiles is cleared. This patch adds a new
clear_objfiles event to support this.
This patch is all just cut-n-paste-n-tweak derived from
the new_objfiles event.
gdb/ChangeLog:
* NEWS: Mention new event gdb.clear_objfiles.
* python/py-event.h (emit_clear_objfiles_event): Clear
* python/py-events.h (events_object): New member clear_objfiles.
* python/py-evts.c (gdbpy_initialize_py_events): Add clear_objfiles
event.
* python/py-inferior.c (python_new_objfile): If objfile is NULL,
emit clear_objfiles event.
* python/py-newobjfileevent.c (create_clear_objfiles_event_object): New
function.
(emit_clear_objfiles_event): New function.
(clear_objfiles): New event.
* python/python-internal.h (gdbpy_initialize_clear_objfiles_event):
Declare.
* python/python.c (_initialize_python): Call
gdbpy_initialize_clear_objfiles_event.
gdb/doc/ChangeLog:
* python.texi (Events In Python): Document clear_objfiles event.
gdb/testsuite/ChangeLog:
* gdb.python/py-events.exp: Update expected output for clear_objfiles
event.
* gdb.python/py-events.py: Add clear_objfiles event.
|
|
gdb/ChangeLog:
* NEWS: Mention new gdb.Objfile.progspace attribute.
* python/py-objfile.c (objfpy_get_progspace): New function.
(objfile_getset): New entry for "progspace".
gdb/doc/ChangeLog:
* python.texi (Objfiles In Python): Document new progspace attribute.
gdb/testsuite/ChangeLog:
* gdb.python/py-objfile.exp: Test progspace attribute.
|
|
Some testcases, mostly gdb.reverse ones, assume the presence of a
'/' directory separator before the source file name. This is
incorrect for mingw32 hosts, generating false failures for those
tests.
I attempted to catch most of the occurrences of the pattern
".*/$srcfile" and replaced them with ".*$srcfile". The latter
is used elsewhere in the testsuite. The resulting patch is attached.
I also see other occurrences of the same assumption throughout the
testsuite, but usually they are arguments for function calls and i
seem to recall either the test harness or GDB deals with those
paths properly.
gdb/testsuite:
2014-10-17 Luis Machado <lgustavo@codesourcery.com>
* gdb.guile/scm-breakpoint.exp: Do not assume any
directory separators when matching source file paths.
* gdb.python/py-breakpoint.exp: Likewise.
* gdb.reverse/break-precsave.exp: Likewise.
* gdb.reverse/break-reverse.exp: Likewise.
* gdb.reverse/consecutive-precsave.exp: Likewise.
* gdb.reverse/finish-precsave.exp: Likewise.
* gdb.reverse/finish-reverse-bkpt.exp: Likewise.
* gdb.reverse/finish-reverse.exp: Likewise.
* gdb.reverse/i386-precsave.exp: Likewise.
* gdb.reverse/i387-env-reverse.exp: Likewise.
* gdb.reverse/i387-stack-reverse.exp: Likewise.
* gdb.reverse/machinestate-precsave.exp: Likewise.
* gdb.reverse/machinestate.exp: Likewise.
* gdb.reverse/sigall-precsave.exp: Likewise.
* gdb.reverse/solib-precsave.exp: Likewise.
* gdb.reverse/step-precsave.exp: Likewise.
* gdb.reverse/until-precsave.exp: Likewise.
* gdb.reverse/watch-precsave.exp: Likewise.
* gdb.reverse/watch-reverse.exp: Likewise.
|
|
Test gdb.python/py-parameter.exp expects output "$srcdir/$subdir:\$cdir:\$cwd",
but proc gdb_reinitialize_dir doesn't set $srcdir/$subdir in search
directories on remote host because it doesn't exist on remote host.
proc gdb_reinitialize_dir { subdir } {
global gdb_prompt
if [is_remote host] {
return ""
}
It causes the fail below:
(gdb) python print (gdb.parameter ('directories'))^M
/tmp/gdb:$cdir:$cwd^M
(gdb) FAIL: gdb.python/py-parameter.exp: python print (gdb.parameter ('directories'))
This patch is to fix this fail by not matching $srcdir/$subdir on remote host.
gdb/testsuite:
2014-10-15 Yao Qi <yao@codesourcery.com>
* gdb.python/py-parameter.exp: Don't match $srcdir/$subdir on
remote host.
|
|
I see the following fails in the remote host testing we do for mingw32
hosted GDB,
python print (symtab[1][0].symtab)^M
python.c^M
(gdb) FAIL: gdb.python/python.exp: Test decode_line current locationn filename
python print (symtab[1][0].symtab)^M
python.c^M
(gdb) FAIL: gdb.python/python.exp: Test decode_line python.c:26 filename
The test cases doesn't consider remote host and assumes that directory
on build also exists on host. In this patch, we only match file base
name if host is remote, otherwise, match file with dir name.
gdb/testsuite:
2014-10-15 Yao Qi <yao@codesourcery.com>
* gdb.python/py-symbol.exp: Match file base name if host is
remote, otherwise match file name with dir name.
* gdb.python/py-symtab.exp: Likewise.
* gdb.python/python.exp: Likewise.
|
|
This patch is to clean up various gdb.python/*.exp tests, such as
removing trailing ".*" from the pattern and fix one typo I find during
reading the code.
gdb/testsuite:
2014-10-15 Yao Qi <yao@codesourcery.com>
* gdb.python/python.exp: Remove trailing ".*". Fix typo
locationn.
* gdb.python/py-symbol.exp: Remove trailing ".*" in the
pattern.
* gdb.python/py-symtab.exp: Likewise.
|
|
Tests should each have their own name.
gdb/testsuite/ChangeLog:
* gdb.python/py-objfile.exp: Change name of file name test.
|
|
Several places in the testsuite have a copy of a snippet of code that
spawns a test program, waits a bit, and then does some PID munging for
Cygwin. This is in order to have GDB attach to the spawned program.
This refactors all that to a common procedure.
(multi-attach.exp wants to spawn multiple processes, so this makes the
new procedure's interface work with lists.)
Tested on x86_64 Fedora 20.
gdb/testsuite/ChangeLog:
2014-09-11 Pedro Alves <palves@redhat.com>
* lib/gdb.exp (spawn_wait_for_attach): New procedure.
* gdb.base/attach.exp (do_attach_tests, do_call_attach_tests)
(do_command_attach_tests): Use spawn_wait_for_attach.
* gdb.base/solib-overlap.exp: Likewise.
* gdb.multi/multi-attach.exp: Likewise.
* gdb.python/py-prompt.exp: Likewise.
* gdb.python/py-sync-interp.exp: Likewise.
* gdb.server/ext-attach.exp: Likewise.
|
|
have empty bodies.
User-defined commands that have empty bodies weren't being shown because
the print function returned too soon. Now, it prints the command's name
before checking if it has any body at all. This also fixes the same
problem on "show user <myemptycommand>", which wasn't being printed due
to a similar reason.
gdb/Changelog:
* cli/cli-cmds.c (show_user): Use cli_user_command_p to
decide whether we display the command on "show user".
* cli/cli-script.c (show_user_1): Only verify cmdlines after
printing command name.
* cli/cli-decode.h (cli_user_command_p): Declare new function.
* cli/cli-decode.c (cli_user_command_p): Create helper function
to verify whether cmd_list_element is a user-defined command.
gdb/testsuite/Changelog:
* gdb.base/commands.exp: Add tests to verify user-defined
commands with empty bodies.
* gdb.python/py-cmd.exp: Test that we don't show user-defined
python commands in `show user command`.
* gdb.python/scm-cmd.exp: Test that we don't show user-defined
scheme commands in `show user command`.
|
|
https://bugzilla.redhat.com/show_bug.cgi?id=1126177
ERROR: AddressSanitizer: SEGV on unknown address 0x000000000050 (pc 0x000000992bef sp 0x7ffff9039530 bp 0x7ffff9039540
T0)
#0 0x992bee in value_type .../gdb/value.c:925
#1 0x87c951 in py_print_single_arg python/py-framefilter.c:445
#2 0x87cfae in enumerate_args python/py-framefilter.c:596
#3 0x87e0b0 in py_print_args python/py-framefilter.c:968
It crashes because frame_arg::val is documented it may contain NULL
(frame_arg::error is then non-NULL) but the code does not handle it.
Another bug is that py_print_single_arg() calls goto out of its TRY_CATCH
which messes up GDB cleanup chain crashing GDB later.
It is probably 7.7 regression (I have not verified it) due to the introduction
of Python frame filters.
gdb/ChangeLog
PR python/17355
* python/py-framefilter.c (py_print_single_arg): Handle NULL FA->VAL.
Fix goto out of TRY_CATCH.
gdb/testsuite/ChangeLog
PR python/17355
* gdb.python/amd64-py-framefilter-invalidarg.S: New file.
* gdb.python/py-framefilter-invalidarg-gdb.py.in: New file.
* gdb.python/py-framefilter-invalidarg.exp: New file.
* gdb.python/py-framefilter-invalidarg.py: New file.
|
|
$_any_caller_matches
gdb/ChangeLog:
PR 15276
* NEWS: Mention $_caller_is, $_caller_matches, $_any_caller_is,
$_any_caller_matches.
* data-directory/Makefile.in (PYTHON_FILE_LIST): Add caller_is.py.
* python/lib/gdb/function/caller_is.py: New file.
gdb/testsuite/ChangeLog:
PR 15276
* gdb.python/py-caller-is.c: New file.
* gdb.python/py-caller-is.exp: New file.
gdb/doc/ChangeLog:
PR 15276
* gdb.texinfo (Convenience Funs): Document $_caller_is,
$_caller_matches, $_any_caller_is, $_any_caller_matches.
|
|
The ability to read registers is needed to use Frame Filter API to
display the frames created by JIT compilers.
gdb/ChangeLog:
2014-08-29 Sasha Smundak <asmundak@google.com>
* python/py-frame.c (frapy_read_register): New function.
gdb/doc/ChangeLog:
2014-08-26 Sasha Smundak <asmundak@google.com>
* python.texi (Frames in Python): Add read_register description.
gdb/testsuite/ChangeLog:
2014-08-26 Sasha Smundak <asmundak@google.com>
* gdb.python/py-frame.exp: Test Frame.read_register.
|
|
completer class
This PR came from a Red Hat bug that was filed recently. I checked and
it still exists on HEAD, so here's a proposed fix. Although this is
marked as a Python backend bug, this is really about the completion
mechanism used by GDB. Since this code reminds me of my first attempt
to make a good noodle, it took me quite some time to fix it in a
non-intrusive way.
The problem is triggered when one registers a completion method inside a
class in a Python script, rather than registering the command using a
completer class directly. For example, consider the following script:
class MyFirstCommand(gdb.Command):
def __init__(self):
gdb.Command.__init__(self,'myfirstcommand',gdb.COMMAND_USER,gdb.COMPLETE_FILENAME)
def invoke(self,argument,from_tty):
raise gdb.GdbError('not implemented')
class MySecondCommand(gdb.Command):
def __init__(self):
gdb.Command.__init__(self,'mysecondcommand',gdb.COMMAND_USER)
def invoke(self,argument,from_tty):
raise gdb.GdbError('not implemented')
def complete(self,text,word):
return gdb.COMPLETE_FILENAME
MyFirstCommand ()
MySecondCommand ()
When one loads this into GDB and tries to complete filenames for both
myfirstcommand and mysecondcommand, she gets:
(gdb) myfirstcommand /hom<TAB>
(gdb) myfirstcommand /home/
^
...
(gdb) mysecondcommand /hom<TAB>
(gdb) mysecondcommand /home
^
(The "^" marks the final position of the cursor after the TAB).
So we see that myfirstcommand honors the COMPLETE_FILENAME class (as
specified in the command creation), but mysecondcommand does not. After
some investigation, I found that the problem lies with the set of word
break characters that is used for each case. The set should be the same
for both commands, but it is not.
During the process of deciding which type of completion should be used,
the code in gdb/completer.c:complete_line_internal analyses the command
that requested the completion and tries to determine the type of
completion wanted by checking which completion function will be called
(e.g., filename_completer for filenames, location_completer for
locations, etc.).
This all works fine for myfirstcommand, because immediately after the
command registration the Python backend already sets its completion
function to filename_completer (which then causes the
complete_line_internal function to choose the right set of word break
chars). However, for mysecondcommand, this decision is postponed to
when the completer function is evaluated, and the Python backend uses an
internal completer (called cmdpy_completer). complete_line_internal
doesn't know about this internal completer, and can't choose the right
set of word break chars in time, which then leads to a bad decision when
completing the "/hom" word.
So, after a few attempts, I decided to create another callback in
"struct cmd_list_element" that will be responsible for handling the case
when there is an unknown completer function for complete_line_internal
to work with. So far, only the Python backend uses this callback, and
only when the user provides a completer method instead of registering
the command directly with a completer class. I think this is the best
option because it not very intrusive (all the other commands will still
work normally), but especially because the whole completion code is so
messy that it would be hard to fix this without having to redesign
things.
I have regtested this on Fedora 18 x86_64, without regressions. I also
included a testcase.
gdb/ChangeLog:
2014-09-03 Sergio Durigan Junior <sergiodj@redhat.com>
PR python/16699
* cli/cli-decode.c (set_cmd_completer_handle_brkchars): New
function.
(add_cmd): Set "completer_handle_brkchars" to NULL.
* cli/cli-decode.h (struct cmd_list_element)
<completer_handle_brkchars>: New field.
* command.h (completer_ftype_void): New typedef.
(set_cmd_completer_handle_brkchars): New prototype.
* completer.c (set_gdb_completion_word_break_characters): New
function.
(complete_line_internal): Call "completer_handle_brkchars"
callback from command.
* completer.h: Include "command.h".
(set_gdb_completion_word_break_characters): New prototype.
* python/py-cmd.c (cmdpy_completer_helper): New function.
(cmdpy_completer_handle_brkchars): New function.
(cmdpy_completer): Adjust to use cmdpy_completer_helper.
(cmdpy_init): Set completer_handle_brkchars to
cmdpy_completer_handle_brkchars.
gdb/testsuite/ChangeLog:
2014-09-03 Sergio Durigan Junior <sergiodj@redhat.com>
PR python/16699
* gdb.python/py-completion.exp: New file.
* gdb.python/py-completion.py: Likewise.
|
|
I see the following fails on arm-none-eabi target,
print sn^M
$14 = 0x0 <_ftext>^M
(gdb) FAIL: gdb.python/py-value.exp: print sn
print sn^M
$14 = 0x0 <_ftext>^M
(gdb) FAIL: gdb.guile/scm-value.exp: print sn
as <_ftext> is unexpected. This patch is to set print symbol off to
avoid printing this.
gdb/testsuite:
2014-08-24 Yao Qi <yao@codesourcery.com>
* gdb.guile/scm-value.exp (test_lazy_strings): Set print
symbol off.
* gdb.python/py-value.exp (test_lazy_strings): Likewise.
|
|
Some gdb.python/*.exp tests fail because the .py files aren't copied
to the (remote) host. This patch is to copy needed .py files to host.
Most of gdb.python/*.exp tests do this.
As it is still controversial to delete *.py files on host, we don't do
that in this patch.
gdb/testsuite:
2014-08-22 Yao Qi <yao@codesourcery.com>
* gdb.python/py-finish-breakpoint.exp: Copy .py file to host.
* gdb.python/py-finish-breakpoint2.exp: Likewise.
* gdb.python/python.exp: Likewise. Use .py file on the host
instead of the build.
|
|
gdb/
* python/lib/gdb/command/xmethods.py (set_xm_status1): Use the
'items' methods instead of 'iteritems' method on dictionaries.
gdb/testsuite/
* gdb.python/py-xmethods.py (A_getarrayind)
(E_method_char_worker.__call__, E_method_int_worker.__call__):
Use 'print' with function call syntax.
(E_method_matcher.match): Fix tab vs space indentation mixup.
|
|
I find some gdb.python tests fail on arm-none-eabi target, because the
tests assume that memory on address 0x is inaccessible. Some tests
(in gdb.base) are aware of this, so do a "x 0" check first. However,
the code is copy-n-paste.
This patch is to move the "x 0" check to a procedure in lib/gdb.exp,
and get needed tests call it. The original code matches pattern
"0x0:\[ \t\]*Error accessing memory address 0x0\r\n$gdb_prompt $", but
I remove it from the new proc is_address_zero_readable, because GDB
doesn't emit such message any more.
gdb/testsuite:
2014-08-09 Yao Qi <yao@codesourcery.com>
* gdb.base/display.exp: Invoke is_address_zero_readable.
* gdb.guile/scm-value.exp (test_value_in_inferior): Likewise.
* gdb.python/py-value.exp (test_value_in_inferior): Likewise.
* gdb.base/hbreak-unmapped.exp: Return if
is_address_zero_readable returns true.
* gdb.base/signest.exp: Likewise.
* gdb.base/signull.exp: Likewise.
* gdb.base/sigbpt.exp: Likewise.
* gdb.guile/scm-disasm.exp: Do the test if
is_address_zero_readable returns false.
* gdb.guile/scm-pretty-print.exp (run_lang_tests): Likewise.
* gdb.python/py-arch.exp: Likewise.
* gdb.python/py-prettyprint.exp (run_lang_tests): Likewise.
* lib/gdb.exp (is_address_zero_readable): New proc.
|
|
Currently, the xmethod commands lookup xmethod matchers in the current
progspace even if the locus regular expression matches the progspace's
filename. Pretty printer commands do not match the current progspace's
filename.
gdb/
* python/lib/gdb/command/xmethods.py
(get_method_matchers_in_loci): Lookup xmethod matchers in the
current progspace only if the string "progspace" matches LOCUS_RE.
gdb/testsuite
* gdb.python/py-xmethods.exp: Use "progspace" instead of the
progspace's filename in 'info', 'enable' and 'disable' command
tests.
|
|
gdb/testsuite/
PR gdb/17017
* gdb.python/py-xmethods.cc: Add global function call counters and
increment them in their respective functions. Remove "cout"
statements.
* gdb.python/py-xmethods.exp: Make tests check the global function
call counters instead of depending on inferior IO.
|
|
* python/py-xmethods.c: New file.
* python/py-objfile.c (objfile_object): New field 'xmethods'.
(objfpy_dealloc): XDECREF on the new xmethods field.
(objfpy_new, objfile_to_objfile_object): Initialize xmethods
field.
(objfpy_get_xmethods): New function.
(objfile_getset): New entry 'xmethods'.
* python/py-progspace.c (pspace_object): New field 'xmethods'.
(pspy_dealloc): XDECREF on the new xmethods field.
(pspy_new, pspace_to_pspace_object): Initialize xmethods
field.
(pspy_get_xmethods): New function.
(pspace_getset): New entry 'xmethods'.
* python/python-internal.h: Add declarations for new functions.
* python/python.c (_initialize_python): Invoke
gdbpy_initialize_xmethods.
* python/lib/gdb/__init__.py (xmethods): New
attribute.
* python/lib/gdb/xmethod.py: New file.
* python/lib/gdb/command/xmethods.py: New file.
testuite/
* gdb.python/py-xmethods.cc: New testcase to test xmethods.
* gdb.python/py-xmethods.exp: New tests to test xmethods.
* gdb.python/py-xmethods.py: Python script supporting the
new testcase and tests.
|
|
This finally makes background execution commands possible by default.
However, in order to do that, there's one last thing we need to do --
we need to separate the MI and target notions of "async". Unlike the
CLI, where the user explicitly requests foreground vs background
execution in the execution command itself (c vs c&), MI chose to treat
"set target-async" specially -- setting it changes the default
behavior of execution commands.
So, we can't simply "set target-async" default to on, as that would
affect MI frontends. Instead we have to make the setting MI-specific,
and teach MI about sync commands on top of an async target.
Because the "target" word in "set target-async" ends up as a potential
source of confusion, the patch adds a "set mi-async" option, and makes
"set target-async" a deprecated alias.
Rather than make the targets always async, this patch introduces a new
"maint set target-async" option so that the GDB developer can control
whether the target is async. This makes it simpler to debug issues
arising only in the synchronous mode; important because sync mode
seems unlikely to go away.
Unlike in previous revisions, "set target-async" does not affect this
new maint parameter. The rationale for this is that then one can
easily run the test suite in the "maint set target-async off" mode and
have tests that enable mi-async fail just like they fail on
non-async-capable targets. This emulation is exactly the point of the
maint option.
I had asked Tom in a previous iteration to split the actual change of
the target async default to a separate patch, but it turns out that
that is quite awkward in this version of the patch, because with MI
async and target async decoupled (unlike in previous versions), if we
don't flip the default at the same time, then just "set target-async
on" alone never actually manages to do anything. It's best to not
have that transitory state in the tree.
Given "set target-async on" now only has effect for MI, the patch goes
through the testsuite removing it from non-MI tests. MI tests are
adjusted to use the new and less confusing "mi-async" spelling.
2014-05-29 Pedro Alves <palves@redhat.com>
Tom Tromey <tromey@redhat.com>
* NEWS: Mention "maint set target-async", "set mi-async", and that
background execution commands are now always available.
* target.h (target_async_permitted): Update comment.
* target.c (target_async_permitted, target_async_permitted_1):
Default to 1.
(set_target_async_command): Rename to ...
(maint_set_target_async_command): ... this.
(show_target_async_command): Rename to ...
(maint_show_target_async_command): ... this.
(_initialize_target): Adjust.
* infcmd.c (prepare_execution_command): Make extern.
* inferior.h (prepare_execution_command): Declare.
* infrun.c (set_observer_mode): Leave target async alone.
* mi/mi-interp.c (mi_interpreter_init): Install
mi_on_sync_execution_done as sync_execution_done observer.
(mi_on_sync_execution_done): New function.
(mi_execute_command_input_handler): Don't print the prompt if we
just started a synchronous command with an async target.
(mi_on_resume): Check sync_execution before printing prompt.
* mi/mi-main.h (mi_async_p): Declare.
* mi/mi-main.c: Include gdbcmd.h.
(mi_async_p): New function.
(mi_async, mi_async_1): New globals.
(set_mi_async_command, show_mi_async_command, mi_async): New
functions.
(exec_continue): Call prepare_execution_command.
(run_one_inferior, mi_cmd_exec_run, mi_cmd_list_target_features)
(mi_execute_async_cli_command): Use mi_async_p.
(_initialize_mi_main): Install "set mi-async". Make
"target-async" a deprecated alias.
2014-05-29 Pedro Alves <palves@redhat.com>
Tom Tromey <tromey@redhat.com>
* gdb.texinfo (Non-Stop Mode): Remove "set target-async 1"
from example.
(Asynchronous and non-stop modes): Document '-gdb-set mi-async'.
Mention that target-async is now deprecated.
(Maintenance Commands): Document maint set/show target-async.
2014-05-29 Pedro Alves <palves@redhat.com>
Tom Tromey <tromey@redhat.com>
* gdb.base/async-shell.exp: Don't enable target-async.
* gdb.base/async.exp
* gdb.base/corefile.exp (corefile_test_attach): Remove 'async'
parameter. Adjust.
(top level): Don't test with "target-async".
* gdb.base/dprintf-non-stop.exp: Don't enable target-async.
* gdb.base/gdb-sigterm.exp: Don't test with "target-async".
* gdb.base/inferior-died.exp: Don't enable target-async.
* gdb.base/interrupt-noterm.exp: Likewise.
* gdb.mi/mi-async.exp: Use "mi-async" instead of "target-async".
* gdb.mi/mi-nonstop-exit.exp: Likewise.
* gdb.mi/mi-nonstop.exp: Likewise.
* gdb.mi/mi-ns-stale-regcache.exp: Likewise.
* gdb.mi/mi-nsintrall.exp: Likewise.
* gdb.mi/mi-nsmoribund.exp: Likewise.
* gdb.mi/mi-nsthrexec.exp: Likewise.
* gdb.mi/mi-watch-nonstop.exp: Likewise.
* gdb.multi/watchpoint-multi.exp: Adjust comment.
* gdb.python/py-evsignal.exp: Don't enable target-async.
* gdb.python/py-evthreads.exp: Likewise.
* gdb.python/py-prompt.exp: Likewise.
* gdb.reverse/break-precsave.exp: Don't test with "target-async".
* gdb.server/solib-list.exp: Don't enable target-async.
* gdb.threads/thread-specific-bp.exp: Likewise.
* lib/mi-support.exp: Adjust to use mi-async.
|
|
I noticed that "list" behaves differently in CLI vs MI. Particularly:
$ ./gdb -nx -q ./testsuite/gdb.mi/mi-cli
Reading symbols from /home/pedro/gdb/mygit/build/gdb/testsuite/gdb.mi/mi-cli...done.
(gdb) start
Temporary breakpoint 1 at 0x40054d: file ../../../src/gdb/testsuite/gdb.mi/basics.c, line 62.
Starting program: /home/pedro/gdb/mygit/build/gdb/testsuite/gdb.mi/mi-cli
Temporary breakpoint 1, main () at ../../../src/gdb/testsuite/gdb.mi/basics.c:62
62 callee1 (2, "A string argument.", 3.5);
(gdb) list
57 {
58 }
59
60 main ()
61 {
62 callee1 (2, "A string argument.", 3.5);
63 callee1 (2, "A string argument.", 3.5);
64
65 do_nothing (); /* Hello, World! */
66
(gdb)
Note the list started at line 57. IOW, the program stopped at line
62, and GDB centered the list on that.
compare with:
$ ./gdb -nx -q ./testsuite/gdb.mi/mi-cli -i=mi
=thread-group-added,id="i1"
~"Reading symbols from /home/pedro/gdb/mygit/build/gdb/testsuite/gdb.mi/mi-cli..."
~"done.\n"
(gdb)
start
&"start\n"
...
~"\nTemporary breakpoint "
~"1, main () at ../../../src/gdb/testsuite/gdb.mi/basics.c:62\n"
~"62\t callee1 (2, \"A string argument.\", 3.5);\n"
*stopped,reason="breakpoint-hit",disp="del",bkptno="1",frame={addr="0x000000000040054d",func="main",args=[],file="../../../src/gdb/testsuite/gdb.mi/basics.c",fullname="/home/pedro/gdb/mygit/src/gdb/testsuite/gdb.mi/basics.c",line="62"},thread-id="1",stopped-threads="all",core="0"
=breakpoint-deleted,id="1"
(gdb)
-interpreter-exec console list
~"62\t callee1 (2, \"A string argument.\", 3.5);\n"
~"63\t callee1 (2, \"A string argument.\", 3.5);\n"
~"64\t\n"
~"65\t do_nothing (); /* Hello, World! */\n"
~"66\t\n"
~"67\t callme (1);\n"
~"68\t callme (2);\n"
~"69\t\n"
~"70\t return 0;\n"
~"71\t}\n"
^done
(gdb)
Here the list starts at line 62, where the program was stopped.
This happens because print_stack_frame, called from both normal_stop
and mi_on_normal_stop, is the function responsible for setting the
current sal from the selected frame, overrides the PRINT_WHAT
argument, and only after that does it decide whether to center the
current sal line or not, based on the overridden value, and it will
always decide false.
(The print_stack_frame call in mi_on_normal_stop is a little different
from the call in normal_stop, in that it is an unconditional
SRC_AND_LOC call. A future patch will make those uniform.)
A previous version of this patch made MI uniform with CLI here, by
making print_stack_frame also center when MI is active. That changed
the output of a "list" command in mi-cli.exp, to expect line 57
instead of 62, as per the example above.
However, looking deeper, that list in question is the first "list"
after the program stops, and right after the stop, before the "list",
the test did "set listsize 1". Let's try the same thing with the CLI:
(gdb) start
62 callee1 (2, "A string argument.", 3.5);
(gdb) set listsize 1
(gdb) list
57 {
Huh, that's unexpected. Why the 57? It's because print_stack_frame,
called in reaction to the breakpoint stop, expecting the next "list"
to show 10 lines (the listsize at the time) around line 62, sets the
lines listed range to 57-67 (62 +/- 5). If the user changes the
listsize before "list", why would we still show that range? Looks
bogus to me.
So the fix for this whole issue should be delay trying to center the
listing to until actually listing, so that the correct listsize can be
taken into account. This makes MI and CLI uniform too, as it deletes
the center code from print_stack_frame.
A series of tests are added to list.exp to cover this. mi-cli.exp was
after all correct all along, but it now gains an additional test that
lists lines with listsize 10, to ensure the centering is consistent
with CLI's.
One related Python test changed related output -- it's a test that
prints the line number after stopping for a breakpoint, similar to the
new list.exp tests. Previously we'd print the stop line minus 5 (due
to the premature centering), now we print the stop line. I think
that's a good change.
Tested on x86_64 Fedora 20.
gdb/
2014-05-21 Pedro Alves <palves@redhat.com>
* cli/cli-cmds.c (list_command): Handle the first "list" after the
current source line having changed.
* frame.h (set_current_sal_from_frame): Remove 'center' parameter.
* infrun.c (normal_stop): Adjust call to
set_current_sal_from_frame.
* source.c (clear_lines_listed_range): New function.
(set_current_source_symtab_and_line, identify_source_line): Clear
the lines listed range.
(line_info): Handle the first "info line" after the current source
line having changed.
* stack.c (print_stack_frame): Remove center handling.
(set_current_sal_from_frame): Remove 'center' parameter. Don't
center sal.line.
gdb/testsuite/
2014-05-21 Pedro Alves <palves@redhat.com>
* gdb.base/list.exp (build_pattern, test_list): New procedures.
Use them to test variations of "list" after reaching a breakpoint.
* gdb.mi/mi-cli.exp (line_main_callme_2): New global.
Test "list" with listsize 10 after reaching a breakpoint.
* gdb.python/python.exp (decode_line current location line
number): Adjust expected line number.
|
|
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.
|
|
gdb/testsuite/
* gdb.python/lib-types.exp: Fix test and xfail under gcc due to gcc/55641.
|
|
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.
|
|
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.
|
|
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.
|
|
NULL pointer.
testsuite/
* gdb.python/python.exp (python not supported): Verify multi-line
python command issues an error.
|
|
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.
|
|
* 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.
|
|
* gdb.python/py-framefilter.exp: Fix typo.
|
|
* 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.
|
|
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.
|
|
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.
|
|
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
|
|
gdb/testsuite/ChangeLog:
* gdb.python/py-pp-integral.exp: Remove path from "source" test.
|
|
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.
|
|
|
|
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.
|
|
* 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.
|
|
* 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.
|
|
|
|
|
|
|