Commit Graph

90260 Commits

Author SHA1 Message Date
Rainer Orth
a1cc26f6c3 Fix tui compilation with Solaris libcurses: non-const last arg to mvwaddstr (PR tui/21482) 2017-05-19 14:01:50 +02:00
Eli Zaretskii
958d57d02d Avoid MinGW compilation warning in readline/input.c
This change was already accepted upstream in Readline.

readline/ChangeLog.gdb:

2017-05-19  Eli Zaretskii  <eliz@gnu.org>

	* input.c [_WIN32]: Include <conio.h> to avoid compiler warning on
	MinGW.

(cherry picked from commit 50e1d299ef)
2017-05-19 11:08:19 +03:00
Eli Zaretskii
db9a604024 Avoid compiler warning in MinGW build
gdb:

2017-05-13  Eli Zaretskii  <eliz@gnu.org>

	* tui/tui.c (tui_enable): Cast "unknown" to 'char *' to avoid a
	C++ compiler warning.

(cherry picked from commit adf3dde510)
2017-05-19 10:58:52 +03:00
GDB Administrator
d75154f33d Automatic date update in version.in 2017-05-19 00:01:06 +00:00
Thomas Preud'homme
f864c7e853 Expect prompt after no FPU warning
2017-05-18  Thomas Preud'homme  <thomas.preudhomme@arm.com>

gdb/testsuite/
	* gdb.base/float.exp: Expect GDB prompt for targets without FPU.
2017-05-18 16:44:25 +01:00
GDB Administrator
c00cbd93ff Automatic date update in version.in 2017-05-18 00:01:49 +00:00
Yao Qi
efaba6bc8f Add alias command to cmd_list_element
When we add alias command, we call add_alias_cmd and pass the alias name
and command name.  This implicitly requires the command and its prefix
commands are already added to cmdlist.  This may not be true, for example,

  add_com_alias ("tty", "set inferior-tty", class_alias, 0);

"inferior-tty" command is added to setlist, but setlist may not be added
to cmdlist (It depends on the order of related _initialize_XXX functions
called) so that we can't find "set inferior-tty" from cmdlist.

This patch fixes this problem by passing cmd_list_element of "inferior-tty"
to add_alias_cmd, so that cmd_list_element of "inferior-tty" doesn't have
to be reachable from cmdlist at that moment.

gdb:

2017-05-17  Yao Qi  <yao.qi@linaro.org>

	* cli/cli-decode.c (add_alias_cmd): New function.
	* command.h (add_alias_cmd): Declare.
	* infcmd.c (_initialize_infcmd): Don't call add_com_alias,
	instead call add_alias_cmd.

gdb/testsuite:

2017-05-17  Simon Marchi  <simon.marchi@ericsson.com>

	* gdb.base/set-inferior-tty.exp (test_set_inferior_tty): Add
	argument command.
	(top-level): Invoke test_set_inferior_tty.
2017-05-17 14:24:57 +01:00
Tom Tromey
69e9e8a0d5 Avoid exponential behavior in rust_evaluate_subexp
The STRUCTOP_STRUCT case in rust_evaluate_subexp would evaluate its
LHS, and then, if it did not need Rust-specific treatment, it would
back up and re-evaluate the entire STRUCTOP_STRUCT part of the
expression using evaluate_subexp_standard.  This yields exponential
behavior and causes some expressions to evaluate extremely slowly.

The fix is to simply do the needed work inline.

This is PR rust/21483.

2017-05-12  Tom Tromey  <tom@tromey.com>

	PR rust/21483:
	* rust-lang.c (rust_evaluate_subexp) <STRUCTOP_STRUCT>: Don't
	recurse, just call value_struct_elt directly.
2017-05-16 22:53:20 -06:00
Tom Tromey
b6486c1f82 Fix rust_dump_subexp_body
rust_dump_subexp_body was not correct in a couple of cases.  While
debugging the bug I was really interested in, this caused a crash.
This patch fixes the problems.  No test case because, IIRC there
generally aren't tests for expression dumping.

2017-05-12  Tom Tromey  <tom@tromey.com>

	* rust-lang.c (rust_dump_subexp_body) <STRUCTOP_ANONYMOUS,
	OP_RUST_ARRAY>: Fix.
2017-05-16 22:53:19 -06:00
Tom Tromey
d05228c1bb Replace "return" with "break"
This replaces a "return" with a "break" in rust_print_subexp, for
consistency.

2017-05-12  Tom Tromey  <tom@tromey.com>

	* rust-lang.c (rust_print_subexp): Replace "return" with "break".
2017-05-16 22:53:19 -06:00
GDB Administrator
18c0a7cd22 Automatic date update in version.in 2017-05-17 00:01:16 +00:00
GDB Administrator
fb0fab03a5 Automatic date update in version.in 2017-05-16 00:01:04 +00:00
Rainer Orth
81aeac9bbd Fix gdb 8.0 procfs.c compilation on Solaris
Prompted by the creation of the gdb 8.0 branch, I tried to build it on
x86_64-pc-solaris2.12, but failed:

/vol/src/gnu/gdb/gdb-8.0-branch/local/gdb/procfs.c: In function `target_ops* procfs_target()':
/vol/src/gnu/gdb/gdb-8.0-branch/local/gdb/procfs.c:186:27: error: invalid conversion from `void (*)(target_ops*, char*, char*, char**, int)' to `void (*)(target_ops*, const char*, const string&, char**, int) {aka void (*)(target_ops*, const char*, const std::__cxx11::basic_string<char>&, char**, int)}' [-fpermissive]
   t->to_create_inferior = procfs_create_inferior;
                           ^~~~~~~~~~~~~~~~~~~~~~
/vol/src/gnu/gdb/gdb-8.0-branch/local/gdb/procfs.c: At global scope:
/vol/src/gnu/gdb/gdb-8.0-branch/local/gdb/procfs.c:125:13: warning: `void procfs_create_inferior(target_ops*, char*, char*, char**, int)' declared `static' but never defined [-Wunused-function]
 static void procfs_create_inferior (struct target_ops *, char *,
             ^~~~~~~~~~~~~~~~~~~~~~
/vol/src/gnu/gdb/gdb-8.0-branch/local/gdb/procfs.c:4529:1: warning: `void procfs_create_inferior(target_ops*, const char*, const string&, char**, int)' defined but not used [-Wunused-function]
 procfs_create_inferior (struct target_ops *ops, const char *exec_file,
 ^~~~~~~~~~~~~~~~~~~~~~

This can easily be fixed by the following patch.

	* procfs.c (procfs_create_inferior): Change prototype to match
	definition.
2017-05-15 14:36:06 +02:00
GDB Administrator
f35e662d82 Automatic date update in version.in 2017-05-15 00:01:03 +00:00
GDB Administrator
6aad91250d Automatic date update in version.in 2017-05-14 00:00:52 +00:00
GDB Administrator
bf10e6acf9 Automatic date update in version.in 2017-05-13 00:01:17 +00:00
GDB Administrator
c5d422588d Automatic date update in version.in 2017-05-12 00:01:13 +00:00
GDB Administrator
c11c7feaf3 Automatic date update in version.in 2017-05-11 00:01:11 +00:00
GDB Administrator
ecf4983a0f Automatic date update in version.in 2017-05-10 00:01:16 +00:00
GDB Administrator
d2556b2d60 Automatic date update in version.in 2017-05-09 00:01:09 +00:00
GDB Administrator
3b258c371f Automatic date update in version.in 2017-05-08 00:01:15 +00:00
GDB Administrator
3d3620493b Automatic date update in version.in 2017-05-07 00:01:14 +00:00
GDB Administrator
572a45ac68 Automatic date update in version.in 2017-05-06 00:01:19 +00:00
GDB Administrator
dd924a5f0f Automatic date update in version.in 2017-05-05 00:01:00 +00:00
Joel Brobecker
65ea01b592 Bump GDB version number to 7.99.91.DATE-git.
gdb/ChangeLog:

	* version.in: Set GDB version number to 7.99.91.DATE-git.
	* PROBLEMS: Likewise.
2017-05-04 12:37:28 -07:00
Joel Brobecker
a5a72f67fd Document the GDB 7.99.91 release in gdb/ChangeLog
gdb/ChangeLog:

	GDB 7.99.91 released.
2017-05-04 12:37:15 -07:00
Joel Brobecker
893df71e62 Set GDB version number to 7.99.91.
gdb/ChangeLog:

	* version.in: Set GDB version number to 7.99.91.
	* PROBLEMS: Likewise.
2017-05-04 12:20:31 -07:00
Joel Brobecker
6261be5615 gdb/NEWS: rewrite "since GDB 7.12" into "in GDB 8.0"
gdb/ChangeLog:

        * NEWS: Rename the "Changes since GDB 7.12" section into
        "Changes in GDB 8.0".
2017-05-04 12:15:48 -07:00
Pedro Alves
1332b4fa37 Fix gdb.python/py-record-btrace-threads.exp with Python 3
Fix several instances of:

 ...
 python print not f1calls
   File "<string>", line 1
     print not f1calls
		     ^
 SyntaxError: Missing parentheses in call to 'print'
 Error while executing Python code.
 (gdb) FAIL: gdb.python/py-record-btrace-threads.exp: thread=1: checking thread 1: python print not f1calls
 ...

gdb/testsuite/ChangeLog:
2017-05-04  Pedro Alves  <palves@redhat.com>

	* gdb.python/py-record-btrace-threads.exp (check_insn_for_thread):
	Add parens to print call for Python 3.
2017-05-04 16:05:15 +01:00
Tim Wiederhake
ac7d85722a Python: Introduce gdb.Instruction class
This adds a generic instruction class to Python and has gdb.RecordInstruction
inherit from it.
2017-05-04 09:05:00 +02:00
Tim Wiederhake
5b2f026c0d Python: Move and rename gdb.BtraceFunction
Remove gdb.BtraceFunctionCall and replace by gdb.FunctionSegment.  Additionally,
rename prev_segment and next_segment to prev and next.
2017-05-04 09:05:00 +02:00
Tim Wiederhake
d76700e0a4 Python: Move and rename gdb.BtraceInstruction
Remove gdb.BtraceInstruction and replace by gdb.RecordInstruction.
2017-05-04 09:05:00 +02:00
Tim Wiederhake
7dce57d1b5 Python: Introduce gdb.RecordGap class
As discussed here: https://sourceware.org/ml/gdb-patches/2017-04/msg00157.html

A gap is not an instruction and it should not pretend to be one.
gdb.Record.instruction_history is now a list of gdb.RecordInstruction and
gdb.RecordGap objects.  This allows the user to deal with Gaps in the record
in a more sane way.
2017-05-04 09:05:00 +02:00
Tim Wiederhake
26597c93ac Python: Remove ptid from gdb.Record interface
As discussed here: https://sourceware.org/ml/gdb-patches/2017-04/msg00166.html
2017-05-04 09:05:00 +02:00
Tim Wiederhake
ee53a929a4 Python: Use correct ptid in btrace recording
The user would always get the instruction_history and function_call_history
objects of the current thread, not the thread for which the gdb.Record object
was created.

The attached testcase fails without this patch and passes with the patch.
2017-05-04 09:05:00 +02:00
Tim Wiederhake
d4c682630c Python: Fix indentation in py-record-btrace.c 2017-05-04 09:05:00 +02:00
GDB Administrator
80297efd14 Automatic date update in version.in 2017-05-04 00:01:29 +00:00
Keith Seitz
c2449d01b7 Make sure malloc is linked into gdb.cp/oranking.cc.
On some platforms, e.g., arm-eabi-none, we need to make certain that
malloc is linked into the program because the test suite uses function
calls requiring malloc:

(gdb) p foo101("abc")
evaluation of this expression requires the program to have a function "malloc".

gdb/testsuite/ChangeLog

	* gdb.cp/oranking.cc (dummy): New function to grab malloc.
	(main): Call it.
2017-05-03 12:40:01 -07:00
GDB Administrator
05e4d87859 Automatic date update in version.in 2017-05-03 00:01:08 +00:00
GDB Administrator
8b44d08f47 Automatic date update in version.in 2017-05-02 00:00:58 +00:00
GDB Administrator
712e80a004 Automatic date update in version.in 2017-05-01 00:01:00 +00:00
GDB Administrator
19a1ccea89 Automatic date update in version.in 2017-04-30 00:00:59 +00:00
GDB Administrator
e453f191a5 Automatic date update in version.in 2017-04-29 00:01:01 +00:00
Yao Qi
d41089194f Use ptid method lwp in mips_linux_new_thread
gdb:

2017-04-28  Yao Qi  <yao.qi@linaro.org>

	* mips-linux-nat.c (mips_linux_new_thread): Use ptid method
	lwp instead of ptid_get_lwp.
2017-04-28 09:53:43 +01:00
Yao Qi
c6767e625c [MIPS] Use lwpid from lwp_info instead of inferior_ptid
RAJESH reported that GDB gets "Couldn't write debug register: No such
process." on mips64 when GDB attaches to a multi threaded application.

Looks GDB nows PTRACE_GET_WATCH_REGS for inferior_ptid but
PTRACE_SET_WATCH_REGS for lwp->ptid, they may be different.

gdb:

2017-04-28  Yao Qi  <yao.qi@linaro.org>

	* mips-linux-nat.c (mips_linux_new_thread): Get lwpid from
	lwp_info instead of getting from inferior_ptid.
2017-04-28 09:36:37 +01:00
GDB Administrator
6f43fe1508 Automatic date update in version.in 2017-04-28 00:00:55 +00:00
Keith Seitz
16de50a5e2 Fix overload resolution involving rvalue references and cv qualifiers.
The following patch fixes several outstanding overload resolution problems
with rvalue references and cv qualifiers in the test suite. The tests for
these problems typically passed with one compiler version and failed with
another. This behavior occurs because of the ordering of the overloaded
functions in the debug info. So the first best match "won out" over the
a subsequent better match.

One of the bugs addressed by this patch is the failure of rank_one_type to
account for type equality of two overloads based on CV qualifiers.  This was
leading directly to problems evaluating rvalue reference overload quality,
but it is also highlighted in gdb.cp/oranking.exp, where two test KFAIL as
a result of this shortcoming.

I found the overload resolution code committed with the rvalue reference
patch (f9aeb8d49) needlessly over-complicated, and I have greatly simplified
it. This fixes some KFAILing tests in gdb.exp/rvalue-ref-overload.exp.

gdb/ChangeLog

	* gdbtypes.c (LVALUE_REFERENCE_TO_RVALUE_BINDING_BADNESS)
	DIFFERENT_REFERENCE_TYPE_BADNESS): Remove.
	(CV_CONVERSION_BADNESS): Define.
	(rank_one_type): Remove overly restrictive rvalue reference
	rank checks.
	Add cv-qualifier checks and subranks for type equality.
	* gdbtypes.h (REFERENCE_CONVERSION_RVALUE,
	REFERENCE_CONVERSION_CONST_LVALUE, CV_CONVERSION_BADNESS,
	CV_CONVERSION_CONST, CV_CONVERSION_VOLATILE): Declare.

gdb/testsuite/ChangeLog

	* gdb.cp/oranking.cc (test15): New function.
	(main): Call test15 and declare additional variables for testing.
	* gdb.cp/oranking.exp: Remove kfail status for "p foo4(&a)" and
	"p foo101('abc')" tests.
	* gdb.cp/rvalue-ref-overloads.exp: Remove kfail status for
	"lvalue reference overload" test.
	* gdb.cp/rvalue-ref-params.exp: Remove kfail status for
	"print value of f1 on Child&& in f2" test.
2017-04-27 16:04:33 -07:00
Simon Marchi
9b81aa9a8b Add missing incref when creating Inferior Python object
The test py-inferior.exp fails when using a debug build of Python 3.6.  I don't
see it failing with my system's default Python, but it might be related to the
different memory allocation scheme used when doing a build with pydebug.

The issue is that we are missing a Py_INCREF in
inferior_to_inferior_object.  The PyObject_New function initializes the
object with a refcount of 1.  If we assume that this refcount
corresponds to the reference we are returning, then we are missing an
incref for the reference in the inferior data.

The counterpart for the incref that corresponds to the reference in the
inferior data is in py_free_inferior, in the form the gdbpy_ref instance.

Here's how I can get it to crash (with some debug output):

  $ ./gdb -nx -ex "set debug python 1"
  (gdb) add-inferior
  Added inferior 2
  (gdb) python infs = gdb.inferiors()
  Creating Python Inferior object inf = 1
  Creating Python Inferior object inf = 2
  (gdb) remove-inferiors 2
  py_free_inferior inf = 2
  infpy_dealloc inf = <unknown>
  (gdb) python infs = None
  Fatal Python error: Objects/tupleobject.c:243 object at 0x7f9cf1a568d8 has negative ref count -1

  Current thread 0x00007f9cf1b68780 (most recent call first):
    File "<string>", line 1 in <module>
  [1]    408 abort (core dumped)  ./gdb -nx -ex "set debug python 1"

After having created the inferiors object, their refcount is 1 (which
comes from PyObject_New), but it should be two.  The gdb inferior object
has a reference and the "infs" list has a reference.

When invoking remove-inferiors, py_free_inferior gets called.  It does
the decref that corresponds to the reference that the gdb inferior
object kept.  At this moment, the refcount drops to 0 and the object
gets deallocated, even though the "infs" list still has a reference.
When we set "infs" to None, Python tries to decref the already zero
refcount and the assert triggers.

With this patch, it looks better:

  (gdb) add-inferior
  Added inferior 2
  (gdb) python infs = gdb.inferiors()
  Creating Python Inferior object inf = 1
  Creating Python Inferior object inf = 2
  (gdb) remove-inferiors 2
  py_free_inferior inf = 2
  (gdb) python infs = None
  infpy_dealloc inf = <unknown>

gdb/ChangeLog:

	* python/py-inferior.c (inferior_to_inferior_object): Increment reference
	count when creating the object.
2017-04-27 17:06:30 -04:00
GDB Administrator
f99ef213bc Automatic date update in version.in 2017-04-27 00:01:22 +00:00
GDB Administrator
597a1845d1 Automatic date update in version.in 2017-04-26 00:00:58 +00:00