Compare commits

...

151 Commits

Author SHA1 Message Date
Joel Brobecker
41d82368c3 Set GDB version number to 7.11.1.
gdb/ChangeLog:

	* version.in: Set GDB version number to 7.11.1.
2016-05-31 17:36:16 -07:00
GDB Administrator
a70e2b5231 Automatic date update in version.in 2016-06-01 00:00:44 +00:00
GDB Administrator
333cacb483 Automatic date update in version.in 2016-05-31 00:00:33 +00:00
GDB Administrator
00d6f16a18 Automatic date update in version.in 2016-05-30 00:00:33 +00:00
GDB Administrator
7cb67a322b Automatic date update in version.in 2016-05-29 00:00:41 +00:00
GDB Administrator
8ce0a6f81d Automatic date update in version.in 2016-05-28 00:00:36 +00:00
GDB Administrator
b450bfa82e Automatic date update in version.in 2016-05-27 00:00:39 +00:00
GDB Administrator
53b26facdd Automatic date update in version.in 2016-05-26 00:00:38 +00:00
Pedro Alves
136613ef0c Fix PR gdb/19828: gdb -p <process from a container>: internal error
When GDB attaches to a process, it looks at the /proc/PID/task/ dir
for all clone threads of that process, and attaches to each of them.

Usually, if there is more than one clone thread, it means the program
is multi threaded and linked with pthreads.  Thus when GDB soon after
attaching finds and loads a libthread_db matching the process, it'll
add a thread to the thread list for each of the initially found
lower-level LWPs.

If, however, GDB fails to find/load a matching libthread_db, nothing
is adding the LWPs to the thread list.  And because of that, "detach"
hits an internal error:

  (gdb) PASS: gdb.threads/clone-attach-detach.exp: fg attach 1: attach
  info threads
    Id   Target Id         Frame
  * 1    LWP 6891 "clone-attach-de" 0x00007f87e5fd0790 in __nanosleep_nocancel () at ../sysdeps/unix/syscall-template.S:84
  (gdb) FAIL: gdb.threads/clone-attach-detach.exp: fg attach 1: info threads shows two LWPs
  detach
  .../src/gdb/thread.c:1010: internal-error: is_executing: Assertion `tp' failed.
  A problem internal to GDB has been detected,
  further debugging may prove unreliable.
  Quit this debugging session? (y or n)
  FAIL: gdb.threads/clone-attach-detach.exp: fg attach 1: detach (GDB internal error)

From here:

  ...
  #8  0x00000000007ba7cc in internal_error (file=0x98ea68 ".../src/gdb/thread.c", line=1010, fmt=0x98ea30 "%s: Assertion `%s' failed.")
      at .../src/gdb/common/errors.c:55
  #9  0x000000000064bb83 in is_executing (ptid=...) at .../src/gdb/thread.c:1010
  #10 0x00000000004c23bb in get_pending_status (lp=0x12c5cc0, status=0x7fffffffdc0c) at .../src/gdb/linux-nat.c:1235
  #11 0x00000000004c2738 in detach_callback (lp=0x12c5cc0, data=0x0) at .../src/gdb/linux-nat.c:1317
  #12 0x00000000004c1a2a in iterate_over_lwps (filter=..., callback=0x4c2599 <detach_callback>, data=0x0) at .../src/gdb/linux-nat.c:899
  #13 0x00000000004c295c in linux_nat_detach (ops=0xe7bd30, args=0x0, from_tty=1) at .../src/gdb/linux-nat.c:1358
  #14 0x000000000068284d in delegate_detach (self=0xe7bd30, arg1=0x0, arg2=1) at .../src/gdb/target-delegates.c:34
  #15 0x0000000000694141 in target_detach (args=0x0, from_tty=1) at .../src/gdb/target.c:2241
  #16 0x0000000000630582 in detach_command (args=0x0, from_tty=1) at .../src/gdb/infcmd.c:2975
  ...

Tested on x86-64 Fedora 23.  Also confirmed the test passes against
gdbserver with "maint set target-non-stop".

Unfortunately, making GDB add LWPs to the thread list sooner exposes
inefficiencies that in turn result in
gdb.threads/attach-many-short-lived-threads.exp timing out frequently.
Since that testcase is really a contrived use case designed to stress
some aspects of attach/detach and thread listing, not really
representative of real programs, this commit disables the test.

gdb/ChangeLog:
2016-05-25  Pedro Alves  <palves@redhat.com>

	PR gdb/19828
	* linux-nat.c (attach_proc_task_lwp_callback): Mark the lwp
	resumed, and add the thread to GDB's thread list.

testsuite/ChangeLog:
2016-05-25  Pedro Alves  <palves@redhat.com>

	PR gdb/19828
	* gdb.threads/clone-attach-detach.c: New file.
	* gdb.threads/clone-attach-detach.exp: New file.
	* gdb.threads/attach-many-short-lived-threads.exp: Skip.
2016-05-25 18:35:09 +01:00
Pedro Alves
a0de87e7be Make gdb/linux-nat.c consider a waitstatus pending on the infrun side
Working on the fix for gdb/19828, I saw
gdb.threads/attach-many-short-lived-threads.exp fail once in an
unusual way.  Unfortunately I didn't keep debug logs, but it's an
issue similar to what's been fixed in remote.c a while ago --
linux-nat.c was not fetching the pending status from the right place.

gdb/ChangeLog:
2016-05-25  Pedro Alves  <palves@redhat.com>

	PR gdb/19828
	* linux-nat.c (get_pending_status): If the thread reported the
	event to the core and it's pending, use the pending status signal
	number.
2016-05-25 18:35:09 +01:00
GDB Administrator
92e1921256 Automatic date update in version.in 2016-05-25 00:00:37 +00:00
GDB Administrator
079f7d434d Automatic date update in version.in 2016-05-24 00:00:35 +00:00
GDB Administrator
8fb059f570 Automatic date update in version.in 2016-05-23 00:00:42 +00:00
GDB Administrator
fc21d77733 Automatic date update in version.in 2016-05-22 00:00:40 +00:00
GDB Administrator
2838ada635 Automatic date update in version.in 2016-05-21 00:00:49 +00:00
GDB Administrator
f4188a7879 Automatic date update in version.in 2016-05-20 00:00:35 +00:00
GDB Administrator
edf01670a6 Automatic date update in version.in 2016-05-19 00:00:34 +00:00
Simon Marchi
cf2cd51217 Add mi-threads-interrupt.exp test (PR 20039)
Add a new test for PR 20039.  The test spawns new threads, then tries to
interrupt, continue, and interrupt again.  This use case was fixed by
commit 5fe966540d in master, but gdb 7.11
is affected (so if you try it on the gdb-7.11-branch right now, the test
will fail).

New in v2, the test now handles mi-async on mode properly.  The failure
was specific to mi-async off, but I don't think it's bad to test the
same thing under async on mode.  I added a little hack when running in
async mode to work around bug 20045.

I also removed one continue/interrupt pair, as a single one was enough to
trigger the problem.

gdb/testsuite/ChangeLog:

	* gdb.mi/mi-threads-interrupt.c: New file.
	* gdb.mi/mi-threads-interrupt.exp: New file.
2016-05-18 10:19:10 -04:00
Simon Marchi
f0a8d0dc70 Fix double prompt output after run control MI commands with mi-async on (PR 20045)
When you use a run control command (-exec-run, -exec-continue,
-exec-next, ...) with mi-async on, an extra (gdb) prompt is displayed:

  -exec-continue
  ^running
  *running,thread-id="all"
  (gdb)
  (gdb)

It doesn't seem to be a big problem for front-ends, since this behavior
started in gdb 7.9 and we haven't heard anything about that.  However,
it caused me some trouble while writing a test for PR 20039 [1].

The problem comes from an extra (gdb) prompt that we write when running
in mi-async off mode to emulate a past buggy behavior.  When executing a
run control command synchronously, previous gdbs always printed a prompt
right away, even though they are not ready to accept new MI commands
until the target stops.  Only at this time should they display a prompt.
But to keep backwards compatibility apparently, we print it anyway.
Since commit 198297aaf, the condition that decides whether we should
print that "bogus" prompt or not has become true, even when running with
mi-async on.  Since we already print a prompt at the end of the
asynchronous command execution, it results in two prompts for one
command.

The proposed fix is to call target_can_async_p instead of
target_is_async_p, to make the condition:

  if (!target_can_async_p () || sync_execution)
    ... show prompt ...

That shows the prompt if we are emulating a synchronous command on top
of an asynchronous target (sync_execution) or if the target simply can't
run asynchronously (!target_can_async_p ()).

Note that this code is changed and this bug fixed by Pedro's separate
console series, but I think it would be nice to have it fixed in the
mean time.

I ran the gdb.mi directory of the testsuite with mi-async on and off, I
didn't see any regressions.

gdb/ChangeLog:

	* mi/mi-main.c (mi_on_resume): Call target_can_async_p instead
	of target_is_async_p.

[1] https://sourceware.org/ml/gdb-patches/2016-05/msg00075.html
2016-05-18 10:19:09 -04:00
GDB Administrator
2ef476ed0a Automatic date update in version.in 2016-05-18 00:00:40 +00:00
Simon Marchi
b5f0db46b3 Fix -exec-run not running asynchronously with mi-async on (PR gdb/18077)
When doing -exec-run on a freshly started GDB, the only target on the
target stack at the time the dummy one.  When mi_async_p is called to
know whether the run should be async, it queries whether the current
target (dummy) supports async, and the answer is no.  The fix is to make
the code query the target that will be used for the run, which is not
necessarily the current target.

No regressions in the gdb.mi directory using the unix, native-gdbserver
and native-extended-gdbserver boards.  The test doesn't pass when
forcing maint set target-async off, obviously, since it makes mi-async
have no effect.  It doesn't seem like other tests are checking for that
eventuality, so I didn't in the new test.

gdb/ChangeLog:

	* mi/mi-main.c (run_one_inferior): Use run target to determine
	whether to run async or not.
	(mi_cmd_exec_run): Likewise.

gdb/testsuite/ChangeLog:

	* gdb.mi/mi-async-run.exp: New file.
	* gdb.mi/mi-async-run.c: New file.
2016-05-17 16:58:19 -04:00
GDB Administrator
bffe67e8c0 Automatic date update in version.in 2016-05-17 00:00:35 +00:00
Pedro Alves
7f8e34d860 Use target_terminal_ours_for_output in MI
The MI code only does output, so leave raw/cooked mode alone, as well
as the SIGINT handler.  Restore terminal settings after output, while
at it.  Also, a couple events missed calling target_terminal_ours
before output, even.

[Backported to the 7.11 branch by Simon Marchi, as it fixes PR 20039.]

gdb/ChangeLog:
YYYY-MM-DD  Pedro Alves  <palves@redhat.com>

	* mi/mi-interp.c (mi_new_thread): Put
	target_terminal_ours_for_output in effect while outputting.
	(mi_thread_exit): Use target_terminal_ours_for_output instead of
	target_terminal_ours.
	(mi_record_changed, mi_inferior_added, mi_inferior_appeared)
	(mi_inferior_exit, mi_inferior_removed, mi_traceframe_changed)
	(mi_tsv_created, mi_tsv_deleted, mi_tsv_modified)
	(mi_breakpoint_created, mi_breakpoint_deleted)
	(mi_breakpoint_modified, mi_solib_loaded, mi_solib_unloaded)
	(mi_command_param_changed, mi_memory_changed)
	(report_initial_inferior): Use target_terminal_ours_for_output
	instead of target_terminal_ours.  Restore terminal settings.
	* mi/mi-main.c (mi_execute_command): Use
	target_terminal_ours_for_output instead of target_terminal_ours.
	Restore terminal settings.
2016-05-16 17:02:35 -04:00
GDB Administrator
d38ce6a68f Automatic date update in version.in 2016-05-16 00:00:33 +00:00
GDB Administrator
919bc2384a Automatic date update in version.in 2016-05-15 00:00:35 +00:00
GDB Administrator
d85af00da6 Automatic date update in version.in 2016-05-14 00:00:33 +00:00
GDB Administrator
5f12f92452 Automatic date update in version.in 2016-05-13 00:00:30 +00:00
GDB Administrator
ca445d4820 Automatic date update in version.in 2016-05-12 00:00:37 +00:00
GDB Administrator
1a982b689c Automatic date update in version.in 2016-05-11 00:00:40 +00:00
GDB Administrator
74e2db3c52 Automatic date update in version.in 2016-05-10 00:00:46 +00:00
GDB Administrator
8bc1de549e Automatic date update in version.in 2016-05-09 00:00:41 +00:00
GDB Administrator
46b8da737e Automatic date update in version.in 2016-05-08 00:00:43 +00:00
GDB Administrator
c6b1e09111 Automatic date update in version.in 2016-05-07 00:00:42 +00:00
GDB Administrator
3175901324 Automatic date update in version.in 2016-05-06 00:00:39 +00:00
GDB Administrator
82e0aa86a9 Automatic date update in version.in 2016-05-05 00:00:50 +00:00
GDB Administrator
85b7329cbf Automatic date update in version.in 2016-05-04 00:00:43 +00:00
Pedro Alves
329dec6fc5 Fix gdb/python/python.c use-after-free
Valgrind shows:

 ==26964== Invalid read of size 1
 ==26964==    at 0x6E14100: __GI_strcmp (strcmp.S:180)
 ==26964==    by 0x6DB55AA: setlocale (setlocale.c:238)
 ==26964==    by 0x4E0455: _initialize_python() (python.c:1731)
 ==26964==    by 0x786731: initialize_all_files() (init.c:319)
 ==26964==    by 0x72EF0A: gdb_init(char*) (top.c:1929)
 ==26964==    by 0x60BCAC: captured_main(void*) (main.c:863)
 ==26964==    by 0x606AD5: catch_errors(int (*)(void*), void*, char*, return_mask) (exceptions.c:234)
 ==26964==    by 0x60C608: gdb_main(captured_main_args*) (main.c:1165)
 ==26964==    by 0x40CAEC: main (gdb.c:32)
 ==26964==  Address 0x81d30a0 is 0 bytes inside a block of size 181 free'd
 ==26964==    at 0x4C29CF0: free (vg_replace_malloc.c:530)
 ==26964==    by 0x6DB5B65: setname (setlocale.c:201)
 ==26964==    by 0x6DB5B65: setlocale (setlocale.c:388)
 ==26964==    by 0x4E037F: _initialize_python() (python.c:1712)
 ==26964==    by 0x786731: initialize_all_files() (init.c:319)
 ==26964==    by 0x72EF0A: gdb_init(char*) (top.c:1929)
 ==26964==    by 0x60BCAC: captured_main(void*) (main.c:863)
 ==26964==    by 0x606AD5: catch_errors(int (*)(void*), void*, char*, return_mask) (exceptions.c:234)
 ==26964==    by 0x60C608: gdb_main(captured_main_args*) (main.c:1165)
 ==26964==    by 0x40CAEC: main (gdb.c:32)

The problem is doing this:

  oldloc = setlocale (LC_ALL, NULL);
  setlocale (LC_ALL, "");
  ...
  setlocale (LC_ALL, oldloc);

I.e., the second setlocale call frees 'oldloc'.

From http://pubs.opengroup.org/onlinepubs/9699919799/functions/setlocale.html :

 "The returned string pointer might be invalidated or the string
 content might be overwritten by a subsequent call to setlocale()."

gdb/ChangeLog:
2016-05-03  Pedro Alves <palves@redhat.com>

	PR python/20037
	* python/python.c (_initialize_python) [IS_PY3K]: xstrdup/xfree
	oldloc.
2016-05-03 12:18:51 +01:00
Pedro Alves
aaa3178dfb Remove gdb/python/python.c code that handles strlen failing with -1
This makes no sense -- strlen doesn't really ever fail with -1.

gdb/ChangeLog:
2016-05-03  Pedro Alves <palves@redhat.com>

	* python/python.c (_initialize_python) [IS_PY3K]: Remove dead
	code.
2016-05-03 12:18:50 +01:00
Kyrylo Tkachov
386c903485 [gdb] Fix -Wparentheses warnings
2016-05-03  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>

	* symfile.c (find_pc_overlay): Add braces to avoid -Wparentheses
	warning.
	(find_pc_mapped_section): Likewise.
	(list_overlays_command): Likewise.
2016-05-03 09:48:12 +01:00
GDB Administrator
56d916d008 Automatic date update in version.in 2016-05-03 00:00:39 +00:00
GDB Administrator
88d549dbba Automatic date update in version.in 2016-05-02 00:00:37 +00:00
GDB Administrator
4b8485e42f Automatic date update in version.in 2016-05-01 00:00:39 +00:00
GDB Administrator
f8ae9852db Automatic date update in version.in 2016-04-30 00:00:43 +00:00
GDB Administrator
6632574739 Automatic date update in version.in 2016-04-29 00:00:35 +00:00
GDB Administrator
8dd7634154 Automatic date update in version.in 2016-04-28 00:00:50 +00:00
Jan Kratochvil
a6ff23076f Workaround gdbserver<7.7 for setfs
With current FSF GDB HEAD and old FSF gdbserver I expected I could do:
	gdb -ex 'file target:/root/redhat/threadit' -ex 'target remote :1234'
(supplying that unsupported qXfer:exec-file:read by "file")
But that does not work because:
	Sending packet: $vFile:setfs:0#bf...Packet received: OK
	Packet vFile:setfs (hostio-setfs) is supported
	...
	Sending packet: $vFile:setfs:104#24...Packet received: OK
	"target:/root/redhat/threadit": could not open as an executable file: Invalid argument

GDB documentation says:
	The valid responses to Host I/O packets are:
	An empty response indicates that this operation is not recognized.

This "empty response" vs. "OK" was a bug in gdbserver < 7.7.  It was fixed by:
	commit e7f0d979dd
	Author: Yao Qi <yao@codesourcery.com>
	Date:   Tue Dec 10 21:59:20 2013 +0800
	    Fix a bug in matching notifications.
	Message-ID: <1386684626-11415-1-git-send-email-yao@codesourcery.com>
	https://sourceware.org/ml/gdb-patches/2013-12/msg00373.html
	2013-12-10  Yao Qi  <yao@codesourcery.com>
		* notif.c (handle_notif_ack): Return 0 if no notification
		matches.

with unpatched old FSF gdbserver and patched FSF GDB HEAD:
	gdb -ex 'file target:/root/redhat/threadit' -ex 'target remote :1234'
	Sending packet: $vFile:setfs:0#bf...Packet received: OK
	Packet vFile:setfs (hostio-setfs) is NOT supported
	...
	(gdb) info sharedlibrary
	From                To                  Syms Read   Shared Object Library
	0x00007ffff7ddbae0  0x00007ffff7df627a  Yes (*)     target:/lib64/ld-linux-x86-64.so.2
	0x00007ffff7bc48a0  0x00007ffff7bcf514  Yes (*)     target:/lib64/libpthread.so.0

gdb/ChangeLog
2016-04-27  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* remote.c (remote_start_remote): Detect PACKET_vFile_setfs.support.
2016-04-27 21:31:21 +02:00
GDB Administrator
476e70f3c8 Automatic date update in version.in 2016-04-27 00:00:38 +00:00
GDB Administrator
064b958634 Automatic date update in version.in 2016-04-26 00:00:39 +00:00
GDB Administrator
9b075d90e5 Automatic date update in version.in 2016-04-25 00:00:47 +00:00
GDB Administrator
492fb6e6f8 Automatic date update in version.in 2016-04-24 00:00:39 +00:00
GDB Administrator
8b52b7e83a Automatic date update in version.in 2016-04-23 00:00:42 +00:00
GDB Administrator
d6259c13dc Automatic date update in version.in 2016-04-22 00:00:42 +00:00
GDB Administrator
cdbc63eac7 Automatic date update in version.in 2016-04-21 00:00:40 +00:00
GDB Administrator
9f1296dc90 Automatic date update in version.in 2016-04-20 00:00:41 +00:00
GDB Administrator
8b871d3060 Automatic date update in version.in 2016-04-19 00:00:48 +00:00
GDB Administrator
e0a37db7ab Automatic date update in version.in 2016-04-18 00:00:40 +00:00
GDB Administrator
13c4107cef Automatic date update in version.in 2016-04-17 00:00:43 +00:00
GDB Administrator
03c6edc83c Automatic date update in version.in 2016-04-16 00:00:46 +00:00
Pedro Alves
da611eed9a MIPS/Linux: Also recognize TRAP_BRKPT and TRAP_HWBKPT
This makes the MIPS Linux backends recognize TRAP_BRKPT and
TRAP_HWBKPT in siginfo.si_code in addition to SI_KERNEL, since Linux
4.6 now reports the finer-grained si_code values too.

Refs:
 https://sourceware.org/ml/gdb-patches/2016-02/msg00756.html
 https://sourceware.org/ml/gdb-patches/2016-04/msg00090.html

On kernels that report SI_KERNEL (<= 4.5), we'll enter the "ambiguous"
path of save_stop_reason:

	  if (GDB_ARCH_IS_TRAP_BRKPT (siginfo.si_code)
	      && GDB_ARCH_IS_TRAP_HWBKPT (siginfo.si_code))
	    {
	      /* The si_code is ambiguous on this arch -- check debug
		 registers.  */
	      if (!check_stopped_by_watchpoint (lp))
		lp->stop_reason = TARGET_STOPPED_BY_SW_BREAKPOINT;
	    }

while on kernels that report the finer-grained si_code values (>= 4.6),
we'll enter the corresponding branches:

	  else if (GDB_ARCH_IS_TRAP_BRKPT (siginfo.si_code))
	    {
	    }
	  else if (GDB_ARCH_IS_TRAP_HWBKPT (siginfo.si_code))
	    {
	      ...

gdb/ChangeLog:
2016-04-15  Pedro Alves  <palves@redhat.com>

	* nat/linux-ptrace.h [__mips__] (GDB_ARCH_IS_TRAP_BRKPT): Also
	accept TRAP_BRKPT.
	 [__mips__] (GDB_ARCH_IS_TRAP_HWBKPT): Also accept TRAP_HWBKPT.
2016-04-16 00:06:03 +01:00
Pedro Alves
619f36aa00 Handle MIPS Linux SIGTRAP siginfo.si_code values
This unbreaks pending/delayed breakpoints handling, as well as
hardware watchpoints, on MIPS.

Ref: https://sourceware.org/ml/gdb-patches/2016-02/msg00681.html

The MIPS kernel reports SI_KERNEL for all kernel generated traps,
instead of TRAP_BRKPT / TRAP_HWBKPT, but GDB isn't aware of this.

Basically, this commit:

- Folds watchpoints logic into check_stopped_by_breakpoint, and
  renames it to save_stop_reason.

- Adds GDB_ARCH_IS_TRAP_HWBKPT.

- Makes MIPS set both GDB_ARCH_IS_TRAP_BRPT and
  GDB_ARCH_IS_TRAP_HWBKPT to SI_KERNEL.  In save_stop_reason, we
  handle the case of the same si_code returning true for both
  TRAP_BRPT and TRAP_HWBKPT by looking at what the debug registers
  say.

Tested on x86-64 Fedora 20, native and gdbserver.

gdb/ChangeLog:
2016-04-15  Pedro Alves  <palves@redhat.com>

	* linux-nat.c (save_sigtrap) Delete.
	(stop_wait_callback): Call save_stop_reason instead of
	save_sigtrap.
	(check_stopped_by_breakpoint): Rename to ...
	(save_stop_reason): ... this.  Bits of save_sigtrap folded here.
	Use GDB_ARCH_IS_TRAP_HWBKPT and handle ambiguous
	GDB_ARCH_IS_TRAP_BRKPT / GDB_ARCH_IS_TRAP_HWBKPT.  Factor out
	common code between the USE_SIGTRAP_SIGINFO and
	!USE_SIGTRAP_SIGINFO blocks.
	(linux_nat_filter_event): Call save_stop_reason instead of
	save_sigtrap.
	* nat/linux-ptrace.h: Check for both SI_KERNEL and TRAP_BRKPT
	si_code for MIPS.
	* nat/linux-ptrace.h: Fix "TRAP_HWBPT" typo in x86 table.  Add
	comments on MIPS behavior.
	(GDB_ARCH_IS_TRAP_HWBKPT): Define for all archs.

gdb/gdbserver/ChangeLog:
2016-04-15  Pedro Alves  <palves@redhat.com>

	* linux-low.c (check_stopped_by_breakpoint): Rename to ...
	(save_stop_reason): ... this.  Use GDB_ARCH_IS_TRAP_HWBKPT and
	handle ambiguous GDB_ARCH_IS_TRAP_BRKPT / GDB_ARCH_IS_TRAP_HWBKPT.
	Factor out common code between the USE_SIGTRAP_SIGINFO and
	!USE_SIGTRAP_SIGINFO blocks.
	(linux_low_filter_event): Call save_stop_reason instead of
	check_stopped_by_breakpoint and check_stopped_by_watchpoint.
	Update comments.
	(linux_wait_1): Update comments.
2016-04-16 00:05:03 +01:00
GDB Administrator
6bdefd8864 Automatic date update in version.in 2016-04-15 00:00:43 +00:00
GDB Administrator
ec46cd40d1 Automatic date update in version.in 2016-04-14 00:00:37 +00:00
Pedro Alves
6b9ef0d488 Fix PR remote/19840: gdb crashes on reverse-stepi
Reverse debugging against a remote target that does reverse debugging
itself (with the bs/bc packets) always trips on:

 (gdb) target remote localhost:...
 (gdb) reverse-stepi
 ../../gdb/target.c:602: internal-error: default_execution_direction: to_execution_direction must be implemented for reverse async

I missed adding a to_execution_direction method to remote.c in commit
3223143295 (Adds target_execution_direction to make record targets
support async mode), GDB 7.4 time.  Later, GDB 7.8 switched to
target-async on by default, making the regression user-visible by
default too.

Fix is simply to add the missing to_execution_direction implementation
to target remote.

Tested by Andi Kleen against Simics.

gdb/ChangeLog:
2016-04-13  Pedro Alves  <palves@redhat.com>

	PR remote/19840
	* remote.c (struct remote_state) <last_resume_exec_dir>: New
	field.
	(new_remote_state): Default last_resume_exec_dir to EXEC_FORWARD.
	(remote_open_1): Reset last_resume_exec_dir to EXEC_FORWARD.
	(remote_resume): Store the last execution direction.
	(remote_execution_direction): New function.
	(init_remote_ops): Install it as to_execution_direction target_ops
	method.
2016-04-13 14:34:55 +01:00
GDB Administrator
1ca6d92fb6 Automatic date update in version.in 2016-04-13 00:00:36 +00:00
GDB Administrator
d91f748146 Automatic date update in version.in 2016-04-12 00:00:36 +00:00
GDB Administrator
e275ae514e Automatic date update in version.in 2016-04-11 00:00:37 +00:00
GDB Administrator
8ec8126cde Automatic date update in version.in 2016-04-10 00:00:41 +00:00
GDB Administrator
d502ed3d7b Automatic date update in version.in 2016-04-09 00:00:44 +00:00
GDB Administrator
3290953abc Automatic date update in version.in 2016-04-08 00:00:41 +00:00
GDB Administrator
23e33df951 Automatic date update in version.in 2016-04-07 00:00:42 +00:00
GDB Administrator
fe516b1504 Automatic date update in version.in 2016-04-06 00:00:35 +00:00
GDB Administrator
6cc52a1950 Automatic date update in version.in 2016-04-05 00:00:40 +00:00
GDB Administrator
bf563723c3 Automatic date update in version.in 2016-04-04 00:00:37 +00:00
GDB Administrator
5460f86819 Automatic date update in version.in 2016-04-03 00:00:40 +00:00
GDB Administrator
60c3df5b9c Automatic date update in version.in 2016-04-02 00:00:41 +00:00
GDB Administrator
f2f5278372 Automatic date update in version.in 2016-04-01 00:00:45 +00:00
Pedro Alves
85af34ee02 Add regression test for PR gdb/19858 (JIT code registration on attach)
This test would fail without the previous gdb/jit.c fix:

  (gdb) attach 23031
  Attaching to program: .../build/gdb/testsuite/outputs/gdb.base/jit/jit-main, process 23031
  [...]
  207           WAIT_FOR_GDB; i = 0;  /* gdb break here 1 */
  (gdb) PASS: gdb.base/jit.exp: attach: one_jit_test-2: attach
  set var wait_for_gdb = 0
  (gdb) PASS: gdb.base/jit.exp: attach: one_jit_test-2: set var wait_for_gdb = 0
  info function ^jit_function
  All functions matching regular expression "^jit_function":
  (gdb) FAIL: gdb.base/jit.exp: attach: one_jit_test-2: info function ^jit_function

gdb/testsuite/ChangeLog:
2016-03-31  Pedro Alves  <palves@redhat.com>

	PR gdb/19858
	* gdb.base/jit-main.c: Include unistd.h.
	(ATTACH): Define to 0 if not already defined.
	(wait_for_gdb, mypid): New globals.
	(WAIT_FOR_GDB): New macro.
	(MAIN): Set an alarm.  Store the process's pid.  Wait for GDB at
	some breakpoint locations.
	* gdb.base/jit.exp (clean_reattach, continue_to_test_location):
	New procedures.
	(one_jit_test): Add REATTACH parameter, and handle it.  Use
	continue_to_test_location.
	(top level): Test attach, and adjusts calls to one_jit_test.
2016-03-31 19:36:09 +01:00
Pedro Alves
89df5d6cce Make gdb.base/jit.exp binaries unique
This testcase compiles the same program and library differently
multiple times using the same file names.  Make them unique, to make
it easier to debug test problems.

gdb/testsuite/ChangeLog:
2016-03-31  Pedro Alves  <palves@redhat.com>

	PR gdb/19858
	* gdb.base/jit.exp (compile_jit_test): Add intro comment.  Add
	BINSUFFIX parameter, and handle it.
	(top level): Adjust calls compile_jit_test.
2016-03-31 19:36:08 +01:00
Yichao Yu
cd64cabb8c Fix PR gdb/19858: GDB doesn't register the JIT libraries on attach
Ref: https://sourceware.org/ml/gdb/2016-03/msg00023.html

GDB currently fails to fetch the list of already-registered JIT
modules on attach.

Nothing is calling jit_inferior_init, which is what is responsible for
walking the JIT object list at init time.

Despite the misleading naming, jit_inferior_created_hook ->
jit_inferior_init is only called when the inferior execs.

This regressed with the fix for PR gdb/13431 (03bef283c2):
 https://sourceware.org/ml/gdb-patches/2012-02/msg00023.html which
removed the inferior_created (jit_inferior_created_observer)
observer.

Adding an inferior_created observer back fixes the issue.

In turn, this exposes a bug in jit_breakpoint_re_set_internal as well,
which is returning the wrong result when we already have the
breakpoint at the right address.

gdb/ChangeLog:
2016-03-31  Yichao Yu  <yyc1992@gmail.com>

	PR gdb/19858
	* jit.c (jit_breakpoint_re_set_internal): Return 0 if we already
	got the breakpoint at the right address.
	(jit_inferior_created): New function.
	(_initialize_jit): Install jit_inferior_created as
	inferior_created observer.

Signed-off-by: Pedro Alves <palves@redhat.com>
2016-03-31 19:36:03 +01:00
GDB Administrator
f8210fb710 Automatic date update in version.in 2016-03-31 00:00:38 +00:00
GDB Administrator
dee3dbc902 Automatic date update in version.in 2016-03-30 00:00:38 +00:00
GDB Administrator
0b0edae68a Automatic date update in version.in 2016-03-29 00:00:43 +00:00
GDB Administrator
e571466b82 Automatic date update in version.in 2016-03-28 00:00:41 +00:00
GDB Administrator
a0d75692a1 Automatic date update in version.in 2016-03-27 00:00:41 +00:00
GDB Administrator
378b7e3879 Automatic date update in version.in 2016-03-26 00:00:46 +00:00
GDB Administrator
b33441714a Automatic date update in version.in 2016-03-25 00:00:41 +00:00
GDB Administrator
a87a0f8b2c Automatic date update in version.in 2016-03-24 00:00:49 +00:00
GDB Administrator
253b3b9547 Automatic date update in version.in 2016-03-23 00:00:44 +00:00
GDB Administrator
174d467379 Automatic date update in version.in 2016-03-22 00:00:35 +00:00
GDB Administrator
a608d6856a Automatic date update in version.in 2016-03-21 00:00:37 +00:00
GDB Administrator
288b250718 Automatic date update in version.in 2016-03-20 00:00:38 +00:00
GDB Administrator
ae850cee98 Automatic date update in version.in 2016-03-19 00:00:35 +00:00
GDB Administrator
f3e8a3a780 Automatic date update in version.in 2016-03-18 00:00:41 +00:00
Markus Metzger
2ef34d11f6 btrace: fix PR gdb/19829
This is a backport of

33b4777ca1 btrace, frame: fix crash in get_frame_type
a038fa3e14 stack: check frame_unwind_caller_id
2f3ef606b9 frame: add skip_tailcall_frames

In skip_artificial_frames we repeatedly call get_prev_frame_always until we get
a non-inline and non-tailcall frame assuming that there must be such a frame
eventually.

For record targets, however, we may have a frame chain that consists only of
artificial frames.  This leads to a crash in get_frame_type when dereferencing a
NULL frame pointer.

Change skip_artificial_frames and skip_tailcall_frames to return NULL in such a
case and modify each caller to cope with a NULL return.

In frame_unwind_caller_pc and frame_unwind_caller_arch, we simply assert that
the returned value is not NULL.  Their caller was supposed to check
frame_unwind_caller_id before calling those functions.

In other cases, we thrown an error.

In infcmd further move the skip_tailcall_frames call to the forward-stepping
case since we don't need a frame for reverse execution and we don't want to fail
because of that.  Reverse-finish does make sense for a tailcall frame.

gdb/
	* frame.h (skip_tailcall_frames): New.
	* infcmd.c (finish_command): Call skip_tailcall_frames.
	* frame.c (skip_artificial_frames): Return NULL if only artificial frames
	are found.  Update comment.
	(frame_pop): Call skip_tailcall_frames.
	(frame_unwind_caller_id): Handle NULL return.
	(frame_unwind_caller_pc, frame_unwind_caller_arch): Assert that
	skip_artificial_frames does not return NULL.
	(frame_pop): Add an error if only tailcall frames are found.
	* infcmd.c (finish_command): Move skip_tailcall_frames call into forward-
	execution case.  Add an error if only tailcall frames are found.
	* stack.c (frame_info): Check frame_unwind_caller_id.

testsuite/
	* gdb.btrace/tailcall-only.exp: New.
	* gdb.btrace/tailcall-only.c: New.
	* gdb.btrace/x86_64-tailcall-only.S: New.
	* gdb.btrace/i686-tailcall-only.S: New.
2016-03-17 11:48:49 +01:00
GDB Administrator
6c410d3b60 Automatic date update in version.in 2016-03-17 00:00:45 +00:00
GDB Administrator
b102e5372a Automatic date update in version.in 2016-03-16 00:00:42 +00:00
Pedro Alves
9312893c8d Fix PR gdb/19676: Internal error in linux-thread.db.c if /proc not mounted
If /proc is not mounted, GDB fails an assertion in find_new_threads_once:

 Continuing.
 .../src/gdb/linux-thread-db.c:1249: internal-error: find_new_threads_once: Assertion `!target_has_execution' failed.
 A problem internal to GDB has been detected,
 further debugging may prove unreliable.
 Quit this debugging session? (y or n)

That was supposed to catch misuses of td_ta_thr_iter, which is unsafe
for live debugging.  However, if /proc is not mounted, we still
fallback to using it.

I didn't bother with a warning, because GDB already prints several
others related to failing to open /proc files.

gdb/ChangeLog:
2016-03-15  Pedro Alves  <palves@redhat.com>

	PR gdb/19676
	* linux-thread-db.c (try_thread_db_load_1): Leave
	info->td_ta_thr_iter_p NULL iff debugging a live process and we
	have /proc access.
	(find_new_threads_once): Assert that we have a non-NULL
	info->td_ta_thr_iter_p instead of checking whether the target has
	execution.
2016-03-15 16:36:53 +00:00
Pedro Alves
4e57eb7028 Fix PR gdb/19676: Disable displaced stepping if /proc not mounted
On GNU/Linux archs that support displaced stepping, if /proc is not
mounted, GDB gets stuck not able to step past breakpoints:

 (gdb) c
 Continuing.
 dl_main (phdr=<optimized out>, phnum=<optimized out>, user_entry=<optimized out>, auxv=<optimized out>) at rtld.c:2163
 2163      LIBC_PROBE (init_complete, 2, LM_ID_BASE, r);
 Cannot find AT_ENTRY auxiliary vector entry.
 (gdb) c
 Continuing.
 dl_main (phdr=<optimized out>, phnum=<optimized out>, user_entry=<optimized out>, auxv=<optimized out>) at rtld.c:2163
 2163      LIBC_PROBE (init_complete, 2, LM_ID_BASE, r);
 Cannot find AT_ENTRY auxiliary vector entry.
 (gdb)

That's because GDB can't figure out where the scratch pad is.

This is a regression introduced by the earlier changes to make the
Linux native target always work in non-stop mode.

This commit makes GDB detect the case and fallback to stepping over
breakpoints in-line.

gdb/ChangeLog:
2016-03-15  Pedro Alves  <palves@redhat.com>

	PR gdb/19676
	* infrun.c (displaced_step_prepare): Also disable displaced
	stepping on NOT_SUPPORTED_ERROR.
	* linux-tdep.c (linux_displaced_step_location): If reading auxv
	fails, throw NOT_SUPPORTED_ERROR instead of generic error.
2016-03-15 16:36:46 +00:00
GDB Administrator
283c00efb7 Automatic date update in version.in 2016-03-15 00:00:43 +00:00
GDB Administrator
e061ed5b54 Automatic date update in version.in 2016-03-14 00:00:35 +00:00
GDB Administrator
bb11dc174e Automatic date update in version.in 2016-03-13 00:00:44 +00:00
GDB Administrator
516ff4a7dd Automatic date update in version.in 2016-03-12 00:00:37 +00:00
GDB Administrator
b3e987c24c Automatic date update in version.in 2016-03-11 00:00:39 +00:00
GDB Administrator
5883da401e Automatic date update in version.in 2016-03-10 00:00:39 +00:00
GDB Administrator
251a7aee76 Automatic date update in version.in 2016-03-09 00:00:34 +00:00
GDB Administrator
6d1f374b86 Automatic date update in version.in 2016-03-08 00:00:47 +00:00
GDB Administrator
5ec6069376 Automatic date update in version.in 2016-03-07 00:00:41 +00:00
GDB Administrator
051cabb732 Automatic date update in version.in 2016-03-06 00:00:39 +00:00
GDB Administrator
cd58937ca7 Automatic date update in version.in 2016-03-05 00:00:31 +00:00
GDB Administrator
cc22a0293f Automatic date update in version.in 2016-03-04 00:00:31 +00:00
GDB Administrator
6bdb373afe Automatic date update in version.in 2016-03-03 00:00:36 +00:00
GDB Administrator
fc5494cebb Automatic date update in version.in 2016-03-02 00:00:37 +00:00
GDB Administrator
17b5be823d Automatic date update in version.in 2016-03-01 00:00:57 +00:00
GDB Administrator
9afc053a96 Automatic date update in version.in 2016-02-29 00:00:57 +00:00
GDB Administrator
ff474daa69 Automatic date update in version.in 2016-02-28 00:00:59 +00:00
GDB Administrator
42d294de79 Automatic date update in version.in 2016-02-27 00:01:02 +00:00
GDB Administrator
08533595dc Automatic date update in version.in 2016-02-26 00:01:09 +00:00
GDB Administrator
4f80d1d126 Automatic date update in version.in 2016-02-25 00:01:02 +00:00
Joel Brobecker
63a034c19f Bump GDB version number to 7.11.0.DATE-git.
gdb/ChangeLog:

	* version.in: Set GDB version number to 7.11.0.DATE-git.
2016-02-24 11:19:36 +01:00
Joel Brobecker
cad15c35d5 Document the GDB 7.11 release in gdb/ChangeLog
gdb/ChangeLog:

	GDB 7.11 released.
2016-02-24 11:07:18 +01:00
Joel Brobecker
ac6c80b223 Set GDB version number to 7.11.
gdb/ChangeLog:

	* version.in: Set GDB version number to 7.11.
2016-02-24 10:55:16 +01:00
GDB Administrator
7996349ead Automatic date update in version.in 2016-02-24 00:01:02 +00:00
GDB Administrator
dee54a904b Automatic date update in version.in 2016-02-23 00:01:02 +00:00
Jan Kratochvil
3d58f89972 gdb-gdb.py: SyntaxError: Missing parentheses in call to 'print'
After building GDB
	--with-python=/usr/bin/python3
and for example stripping ./gdb and running:
	./gdb -data-directory data-directory/ -iex "add-auto-load-safe-path $PWD/gdb-gdb.gdb" -iex "add-auto-load-safe-path $PWD/gdb-gdb.
py" ./gdb
I get:
	Make breakpoint pending on future shared library load? (y or [n]) [answered N; input not from terminal]
	  File "/home/jkratoch/redhat/gdb-test-python3/gdb/gdb-gdb.py", line 91
	    print "Warning: Cannot find enum type_flag_value type."
								  ^
	SyntaxError: Missing parentheses in call to 'print'
	(top-gdb) q

gdb/ChangeLog
2016-02-22  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* gdb-gdb.py (class TypeFlagsPrinter): Use parentheses for print.
2016-02-22 17:18:35 +01:00
GDB Administrator
976b7aed19 Automatic date update in version.in 2016-02-22 00:00:35 +00:00
GDB Administrator
cf0091e0aa Automatic date update in version.in 2016-02-21 00:00:35 +00:00
GDB Administrator
a5d53b5c70 Automatic date update in version.in 2016-02-20 00:00:31 +00:00
GDB Administrator
d0729c5ff5 Automatic date update in version.in 2016-02-19 00:00:44 +00:00
GDB Administrator
c4e79d4f7a Automatic date update in version.in 2016-02-18 00:00:44 +00:00
GDB Administrator
fad83601a1 Automatic date update in version.in 2016-02-17 00:00:41 +00:00
Don Breazeal
e993d610a9 PR remote/19496, internal err forking-threads-plus-bkpt
This patch fixes an internal error that occurs in
gdb.threads/forking-threads-plus-breakpoint.exp:

/blah/binutils-gdb/gdb/target.c:2723: internal-error: Can't determine the
current address space of thread Thread 3170.3170

In default_thread_address_space, find_inferior_ptid couldn't find 3170.3170
because it had been overwritten in inferior_appeared, called as follows:

inferior_appeared
  remote_add_inferior
    remote_notice_new_inferior
      remote_update_thread_list

The cause of the problem was the following sequence of events:

* GDB knows only about the main thread

* the first fork event is reported to GDB, saved as pending_event

* qXfer:threads:read gets the threads from the remote.
  remove_new_fork_children id's the fork child from the pending event
  and removes it from the list reported to GDB.  All the rest of the
  threads, including the fork parent, are added to the GDB thread list.

* GDB stops all the threads.  All the stop events are pushed onto the
  stop reply queue behind the pending fork event.  The fork waitstatus
  is saved in the fork parent thread's pending status field
  thread_info.suspend.

* remote_wait_ns calls queued_stop_reply and process_stop_reply to
  remove the fork event from the front of the stop reply queue and save
  event information in the thread_info structure for the fork parent
  thread.  Unfortunately, none of the information saved in this way is
  the fork-specific information.

* A subsequent qXfer:threads:read packet gets the thread list including
  the fork parent and fork child.  remove_new_fork_children checks the
  thread list to see if there is a fork parent, doesn't find one, checks
  the stop reply queue for a pending fork event, doesn't find one, and
  allows the fork child thread to be reported to GDB before the fork
  event has been handled.  remote_update_thread_list calls
  remote_notice_new_thread and overwrites the current (main) thread in
  inferior_appeared.

So the fork event has been reported out of target_wait but it was left
pending on the infrun side (infrun.c:save_waitstatus).  IOW, the fork
event hasn't been processed by handle_inferior_event yet, so it hasn't
made it to tp->pending_follow yet.

The fix is to check thread_info.suspend along with the
thread_info.pending_follow in remote.c:remove_new_fork_children, to
prevent premature reporting of the fork child thread creation.

gdb/ChangeLog:

	PR remote/19496
	* remote.c (remove_new_fork_children): Check for pending
	fork status in thread_info.suspend.

gdb/testsuite/ChangeLog:

	PR remote/19496
	* gdb.threads/forking-threads-plus-breakpoint.exp (do_test):
	Remove kfail for PR remote/19496.
2016-02-16 09:18:34 -08:00
Yao Qi
523f1dab16 Fix cleanup in arm_linux_software_single_step
I see the following error in testing aarch64 GDB debugging arm
program.

(gdb) PASS: gdb.reverse/readv-reverse.exp: set breakpoint at marker2
continue
Continuing.
=================================================================
==32273==ERROR: AddressSanitizer: attempting free on address which was not malloc()-ed: 0x000000ce4c00 in thread T0
    #0 0x2ba5615645c7 in __interceptor_free (/usr/lib/x86_64-linux-gnu/libasan.so.1+0x545c7)^M
    #1 0x4be8b5 in VEC_CORE_ADDR_cleanup /home/yao/SourceCode/gnu/gdb/git/gdb/common/gdb_vecs.h:34^M
    #2 0x5e6d95 in do_my_cleanups /home/yao/SourceCode/gnu/gdb/git/gdb/common/cleanups.c:154^M
    #3 0x64c99a in fetch_inferior_event /home/yao/SourceCode/gnu/gdb/git/gdb/infrun.c:3975^M
    #4 0x678437 in inferior_event_handler /home/yao/SourceCode/gnu/gdb/git/gdb/inf-loop.c:44^M
    #5 0x5078f6 in remote_async_serial_handler /home/yao/SourceCode/gnu/gdb/git/gdb/remote.c:13223^M
    #6 0x4cecfd in run_async_handler_and_reschedule /home/yao/SourceCode/gnu/gdb/git/gdb/ser-base.c:137^M
    #7 0x676864 in gdb_wait_for_event /home/yao/SourceCode/gnu/gdb/git/gdb/event-loop.c:834^M
    #8 0x676a27 in gdb_do_one_event /home/yao/SourceCode/gnu/gdb/git/gdb/event-loop.c:323^M
    #9 0x676aed in start_event_loop /home/yao/SourceCode/gnu/gdb/git/gdb/event-loop.c:347^M
    #10 0x6706d2 in captured_command_loop /home/yao/SourceCode/gnu/gdb/git/gdb/main.c:318^M
    #11 0x66db8c in catch_errors /home/yao/SourceCode/gnu/gdb/git/gdb/exceptions.c:240^M
    #12 0x6716dd in captured_main /home/yao/SourceCode/gnu/gdb/git/gdb/main.c:1157^M
    #13 0x66db8c in catch_errors /home/yao/SourceCode/gnu/gdb/git/gdb/exceptions.c:240^M
    #14 0x671b7a in gdb_main /home/yao/SourceCode/gnu/gdb/git/gdb/main.c:1165^M
    #15 0x467684 in main /home/yao/SourceCode/gnu/gdb/git/gdb/gdb.c:32^M
    #16 0x2ba563ed7ec4 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21ec4)^M
    #17 0x4676b2 (/scratch/yao/gdb/build-git/aarch64-linux-gnu/gdb/gdb+0x4676b2)

looks we should discard cleanup if function
arm_linux_software_single_step returns early, or create cleanup when
it is needed.

gdb:

2016-02-16  Yao Qi  <yao.qi@linaro.org>

	* arm-linux-tdep.c (arm_linux_software_single_step): Assign
	'old_chain' later.
2016-02-16 13:56:41 +00:00
GDB Administrator
11b051fcc9 Automatic date update in version.in 2016-02-16 00:00:41 +00:00
Jan Kratochvil
906c69d06a Add missing gdb.arch/i386-prologue.c prototypes
The testfile has not ran because:
gdb.arch/i386-prologue.c:34:3: warning: implicit declaration of function 'standard' [-Wimplicit-function-declaration]
   standard ();
   ^
gdb.arch/i386-prologue.c:35:3: warning: implicit declaration of function 'stack_align_ecx' [-Wimplicit-function-declaration]
   stack_align_ecx ();
   ^
gdb.arch/i386-prologue.c:36:3: warning: implicit declaration of function 'stack_align_edx' [-Wimplicit-function-declaration]
   stack_align_edx ();
   ^
gdb.arch/i386-prologue.c:37:3: warning: implicit declaration of function 'stack_align_eax' [-Wimplicit-function-declaration]
   stack_align_eax ();
   ^

gdb/testsuite/ChangeLog
2016-02-15  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* gdb.arch/i386-prologue.c: Add missing prototypes.
2016-02-15 19:02:29 +01:00
Jan Kratochvil
8b6bd5aca6 Fix more testcases with standard_output_file.
Since
	commit 2151ccc56c
	Author: Simon Marchi <simon.marchi@ericsson.com>
	Date:   Mon Feb 8 14:02:36 2016 -0500
	    Always organize test artifacts in a directory hierarchy
these testfiles could not build.

gdb/testsuite/ChangeLog
2016-02-15  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* gdb.arch/i386-gnu-cfi.exp: Use standard_output_file.
	* gdb.arch/i386-prologue.exp: Likewise.
	* gdb.arch/i386-size.exp: Likewise.
2016-02-15 18:57:28 +01:00
Simon Marchi
2d059a33d8 i386-biarch-core.exp: Use standard_output_file
Fix the core file path to use the standard output directory.

gdb/testsuite/ChangeLog:

	* i386-biarch-core.exp: Define corefile using
	standard_output_file.
2016-02-15 11:15:42 -05:00
GDB Administrator
55afcfaf58 Automatic date update in version.in 2016-02-15 00:00:42 +00:00
Jan Kratochvil
46e42194d8 testsuite: Fix false Fortran regressions with recent gcc
gcc-4.9.2-6.fc21.x86_64 -> gcc-5.3.1-2.fc23.x86_64

-PASS: gdb.fortran/vla-ptype.exp: ptype pvla not initialized
+FAIL: gdb.fortran/vla-ptype.exp: ptype pvla not initialized
-PASS: gdb.fortran/vla-history.exp: print vla1 allocated
+FAIL: gdb.fortran/vla-history.exp: print vla1 allocated
-PASS: gdb.fortran/vla-history.exp: print $2
+FAIL: gdb.fortran/vla-history.exp: print $2
-PASS: gdb.fortran/vla-value.exp: print undefined pvla
+FAIL: gdb.fortran/vla-value.exp: print undefined pvla
-PASS: gdb.fortran/vla-value.exp: print non-associated &pvla
+FAIL: gdb.fortran/vla-value.exp: print non-associated &pvla
-PASS: gdb.fortran/vla-value.exp: print undefined pvla(1,3,8)
+FAIL: gdb.fortran/vla-value.exp: print undefined pvla(1,3,8)

These issues get fixed (or removed if no longer applicable) by attached patch.

It is based on Googled:
	http://www.cs.rpi.edu/~szymansk/OOF90/bugs.html#5
	When a pointer is declared its status is undefined, and cannot be
	safely queried with the associated intrinsic.
	-> nullify(VARNAME)
+
	https://software.intel.com/en-us/forums/intel-fortran-compiler-for-linux-and-mac-os-x/topic/268786
	ALLOCATE is not supposed to initialize the array.
	-> Remove checks like an initial print is: \\( *0, *0, *0...\\)

These regressions remain:
	-PASS: gdb.fortran/library-module.exp: print var_i in lib
	+FAIL: gdb.fortran/library-module.exp: print var_i in lib
	-PASS: gdb.fortran/library-module.exp: print var_i in main
	+FAIL: gdb.fortran/library-module.exp: print var_i in main
I believe it is more a GDB bug (in a code contributed by me), filed:
	gdb.fortran/library-module.exp false regression on GCC upgrade
	https://sourceware.org/bugzilla/show_bug.cgi?id=19635

gdb/testsuite/ChangeLog
2016-02-14  Jan Kratochvil  <jan.kratochvil@redhat.com>

	Fix compatibility with recent gfortran-5.3.1.
	* gdb.fortran/vla-history.exp (print vla1 allocated)
	(print vla2 allocated, print $2, print $3): Remove
	(print $4): Rename to ...
	(print $2): ... here.
	(print $9): Rename to ...
	(print $5): ... here.
	(print $10): Rename to ...
	(print $6): ... here.
	* gdb.fortran/vla.f90: Add pvla initialization.
2016-02-14 09:24:30 +01:00
Jan Kratochvil
307c2facb2 testsuite regression: gdb.fortran/vla-value-sub.exp gdb.fortran/vla-value-sub-finish.exp
> +static int max_value_size = 65536; /* 64k bytes */

FAIL: gdb.fortran/vla-value-sub.exp: print array2 in foo after it was filled (passed fixed array)
FAIL: gdb.fortran/vla-value-sub.exp: print array2 in foo after it was mofified in debugger (passed fixed array)
FAIL: gdb.fortran/vla-value-sub-finish.exp: print array2 in foo after it was filled
FAIL: gdb.fortran/vla-value-sub-finish.exp: print array2 in foo after it was mofified in debugger

print array2
value requires 296352 bytes, which is more than max-value-size
(gdb) FAIL: gdb.fortran/vla-value-sub.exp: print array2 in foo after it was filled (passed fixed array)

gdb/testsuite/ChangeLog
2016-02-14  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* gdb.fortran/vla-value-sub-finish.exp (set max-value-size 1024*1024):
	New test.
	* gdb.fortran/vla-value-sub.exp: Likewise.
2016-02-14 09:19:12 +01:00
GDB Administrator
a5bb7efba6 Automatic date update in version.in 2016-02-14 00:00:49 +00:00
GDB Administrator
ceb65faba4 Automatic date update in version.in 2016-02-13 00:00:39 +00:00
GDB Administrator
bfe7ecf8d9 Automatic date update in version.in 2016-02-12 00:00:34 +00:00
GDB Administrator
192b594e45 Automatic date update in version.in 2016-02-11 00:00:32 +00:00
Yao Qi
83d9e733ab Clear *VAL in regcache_raw_read_unsigned
We have function regcache_raw_read_unsigned defined in both GDB and
GDBserver, so that it is used in common like this,

  ULONGEST value;
  status = regcache_raw_read_unsigned (regcache, regnum, &value);

'value' is correctly set in GDB side, but may not be correctly set
in GDBserver, because &value is passed in regcache_raw_read_unsigned
but collect_register may only set part of the whole variable.  In my
test, I see the top half of 'value' is garbage.  This patch fixes this
problem by clearing *VAL before calling collect_register.

gdb/gdbserver:

2016-02-10  Yao Qi  <yao.qi@linaro.org>

	* regcache.c (regcache_raw_read_unsigned): Clear *VAL.
2016-02-10 16:43:02 +00:00
Joel Brobecker
7bcc056ca9 gdb/version.in: Replace -cvs suffix by -git suffix
gdb/ChangeLog:

        * version.in: Replace -cvs suffix by -git suffix.
2016-02-10 13:25:44 +04:00
Joel Brobecker
45e8913772 Bump GDB version number to 7.10.90.DATE-cvs.
gdb/ChangeLog:

	* version.in: Set GDB version number to 7.10.90.DATE-cvs.
2016-02-10 08:02:30 +04:00
Joel Brobecker
2f43accadf Document the GDB 7.10.90 release in gdb/ChangeLog
gdb/ChangeLog:

	GDB 7.10.90 released.
2016-02-10 08:02:11 +04:00
Joel Brobecker
8e1043a37a Set GDB version number to 7.10.90.
gdb/ChangeLog:

	* version.in: Set GDB version number to 7.10.90.
2016-02-10 07:54:06 +04:00
Joel Brobecker
4fd877f0a5 gdb/NEWS: Change "since GDB 7.10" -> "in GDB 7.11".
gdb/ChangeLog:

        * NEWS: Change "Changes since GDB version 7.10" into "Changes
        in GDB version 7.11".
2016-02-10 07:45:10 +04:00
Joel Brobecker
4ad0fc283c Set development mode to "off" by default.
bfd/ChangeLog:

	* development.sh (development): Set to false.
2016-02-10 07:20:30 +04:00
Joel Brobecker
d5d168eef1 Bump version to 7.10.90.DATE-git.
Now that the GDB 7.11 branch has been created, we can
bump the version number.

gdb/ChangeLog:

	GDB 7.11 branch created (9ef9e6a6a0):
	* version.in: Bump version to 7.10.90.DATE-git.
2016-02-10 07:20:11 +04:00
50 changed files with 2371 additions and 350 deletions

View File

@@ -1,3 +1,7 @@
2016-02-10 Joel Brobecker <brobecker@adacore.com>
* development.sh (development): Set to false.
2016-02-09 Nick Clifton <nickc@redhat.com>
* oasys.c (oasys_archive_p): Fix indentation.

View File

@@ -16,4 +16,4 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# Controls whether to enable development-mode features by default.
development=true
development=false

View File

@@ -1,4 +1,4 @@
#define BFD_VERSION_DATE 20160210
#define BFD_VERSION_DATE 20160601
#define BFD_VERSION @bfd_version@
#define BFD_VERSION_STRING @bfd_version_package@ @bfd_version_string@
#define REPORT_BUGS_TO @report_bugs_to@

View File

@@ -1,3 +1,207 @@
2016-06-01 Joel Brobecker <brobecker@adacore.com>
* version.in: Set GDB version number to 7.11.1.
2016-05-25 Pedro Alves <palves@redhat.com>
PR gdb/19828
* linux-nat.c (attach_proc_task_lwp_callback): Mark the lwp
resumed, and add the thread to GDB's thread list.
2016-05-25 Pedro Alves <palves@redhat.com>
PR gdb/19828
* linux-nat.c (get_pending_status): If the thread reported the
event to the core and it's pending, use the pending status signal
number.
2016-05-17 Simon Marchi <simon.marchi@ericsson.com>
PR gdb/20045
* mi/mi-main.c (mi_on_resume): Call target_can_async_p instead
of target_is_async_p.
2016-05-17 Simon Marchi <simon.marchi@ericsson.com>
PR gdb/18077
* mi/mi-main.c (run_one_inferior): Use run target to determine
whether to run async or not.
(mi_cmd_exec_run): Likewise.
2016-05-16 Pedro Alves <palves@redhat.com>
PR gdb/20039
* mi/mi-interp.c (mi_new_thread): Put
target_terminal_ours_for_output in effect while outputting.
(mi_thread_exit): Use target_terminal_ours_for_output instead of
target_terminal_ours.
(mi_record_changed, mi_inferior_added, mi_inferior_appeared)
(mi_inferior_exit, mi_inferior_removed, mi_traceframe_changed)
(mi_tsv_created, mi_tsv_deleted, mi_tsv_modified)
(mi_breakpoint_created, mi_breakpoint_deleted)
(mi_breakpoint_modified, mi_solib_loaded, mi_solib_unloaded)
(mi_command_param_changed, mi_memory_changed)
(report_initial_inferior): Use target_terminal_ours_for_output
instead of target_terminal_ours. Restore terminal settings.
* mi/mi-main.c (mi_execute_command): Use
target_terminal_ours_for_output instead of target_terminal_ours.
Restore terminal settings.
2016-05-03 Pedro Alves <palves@redhat.com>
PR python/20037
* python/python.c (_initialize_python) [IS_PY3K]: xstrdup/xfree
oldloc.
2016-05-03 Pedro Alves <palves@redhat.com>
* python/python.c (_initialize_python) [IS_PY3K]: Remove dead
code.
2016-05-03 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
* symfile.c (find_pc_overlay): Add braces to avoid -Wparentheses
warning.
(find_pc_mapped_section): Likewise.
(list_overlays_command): Likewise.
2016-04-27 Jan Kratochvil <jan.kratochvil@redhat.com>
* remote.c (remote_start_remote): Detect PACKET_vFile_setfs.support.
2016-04-15 Pedro Alves <palves@redhat.com>
* nat/linux-ptrace.h [__mips__] (GDB_ARCH_IS_TRAP_BRKPT): Also
accept TRAP_BRKPT.
[__mips__] (GDB_ARCH_IS_TRAP_HWBKPT): Also accept TRAP_HWBKPT.
2016-04-15 Pedro Alves <palves@redhat.com>
* linux-nat.c (save_sigtrap) Delete.
(stop_wait_callback): Call save_stop_reason instead of
save_sigtrap.
(check_stopped_by_breakpoint): Rename to ...
(save_stop_reason): ... this. Bits of save_sigtrap folded here.
Use GDB_ARCH_IS_TRAP_HWBKPT and handle ambiguous
GDB_ARCH_IS_TRAP_BRKPT / GDB_ARCH_IS_TRAP_HWBKPT. Factor out
common code between the USE_SIGTRAP_SIGINFO and
!USE_SIGTRAP_SIGINFO blocks.
(linux_nat_filter_event): Call save_stop_reason instead of
save_sigtrap.
* nat/linux-ptrace.h: Check for both SI_KERNEL and TRAP_BRKPT
si_code for MIPS.
* nat/linux-ptrace.h: Fix "TRAP_HWBPT" typo in x86 table. Add
comments on MIPS behavior.
(GDB_ARCH_IS_TRAP_HWBKPT): Define for all archs.
2016-04-13 Pedro Alves <palves@redhat.com>
PR remote/19840
* remote.c (struct remote_state) <last_resume_exec_dir>: New
field.
(new_remote_state): Default last_resume_exec_dir to EXEC_FORWARD.
(remote_open_1): Reset last_resume_exec_dir to EXEC_FORWARD.
(remote_resume): Store the last execution direction.
(remote_execution_direction): New function.
(init_remote_ops): Install it as to_execution_direction target_ops
method.
2016-03-31 Yichao Yu <yyc1992@gmail.com>
PR gdb/19858
* jit.c (jit_breakpoint_re_set_internal): Return 0 if we already
got the breakpoint at the right address.
(jit_inferior_created): New function.
(_initialize_jit): Install jit_inferior_created as
inferior_created observer.
2016-03-17 Markus Metzger <markus.t.metzger@intel.com>
PR gdb/19829
* frame.h (skip_tailcall_frames): New.
* infcmd.c (finish_command): Call skip_tailcall_frames.
* frame.c (skip_artificial_frames): Return NULL if only artificial
frames are found. Update comment.
(frame_pop): Call skip_tailcall_frames.
(frame_unwind_caller_id): Handle NULL return.
(frame_unwind_caller_pc, frame_unwind_caller_arch): Assert that
skip_artificial_frames does not return NULL.
(frame_pop): Add an error if only tailcall frames are found.
* infcmd.c (finish_command): Move skip_tailcall_frames call into
forward-execution case. Add an error if only tailcall frames are found.
* stack.c (frame_info): Check frame_unwind_caller_id.
2016-03-15 Pedro Alves <palves@redhat.com>
PR gdb/19676
* linux-thread-db.c (try_thread_db_load_1): Leave
info->td_ta_thr_iter_p NULL iff debugging a live process and we
have /proc access.
(find_new_threads_once): Assert that we have a non-NULL
info->td_ta_thr_iter_p instead of checking whether the target has
execution.
2016-03-15 Pedro Alves <palves@redhat.com>
PR gdb/19676
* infrun.c (displaced_step_prepare): Also disable displaced
stepping on NOT_SUPPORTED_ERROR.
* linux-tdep.c (linux_displaced_step_location): If reading auxv
fails, throw NOT_SUPPORTED_ERROR instead of generic error.
2016-02-24 Joel Brobecker <brobecker@adacore.com>
* version.in: Set GDB version number to 7.11.0.DATE-git.
2016-02-24 Joel Brobecker <brobecker@adacore.com>
GDB 7.11 released.
2016-02-24 Joel Brobecker <brobecker@adacore.com>
* version.in: Set GDB version number to 7.11.
2016-02-22 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb-gdb.py (class TypeFlagsPrinter): Use parentheses for print.
2016-02-16 Don Breazeal <donb@codesourcery.com>
PR remote/19496
* remote.c (remove_new_fork_children): Check for pending
fork status in thread_info.suspend.
2016-02-16 Yao Qi <yao.qi@linaro.org>
* arm-linux-tdep.c (arm_linux_software_single_step): Assign
'old_chain' later.
2016-02-10 Joel Brobecker <brobecker@adacore.com>
* version.in: Replace -cvs suffix by -git suffix.
2016-02-10 Joel Brobecker <brobecker@adacore.com>
* version.in: Set GDB version number to 7.10.90.DATE-cvs.
2016-02-10 Joel Brobecker <brobecker@adacore.com>
GDB 7.10.90 released.
2016-02-10 Joel Brobecker <brobecker@adacore.com>
* version.in: Set GDB version number to 7.10.90.
2016-02-10 Joel Brobecker <brobecker@adacore.com>
* NEWS: Change "Changes since GDB version 7.10" into "Changes
in GDB version 7.11".
2016-02-10 Joel Brobecker <brobecker@adacore.com>
GDB 7.11 branch created (9ef9e6a6a0dd8f948708cb67c9afcfd0be40cb0a):
* version.in: Bump version to 7.10.90.DATE-git.
2016-02-09 Keith Seitz <keiths@redhat.com>
PR breakpoints/19546

View File

@@ -1,7 +1,7 @@
What has changed in GDB?
(Organized release by release)
*** Changes since GDB 7.10
*** Changes in GDB 7.11
* GDB now supports debugging kernel-based threads on FreeBSD.

View File

@@ -933,13 +933,15 @@ arm_linux_software_single_step (struct frame_info *frame)
CORE_ADDR pc;
int i;
VEC (CORE_ADDR) *next_pcs = NULL;
struct cleanup *old_chain = make_cleanup (VEC_cleanup (CORE_ADDR), &next_pcs);
struct cleanup *old_chain;
/* If the target does have hardware single step, GDB doesn't have
to bother software single step. */
if (target_can_do_single_step () == 1)
return 0;
old_chain = make_cleanup (VEC_cleanup (CORE_ADDR), &next_pcs);
arm_get_next_pcs_ctor (&next_pcs_ctx,
&arm_linux_get_next_pcs_ops,
gdbarch_byte_order (gdbarch),

View File

@@ -420,7 +420,8 @@ fprint_frame (struct ui_file *file, struct frame_info *fi)
/* Given FRAME, return the enclosing frame as found in real frames read-in from
inferior memory. Skip any previous frames which were made up by GDB.
Return the original frame if no immediate previous frames exist. */
Return FRAME if FRAME is a non-artificial frame.
Return NULL if FRAME is the start of an artificial-only chain. */
static struct frame_info *
skip_artificial_frames (struct frame_info *frame)
@@ -428,12 +429,34 @@ skip_artificial_frames (struct frame_info *frame)
/* Note we use get_prev_frame_always, 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 the user
sets a backtrace limit). This is safe, because as these frames
are made up by GDB, there must be a real frame in the chain
below. */
sets a backtrace limit).
Note that for record targets we may get a frame chain that consists
of artificial frames only. */
while (get_frame_type (frame) == INLINE_FRAME
|| get_frame_type (frame) == TAILCALL_FRAME)
frame = get_prev_frame_always (frame);
{
frame = get_prev_frame_always (frame);
if (frame == NULL)
break;
}
return frame;
}
/* See frame.h. */
struct frame_info *
skip_tailcall_frames (struct frame_info *frame)
{
while (get_frame_type (frame) == TAILCALL_FRAME)
{
/* Note that for record targets we may get a frame chain that consists of
tailcall frames only. */
frame = get_prev_frame (frame);
if (frame == NULL)
break;
}
return frame;
}
@@ -496,6 +519,9 @@ frame_unwind_caller_id (struct frame_info *next_frame)
requests the frame ID of "main()"s caller. */
next_frame = skip_artificial_frames (next_frame);
if (next_frame == NULL)
return null_frame_id;
this_frame = get_prev_frame_always (next_frame);
if (this_frame)
return get_frame_id (skip_artificial_frames (this_frame));
@@ -869,7 +895,14 @@ frame_unwind_pc (struct frame_info *this_frame)
CORE_ADDR
frame_unwind_caller_pc (struct frame_info *this_frame)
{
return frame_unwind_pc (skip_artificial_frames (this_frame));
this_frame = skip_artificial_frames (this_frame);
/* We must have a non-artificial frame. The caller is supposed to check
the result of frame_unwind_caller_id (), which returns NULL_FRAME_ID
in this case. */
gdb_assert (this_frame != NULL);
return frame_unwind_pc (this_frame);
}
int
@@ -972,8 +1005,10 @@ frame_pop (struct frame_info *this_frame)
/* Ignore TAILCALL_FRAME type frames, they were executed already before
entering THISFRAME. */
while (get_frame_type (prev_frame) == TAILCALL_FRAME)
prev_frame = get_prev_frame (prev_frame);
prev_frame = skip_tailcall_frames (prev_frame);
if (prev_frame == NULL)
error (_("Cannot find the caller frame."));
/* Make a copy of all the register values unwound from this frame.
Save them in a scratch buffer so that there isn't a race between
@@ -2561,7 +2596,14 @@ frame_unwind_arch (struct frame_info *next_frame)
struct gdbarch *
frame_unwind_caller_arch (struct frame_info *next_frame)
{
return frame_unwind_arch (skip_artificial_frames (next_frame));
next_frame = skip_artificial_frames (next_frame);
/* We must have a non-artificial frame. The caller is supposed to check
the result of frame_unwind_caller_id (), which returns NULL_FRAME_ID
in this case. */
gdb_assert (next_frame != NULL);
return frame_unwind_arch (next_frame);
}
/* Gets the language of FRAME. */

View File

@@ -820,5 +820,10 @@ extern int frame_unwinder_is (struct frame_info *fi,
extern enum language get_frame_language (struct frame_info *frame);
/* Return the first non-tailcall frame above FRAME or FRAME if it is not a
tailcall frame. Return NULL if FRAME is the start of a tailcall-only
chain. */
extern struct frame_info *skip_tailcall_frames (struct frame_info *frame);
#endif /* !defined (FRAME_H) */

View File

@@ -88,14 +88,14 @@ class TypeFlagsPrinter:
try:
flags = gdb.lookup_type("enum type_flag_value")
except:
print "Warning: Cannot find enum type_flag_value type."
print " `struct type' pretty-printer will be degraded"
print("Warning: Cannot find enum type_flag_value type.")
print(" `struct type' pretty-printer will be degraded")
return
try:
iflags = gdb.lookup_type("enum type_instance_flag_value")
except:
print "Warning: Cannot find enum type_instance_flag_value type."
print " `struct type' pretty-printer will be degraded"
print("Warning: Cannot find enum type_instance_flag_value type.")
print(" `struct type' pretty-printer will be degraded")
return
# Note: TYPE_FLAG_MIN is a duplicate of TYPE_FLAG_UNSIGNED,
# so exclude it from the list we are building.

View File

@@ -1,3 +1,19 @@
2016-04-15 Pedro Alves <palves@redhat.com>
* linux-low.c (check_stopped_by_breakpoint): Rename to ...
(save_stop_reason): ... this. Use GDB_ARCH_IS_TRAP_HWBKPT and
handle ambiguous GDB_ARCH_IS_TRAP_BRKPT / GDB_ARCH_IS_TRAP_HWBKPT.
Factor out common code between the USE_SIGTRAP_SIGINFO and
!USE_SIGTRAP_SIGINFO blocks.
(linux_low_filter_event): Call save_stop_reason instead of
check_stopped_by_breakpoint and check_stopped_by_watchpoint.
Update comments.
(linux_wait_1): Update comments.
2016-02-10 Yao Qi <yao.qi@linaro.org>
* regcache.c (regcache_raw_read_unsigned): Clear *VAL.
2016-02-09 Simon Marchi <simon.marchi@ericsson.com>
* configure.ac: Use AC_CONFIG_FILES instead of passing arguments

View File

@@ -735,32 +735,16 @@ get_syscall_trapinfo (struct lwp_info *lwp, int *sysno, int *sysret)
current_thread = saved_thread;
}
/* This function should only be called if LWP got a SIGTRAP.
The SIGTRAP could mean several things.
static int check_stopped_by_watchpoint (struct lwp_info *child);
On i386, where decr_pc_after_break is non-zero:
If we were single-stepping this process using PTRACE_SINGLESTEP, we
will get only the one SIGTRAP. The value of $eip will be the next
instruction. If the instruction we stepped over was a breakpoint,
we need to decrement the PC.
If we continue the process using PTRACE_CONT, we will get a
SIGTRAP when we hit a breakpoint. The value of $eip will be
the instruction after the breakpoint (i.e. needs to be
decremented). If we report the SIGTRAP to GDB, we must also
report the undecremented PC. If the breakpoint is removed, we
must resume at the decremented PC.
On a non-decr_pc_after_break machine with hardware or kernel
single-step:
If we either single-step a breakpoint instruction, or continue and
hit a breakpoint instruction, our PC will point at the breakpoint
instruction. */
/* Called when the LWP stopped for a signal/trap. If it stopped for a
trap check what caused it (breakpoint, watchpoint, trace, etc.),
and save the result in the LWP's stop_reason field. If it stopped
for a breakpoint, decrement the PC if necessary on the lwp's
architecture. Returns true if we now have the LWP's stop PC. */
static int
check_stopped_by_breakpoint (struct lwp_info *lwp)
save_stop_reason (struct lwp_info *lwp)
{
CORE_ADDR pc;
CORE_ADDR sw_breakpoint_pc;
@@ -785,56 +769,39 @@ check_stopped_by_breakpoint (struct lwp_info *lwp)
{
if (siginfo.si_signo == SIGTRAP)
{
if (GDB_ARCH_IS_TRAP_BRKPT (siginfo.si_code))
if (GDB_ARCH_IS_TRAP_BRKPT (siginfo.si_code)
&& GDB_ARCH_IS_TRAP_HWBKPT (siginfo.si_code))
{
if (debug_threads)
{
struct thread_info *thr = get_lwp_thread (lwp);
debug_printf ("CSBB: %s stopped by software breakpoint\n",
target_pid_to_str (ptid_of (thr)));
}
/* Back up the PC if necessary. */
if (pc != sw_breakpoint_pc)
{
struct regcache *regcache
= get_thread_regcache (current_thread, 1);
(*the_low_target.set_pc) (regcache, sw_breakpoint_pc);
}
lwp->stop_pc = sw_breakpoint_pc;
lwp->stop_reason = TARGET_STOPPED_BY_SW_BREAKPOINT;
current_thread = saved_thread;
return 1;
/* The si_code is ambiguous on this arch -- check debug
registers. */
if (!check_stopped_by_watchpoint (lwp))
lwp->stop_reason = TARGET_STOPPED_BY_SW_BREAKPOINT;
}
else if (siginfo.si_code == TRAP_HWBKPT)
else if (GDB_ARCH_IS_TRAP_BRKPT (siginfo.si_code))
{
if (debug_threads)
{
struct thread_info *thr = get_lwp_thread (lwp);
debug_printf ("CSBB: %s stopped by hardware "
"breakpoint/watchpoint\n",
target_pid_to_str (ptid_of (thr)));
}
lwp->stop_pc = pc;
lwp->stop_reason = TARGET_STOPPED_BY_HW_BREAKPOINT;
current_thread = saved_thread;
return 1;
/* If we determine the LWP stopped for a SW breakpoint,
trust it. Particularly don't check watchpoint
registers, because at least on s390, we'd find
stopped-by-watchpoint as long as there's a watchpoint
set. */
lwp->stop_reason = TARGET_STOPPED_BY_SW_BREAKPOINT;
}
else if (GDB_ARCH_IS_TRAP_HWBKPT (siginfo.si_code))
{
/* This can indicate either a hardware breakpoint or
hardware watchpoint. Check debug registers. */
if (!check_stopped_by_watchpoint (lwp))
lwp->stop_reason = TARGET_STOPPED_BY_HW_BREAKPOINT;
}
else if (siginfo.si_code == TRAP_TRACE)
{
if (debug_threads)
{
struct thread_info *thr = get_lwp_thread (lwp);
debug_printf ("CSBB: %s stopped by trace\n",
target_pid_to_str (ptid_of (thr)));
}
lwp->stop_reason = TARGET_STOPPED_BY_SINGLE_STEP;
/* We may have single stepped an instruction that
triggered a watchpoint. In that case, on some
architectures (such as x86), instead of TRAP_HWBKPT,
si_code indicates TRAP_TRACE, and we need to check
the debug registers separately. */
if (!check_stopped_by_watchpoint (lwp))
lwp->stop_reason = TARGET_STOPPED_BY_SINGLE_STEP;
}
}
}
@@ -845,6 +812,16 @@ check_stopped_by_breakpoint (struct lwp_info *lwp)
case we need to report the breakpoint PC. */
if ((!lwp->stepping || lwp->stop_pc == sw_breakpoint_pc)
&& (*the_low_target.breakpoint_at) (sw_breakpoint_pc))
lwp->stop_reason = TARGET_STOPPED_BY_SW_BREAKPOINT;
if (hardware_breakpoint_inserted_here (pc))
lwp->stop_reason = TARGET_STOPPED_BY_HW_BREAKPOINT;
if (lwp->stop_reason == TARGET_STOPPED_BY_NO_REASON)
check_stopped_by_watchpoint (lwp);
#endif
if (lwp->stop_reason == TARGET_STOPPED_BY_SW_BREAKPOINT)
{
if (debug_threads)
{
@@ -856,19 +833,16 @@ check_stopped_by_breakpoint (struct lwp_info *lwp)
/* Back up the PC if necessary. */
if (pc != sw_breakpoint_pc)
{
{
struct regcache *regcache
= get_thread_regcache (current_thread, 1);
(*the_low_target.set_pc) (regcache, sw_breakpoint_pc);
}
lwp->stop_pc = sw_breakpoint_pc;
lwp->stop_reason = TARGET_STOPPED_BY_SW_BREAKPOINT;
current_thread = saved_thread;
return 1;
/* Update this so we record the correct stop PC below. */
pc = sw_breakpoint_pc;
}
if (hardware_breakpoint_inserted_here (pc))
else if (lwp->stop_reason == TARGET_STOPPED_BY_HW_BREAKPOINT)
{
if (debug_threads)
{
@@ -877,16 +851,31 @@ check_stopped_by_breakpoint (struct lwp_info *lwp)
debug_printf ("CSBB: %s stopped by hardware breakpoint\n",
target_pid_to_str (ptid_of (thr)));
}
lwp->stop_pc = pc;
lwp->stop_reason = TARGET_STOPPED_BY_HW_BREAKPOINT;
current_thread = saved_thread;
return 1;
}
#endif
else if (lwp->stop_reason == TARGET_STOPPED_BY_WATCHPOINT)
{
if (debug_threads)
{
struct thread_info *thr = get_lwp_thread (lwp);
debug_printf ("CSBB: %s stopped by hardware watchpoint\n",
target_pid_to_str (ptid_of (thr)));
}
}
else if (lwp->stop_reason == TARGET_STOPPED_BY_SINGLE_STEP)
{
if (debug_threads)
{
struct thread_info *thr = get_lwp_thread (lwp);
debug_printf ("CSBB: %s stopped by trace\n",
target_pid_to_str (ptid_of (thr)));
}
}
lwp->stop_pc = pc;
current_thread = saved_thread;
return 0;
return 1;
}
static struct lwp_info *
@@ -2434,8 +2423,8 @@ linux_low_filter_event (int lwpid, int wstat)
child->syscall_state = TARGET_WAITKIND_IGNORE;
}
/* Be careful to not overwrite stop_pc until
check_stopped_by_breakpoint is called. */
/* Be careful to not overwrite stop_pc until save_stop_reason is
called. */
if (WIFSTOPPED (wstat) && WSTOPSIG (wstat) == SIGTRAP
&& linux_is_extended_waitstatus (wstat))
{
@@ -2448,27 +2437,12 @@ linux_low_filter_event (int lwpid, int wstat)
}
}
/* Check first whether this was a SW/HW breakpoint before checking
watchpoints, because at least s390 can't tell the data address of
hardware watchpoint hits, and returns stopped-by-watchpoint as
long as there's a watchpoint set. */
if (WIFSTOPPED (wstat) && linux_wstatus_maybe_breakpoint (wstat))
{
if (check_stopped_by_breakpoint (child))
if (save_stop_reason (child))
have_stop_pc = 1;
}
/* Note that TRAP_HWBKPT can indicate either a hardware breakpoint
or hardware watchpoint. Check which is which if we got
TARGET_STOPPED_BY_HW_BREAKPOINT. Likewise, we may have single
stepped an instruction that triggered a watchpoint. In that
case, on some architectures (such as x86), instead of
TRAP_HWBKPT, si_code indicates TRAP_TRACE, and we need to check
the debug registers separately. */
if (WIFSTOPPED (wstat) && WSTOPSIG (wstat) == SIGTRAP
&& child->stop_reason != TARGET_STOPPED_BY_SW_BREAKPOINT)
check_stopped_by_watchpoint (child);
if (!have_stop_pc)
child->stop_pc = get_pc (child);
@@ -3209,7 +3183,7 @@ linux_wait_1 (ptid_t ptid,
hardware single step it means a gdb/gdbserver breakpoint had been
planted on top of a permanent breakpoint, in the case of a software
single step it may just mean that gdbserver hit the reinsert breakpoint.
The PC has been adjusted by check_stopped_by_breakpoint to point at
The PC has been adjusted by save_stop_reason to point at
the breakpoint address.
So in the case of the hardware single step advance the PC manually
past the breakpoint and in the case of software single step advance only

View File

@@ -440,6 +440,7 @@ regcache_raw_read_unsigned (struct regcache *regcache, int regnum,
"%d bytes."),
(int) sizeof (ULONGEST));
*val = 0;
collect_register (regcache, regnum, val);
return REG_VALID;

View File

@@ -2000,11 +2000,6 @@ finish_command (char *arg, int from_tty)
return;
}
/* Ignore TAILCALL_FRAME type frames, they were executed already before
entering THISFRAME. */
while (get_frame_type (frame) == TAILCALL_FRAME)
frame = get_prev_frame (frame);
/* Find the function we will return from. */
sm->function = find_pc_function (get_frame_pc (get_selected_frame (NULL)));
@@ -2031,7 +2026,16 @@ finish_command (char *arg, int from_tty)
if (execution_direction == EXEC_REVERSE)
finish_backward (sm);
else
finish_forward (sm, frame);
{
/* Ignore TAILCALL_FRAME type frames, they were executed already before
entering THISFRAME. */
frame = skip_tailcall_frames (frame);
if (frame == NULL)
error (_("Cannot find the caller frame."));
finish_forward (sm, frame);
}
}

View File

@@ -1894,7 +1894,8 @@ displaced_step_prepare (ptid_t ptid)
{
struct displaced_step_inferior_state *displaced_state;
if (ex.error != MEMORY_ERROR)
if (ex.error != MEMORY_ERROR
&& ex.error != NOT_SUPPORTED_ERROR)
throw_exception (ex);
if (debug_infrun)

View File

@@ -1026,7 +1026,7 @@ jit_breakpoint_deleted (struct breakpoint *b)
}
/* (Re-)Initialize the jit breakpoint if necessary.
Return 0 on success. */
Return 0 if the jit breakpoint has been successfully initialized. */
static int
jit_breakpoint_re_set_internal (struct gdbarch *gdbarch,
@@ -1070,7 +1070,7 @@ jit_breakpoint_re_set_internal (struct gdbarch *gdbarch,
paddress (gdbarch, addr));
if (ps_data->cached_code_address == addr)
return 1;
return 0;
/* Delete the old breakpoint. */
if (ps_data->jit_breakpoint != NULL)
@@ -1367,6 +1367,14 @@ jit_inferior_init (struct gdbarch *gdbarch)
}
}
/* inferior_created observer. */
static void
jit_inferior_created (struct target_ops *ops, int from_tty)
{
jit_inferior_created_hook ();
}
/* Exported routine to call when an inferior has been created. */
void
@@ -1496,6 +1504,7 @@ _initialize_jit (void)
show_jit_debug,
&setdebuglist, &showdebuglist);
observer_attach_inferior_created (jit_inferior_created);
observer_attach_inferior_exit (jit_inferior_exit_hook);
observer_attach_breakpoint_deleted (jit_breakpoint_deleted);

View File

@@ -303,10 +303,11 @@ static struct lwp_info *find_lwp_pid (ptid_t ptid);
static int lwp_status_pending_p (struct lwp_info *lp);
static int check_stopped_by_breakpoint (struct lwp_info *lp);
static int sigtrap_is_event (int status);
static int (*linux_nat_status_is_event) (int status) = sigtrap_is_event;
static void save_stop_reason (struct lwp_info *lp);
/* LWP accessors. */
@@ -1087,6 +1088,16 @@ attach_proc_task_lwp_callback (ptid_t ptid)
/* We need to wait for a stop before being able to make the
next ptrace call on this LWP. */
lp->must_set_ptrace_flags = 1;
/* So that wait collects the SIGSTOP. */
lp->resumed = 1;
/* Also add the LWP to gdb's thread list, in case a
matching libthread_db is not found (or the process uses
raw clone). */
add_thread (lp->ptid);
set_running (lp->ptid, 1);
set_executing (lp->ptid, 1);
}
return 1;
@@ -1235,7 +1246,10 @@ get_pending_status (struct lwp_info *lp, int *status)
{
struct thread_info *tp = find_thread_ptid (lp->ptid);
signo = tp->suspend.stop_signal;
if (tp->suspend.waitstatus_pending_p)
signo = tp->suspend.waitstatus.value.sig;
else
signo = tp->suspend.stop_signal;
}
else if (!target_is_non_stop_p ())
{
@@ -2321,30 +2335,6 @@ check_stopped_by_watchpoint (struct lwp_info *lp)
return lp->stop_reason == TARGET_STOPPED_BY_WATCHPOINT;
}
/* Called when the LWP stopped for a trap that could be explained by a
watchpoint or a breakpoint. */
static void
save_sigtrap (struct lwp_info *lp)
{
gdb_assert (lp->stop_reason == TARGET_STOPPED_BY_NO_REASON);
gdb_assert (lp->status != 0);
/* Check first if this was a SW/HW breakpoint before checking
watchpoints, because at least s390 can't tell the data address of
hardware watchpoint hits, and the kernel returns
stopped-by-watchpoint as long as there's a watchpoint set. */
if (linux_nat_status_is_event (lp->status))
check_stopped_by_breakpoint (lp);
/* Note that TRAP_HWBKPT can indicate either a hardware breakpoint
or hardware watchpoint. Check which is which if we got
TARGET_STOPPED_BY_HW_BREAKPOINT. */
if (lp->stop_reason == TARGET_STOPPED_BY_NO_REASON
|| lp->stop_reason == TARGET_STOPPED_BY_HW_BREAKPOINT)
check_stopped_by_watchpoint (lp);
}
/* Returns true if the LWP had stopped for a watchpoint. */
static int
@@ -2441,7 +2431,7 @@ stop_wait_callback (struct lwp_info *lp, void *data)
/* Save the sigtrap event. */
lp->status = status;
gdb_assert (lp->signalled);
save_sigtrap (lp);
save_stop_reason (lp);
}
else
{
@@ -2583,29 +2573,32 @@ select_event_lwp_callback (struct lwp_info *lp, void *data)
return 0;
}
/* Called when the LWP got a signal/trap that could be explained by a
software or hardware breakpoint. */
/* Called when the LWP stopped for a signal/trap. If it stopped for a
trap check what caused it (breakpoint, watchpoint, trace, etc.),
and save the result in the LWP's stop_reason field. If it stopped
for a breakpoint, decrement the PC if necessary on the lwp's
architecture. */
static int
check_stopped_by_breakpoint (struct lwp_info *lp)
static void
save_stop_reason (struct lwp_info *lp)
{
/* Arrange for a breakpoint to be hit again later. We don't keep
the SIGTRAP status and don't forward the SIGTRAP signal to the
LWP. We will handle the current event, eventually we will resume
this LWP, and this breakpoint will trap again.
If we do not do this, then we run the risk that the user will
delete or disable the breakpoint, but the LWP will have already
tripped on it. */
struct regcache *regcache = get_thread_regcache (lp->ptid);
struct gdbarch *gdbarch = get_regcache_arch (regcache);
struct regcache *regcache;
struct gdbarch *gdbarch;
CORE_ADDR pc;
CORE_ADDR sw_bp_pc;
#if USE_SIGTRAP_SIGINFO
siginfo_t siginfo;
#endif
gdb_assert (lp->stop_reason == TARGET_STOPPED_BY_NO_REASON);
gdb_assert (lp->status != 0);
if (!linux_nat_status_is_event (lp->status))
return;
regcache = get_thread_regcache (lp->ptid);
gdbarch = get_regcache_arch (regcache);
pc = regcache_read_pc (regcache);
sw_bp_pc = pc - gdbarch_decr_pc_after_break (gdbarch);
@@ -2614,33 +2607,29 @@ check_stopped_by_breakpoint (struct lwp_info *lp)
{
if (siginfo.si_signo == SIGTRAP)
{
if (GDB_ARCH_IS_TRAP_BRKPT (siginfo.si_code))
if (GDB_ARCH_IS_TRAP_BRKPT (siginfo.si_code)
&& GDB_ARCH_IS_TRAP_HWBKPT (siginfo.si_code))
{
if (debug_linux_nat)
fprintf_unfiltered (gdb_stdlog,
"CSBB: %s stopped by software "
"breakpoint\n",
target_pid_to_str (lp->ptid));
/* Back up the PC if necessary. */
if (pc != sw_bp_pc)
regcache_write_pc (regcache, sw_bp_pc);
lp->stop_pc = sw_bp_pc;
lp->stop_reason = TARGET_STOPPED_BY_SW_BREAKPOINT;
return 1;
/* The si_code is ambiguous on this arch -- check debug
registers. */
if (!check_stopped_by_watchpoint (lp))
lp->stop_reason = TARGET_STOPPED_BY_SW_BREAKPOINT;
}
else if (siginfo.si_code == TRAP_HWBKPT)
else if (GDB_ARCH_IS_TRAP_BRKPT (siginfo.si_code))
{
if (debug_linux_nat)
fprintf_unfiltered (gdb_stdlog,
"CSBB: %s stopped by hardware "
"breakpoint/watchpoint\n",
target_pid_to_str (lp->ptid));
lp->stop_pc = pc;
lp->stop_reason = TARGET_STOPPED_BY_HW_BREAKPOINT;
return 1;
/* If we determine the LWP stopped for a SW breakpoint,
trust it. Particularly don't check watchpoint
registers, because at least on s390, we'd find
stopped-by-watchpoint as long as there's a watchpoint
set. */
lp->stop_reason = TARGET_STOPPED_BY_SW_BREAKPOINT;
}
else if (GDB_ARCH_IS_TRAP_HWBKPT (siginfo.si_code))
{
/* This can indicate either a hardware breakpoint or
hardware watchpoint. Check debug registers. */
if (!check_stopped_by_watchpoint (lp))
lp->stop_reason = TARGET_STOPPED_BY_HW_BREAKPOINT;
}
else if (siginfo.si_code == TRAP_TRACE)
{
@@ -2648,6 +2637,13 @@ check_stopped_by_breakpoint (struct lwp_info *lp)
fprintf_unfiltered (gdb_stdlog,
"CSBB: %s stopped by trace\n",
target_pid_to_str (lp->ptid));
/* We may have single stepped an instruction that
triggered a watchpoint. In that case, on some
architectures (such as x86), instead of TRAP_HWBKPT,
si_code indicates TRAP_TRACE, and we need to check
the debug registers separately. */
check_stopped_by_watchpoint (lp);
}
}
}
@@ -2658,6 +2654,18 @@ check_stopped_by_breakpoint (struct lwp_info *lp)
{
/* The LWP was either continued, or stepped a software
breakpoint instruction. */
lp->stop_reason = TARGET_STOPPED_BY_SW_BREAKPOINT;
}
if (hardware_breakpoint_inserted_here_p (get_regcache_aspace (regcache), pc))
lp->stop_reason = TARGET_STOPPED_BY_HW_BREAKPOINT;
if (lp->stop_reason == TARGET_STOPPED_BY_NO_REASON)
check_stopped_by_watchpoint (lp);
#endif
if (lp->stop_reason == TARGET_STOPPED_BY_SW_BREAKPOINT)
{
if (debug_linux_nat)
fprintf_unfiltered (gdb_stdlog,
"CSBB: %s stopped by software breakpoint\n",
@@ -2667,25 +2675,25 @@ check_stopped_by_breakpoint (struct lwp_info *lp)
if (pc != sw_bp_pc)
regcache_write_pc (regcache, sw_bp_pc);
lp->stop_pc = sw_bp_pc;
lp->stop_reason = TARGET_STOPPED_BY_SW_BREAKPOINT;
return 1;
/* Update this so we record the correct stop PC below. */
pc = sw_bp_pc;
}
if (hardware_breakpoint_inserted_here_p (get_regcache_aspace (regcache), pc))
else if (lp->stop_reason == TARGET_STOPPED_BY_HW_BREAKPOINT)
{
if (debug_linux_nat)
fprintf_unfiltered (gdb_stdlog,
"CSBB: stopped by hardware breakpoint %s\n",
"CSBB: %s stopped by hardware breakpoint\n",
target_pid_to_str (lp->ptid));
}
else if (lp->stop_reason == TARGET_STOPPED_BY_WATCHPOINT)
{
if (debug_linux_nat)
fprintf_unfiltered (gdb_stdlog,
"CSBB: %s stopped by hardware watchpoint\n",
target_pid_to_str (lp->ptid));
lp->stop_pc = pc;
lp->stop_reason = TARGET_STOPPED_BY_HW_BREAKPOINT;
return 1;
}
#endif
return 0;
lp->stop_pc = pc;
}
@@ -3057,7 +3065,7 @@ linux_nat_filter_event (int lwpid, int status)
/* An interesting event. */
gdb_assert (lp);
lp->status = status;
save_sigtrap (lp);
save_stop_reason (lp);
return lp;
}

View File

@@ -2426,7 +2426,8 @@ linux_displaced_step_location (struct gdbarch *gdbarch)
location. The auxiliary vector gets us the PowerPC-side entry
point address instead. */
if (target_auxv_search (&current_target, AT_ENTRY, &addr) <= 0)
error (_("Cannot find AT_ENTRY auxiliary vector entry."));
throw_error (NOT_SUPPORTED_ERROR,
_("Cannot find AT_ENTRY auxiliary vector entry."));
/* Make certain that the address points at real code, and not a
function descriptor. */

View File

@@ -564,7 +564,6 @@ try_thread_db_load_1 (struct thread_db_info *info)
/* These are essential. */
CHK (TDB_VERBOSE_DLSYM (info, td_ta_map_lwp2thr));
CHK (TDB_VERBOSE_DLSYM (info, td_ta_thr_iter));
CHK (TDB_VERBOSE_DLSYM (info, td_thr_validate));
CHK (TDB_VERBOSE_DLSYM (info, td_thr_get_info));
@@ -572,10 +571,6 @@ try_thread_db_load_1 (struct thread_db_info *info)
TDB_DLSYM (info, td_thr_tls_get_addr);
TDB_DLSYM (info, td_thr_tlsbase);
#undef TDB_VERBOSE_DLSYM
#undef TDB_DLSYM
#undef CHK
/* It's best to avoid td_ta_thr_iter if possible. That walks data
structures in the inferior's address space that may be corrupted,
or, if the target is running, may change while we walk them. If
@@ -587,6 +582,15 @@ try_thread_db_load_1 (struct thread_db_info *info)
currently on core targets, as it uses ptrace directly. */
if (target_has_execution
&& linux_proc_task_list_dir_exists (ptid_get_pid (inferior_ptid)))
info->td_ta_thr_iter_p = NULL;
else
CHK (TDB_VERBOSE_DLSYM (info, td_ta_thr_iter));
#undef TDB_VERBOSE_DLSYM
#undef TDB_DLSYM
#undef CHK
if (info->td_ta_thr_iter_p == NULL)
{
struct lwp_info *lp;
int pid = ptid_get_pid (inferior_ptid);
@@ -1246,7 +1250,7 @@ find_new_threads_once (struct thread_db_info *info, int iteration,
data.new_threads = 0;
/* See comment in thread_db_update_thread_list. */
gdb_assert (!target_has_execution);
gdb_assert (info->td_ta_thr_iter_p != NULL);
TRY
{

View File

@@ -357,13 +357,19 @@ mi_new_thread (struct thread_info *t)
{
struct mi_interp *mi = (struct mi_interp *) top_level_interpreter_data ();
struct inferior *inf = find_inferior_ptid (t->ptid);
struct cleanup *old_chain;
gdb_assert (inf);
old_chain = make_cleanup_restore_target_terminal ();
target_terminal_ours_for_output ();
fprintf_unfiltered (mi->event_channel,
"thread-created,id=\"%d\",group-id=\"i%d\"",
t->global_num, inf->num);
gdb_flush (mi->event_channel);
do_cleanups (old_chain);
}
static void
@@ -380,7 +386,8 @@ mi_thread_exit (struct thread_info *t, int silent)
mi = (struct mi_interp *) top_level_interpreter_data ();
old_chain = make_cleanup_restore_target_terminal ();
target_terminal_ours ();
target_terminal_ours_for_output ();
fprintf_unfiltered (mi->event_channel,
"thread-exited,id=\"%d\",group-id=\"i%d\"",
t->global_num, inf->num);
@@ -395,43 +402,62 @@ static void
mi_record_changed (struct inferior *inferior, int started)
{
struct mi_interp *mi = (struct mi_interp *) top_level_interpreter_data ();
struct cleanup *old_chain;
old_chain = make_cleanup_restore_target_terminal ();
target_terminal_ours_for_output ();
fprintf_unfiltered (mi->event_channel, "record-%s,thread-group=\"i%d\"",
started ? "started" : "stopped", inferior->num);
gdb_flush (mi->event_channel);
do_cleanups (old_chain);
}
static void
mi_inferior_added (struct inferior *inf)
{
struct mi_interp *mi = (struct mi_interp *) top_level_interpreter_data ();
struct cleanup *old_chain;
old_chain = make_cleanup_restore_target_terminal ();
target_terminal_ours_for_output ();
target_terminal_ours ();
fprintf_unfiltered (mi->event_channel,
"thread-group-added,id=\"i%d\"",
inf->num);
gdb_flush (mi->event_channel);
do_cleanups (old_chain);
}
static void
mi_inferior_appeared (struct inferior *inf)
{
struct mi_interp *mi = (struct mi_interp *) top_level_interpreter_data ();
struct cleanup *old_chain;
old_chain = make_cleanup_restore_target_terminal ();
target_terminal_ours_for_output ();
target_terminal_ours ();
fprintf_unfiltered (mi->event_channel,
"thread-group-started,id=\"i%d\",pid=\"%d\"",
inf->num, inf->pid);
gdb_flush (mi->event_channel);
do_cleanups (old_chain);
}
static void
mi_inferior_exit (struct inferior *inf)
{
struct mi_interp *mi = (struct mi_interp *) top_level_interpreter_data ();
struct cleanup *old_chain;
old_chain = make_cleanup_restore_target_terminal ();
target_terminal_ours_for_output ();
target_terminal_ours ();
if (inf->has_exit_code)
fprintf_unfiltered (mi->event_channel,
"thread-group-exited,id=\"i%d\",exit-code=\"%s\"",
@@ -439,20 +465,26 @@ mi_inferior_exit (struct inferior *inf)
else
fprintf_unfiltered (mi->event_channel,
"thread-group-exited,id=\"i%d\"", inf->num);
gdb_flush (mi->event_channel);
gdb_flush (mi->event_channel);
do_cleanups (old_chain);
}
static void
mi_inferior_removed (struct inferior *inf)
{
struct mi_interp *mi = (struct mi_interp *) top_level_interpreter_data ();
struct cleanup *old_chain;
old_chain = make_cleanup_restore_target_terminal ();
target_terminal_ours_for_output ();
target_terminal_ours ();
fprintf_unfiltered (mi->event_channel,
"thread-group-removed,id=\"i%d\"",
inf->num);
gdb_flush (mi->event_channel);
do_cleanups (old_chain);
}
/* Return the MI interpreter, if it is active -- either because it's
@@ -675,11 +707,13 @@ static void
mi_traceframe_changed (int tfnum, int tpnum)
{
struct mi_interp *mi = (struct mi_interp *) top_level_interpreter_data ();
struct cleanup *old_chain;
if (mi_suppress_notification.traceframe)
return;
target_terminal_ours ();
old_chain = make_cleanup_restore_target_terminal ();
target_terminal_ours_for_output ();
if (tfnum >= 0)
fprintf_unfiltered (mi->event_channel, "traceframe-changed,"
@@ -689,6 +723,8 @@ mi_traceframe_changed (int tfnum, int tpnum)
fprintf_unfiltered (mi->event_channel, "traceframe-changed,end");
gdb_flush (mi->event_channel);
do_cleanups (old_chain);
}
/* Emit notification on creating a trace state variable. */
@@ -697,14 +733,18 @@ static void
mi_tsv_created (const struct trace_state_variable *tsv)
{
struct mi_interp *mi = (struct mi_interp *) top_level_interpreter_data ();
struct cleanup *old_chain;
target_terminal_ours ();
old_chain = make_cleanup_restore_target_terminal ();
target_terminal_ours_for_output ();
fprintf_unfiltered (mi->event_channel, "tsv-created,"
"name=\"%s\",initial=\"%s\"\n",
tsv->name, plongest (tsv->initial_value));
gdb_flush (mi->event_channel);
do_cleanups (old_chain);
}
/* Emit notification on deleting a trace state variable. */
@@ -713,8 +753,10 @@ static void
mi_tsv_deleted (const struct trace_state_variable *tsv)
{
struct mi_interp *mi = (struct mi_interp *) top_level_interpreter_data ();
struct cleanup *old_chain;
target_terminal_ours ();
old_chain = make_cleanup_restore_target_terminal ();
target_terminal_ours_for_output ();
if (tsv != NULL)
fprintf_unfiltered (mi->event_channel, "tsv-deleted,"
@@ -723,6 +765,8 @@ mi_tsv_deleted (const struct trace_state_variable *tsv)
fprintf_unfiltered (mi->event_channel, "tsv-deleted\n");
gdb_flush (mi->event_channel);
do_cleanups (old_chain);
}
/* Emit notification on modifying a trace state variable. */
@@ -732,8 +776,10 @@ mi_tsv_modified (const struct trace_state_variable *tsv)
{
struct mi_interp *mi = (struct mi_interp *) top_level_interpreter_data ();
struct ui_out *mi_uiout = interp_ui_out (top_level_interpreter ());
struct cleanup *old_chain;
target_terminal_ours ();
old_chain = make_cleanup_restore_target_terminal ();
target_terminal_ours_for_output ();
fprintf_unfiltered (mi->event_channel,
"tsv-modified");
@@ -749,6 +795,8 @@ mi_tsv_modified (const struct trace_state_variable *tsv)
ui_out_redirect (mi_uiout, NULL);
gdb_flush (mi->event_channel);
do_cleanups (old_chain);
}
/* Emit notification about a created breakpoint. */
@@ -758,6 +806,7 @@ mi_breakpoint_created (struct breakpoint *b)
{
struct mi_interp *mi = (struct mi_interp *) top_level_interpreter_data ();
struct ui_out *mi_uiout = interp_ui_out (top_level_interpreter ());
struct cleanup *old_chain;
if (mi_suppress_notification.breakpoint)
return;
@@ -765,7 +814,9 @@ mi_breakpoint_created (struct breakpoint *b)
if (b->number <= 0)
return;
target_terminal_ours ();
old_chain = make_cleanup_restore_target_terminal ();
target_terminal_ours_for_output ();
fprintf_unfiltered (mi->event_channel,
"breakpoint-created");
/* We want the output from gdb_breakpoint_query to go to
@@ -788,6 +839,8 @@ mi_breakpoint_created (struct breakpoint *b)
ui_out_redirect (mi_uiout, NULL);
gdb_flush (mi->event_channel);
do_cleanups (old_chain);
}
/* Emit notification about deleted breakpoint. */
@@ -796,6 +849,7 @@ static void
mi_breakpoint_deleted (struct breakpoint *b)
{
struct mi_interp *mi = (struct mi_interp *) top_level_interpreter_data ();
struct cleanup *old_chain;
if (mi_suppress_notification.breakpoint)
return;
@@ -803,12 +857,15 @@ mi_breakpoint_deleted (struct breakpoint *b)
if (b->number <= 0)
return;
target_terminal_ours ();
old_chain = make_cleanup_restore_target_terminal ();
target_terminal_ours_for_output ();
fprintf_unfiltered (mi->event_channel, "breakpoint-deleted,id=\"%d\"",
b->number);
gdb_flush (mi->event_channel);
do_cleanups (old_chain);
}
/* Emit notification about modified breakpoint. */
@@ -818,6 +875,7 @@ mi_breakpoint_modified (struct breakpoint *b)
{
struct mi_interp *mi = (struct mi_interp *) top_level_interpreter_data ();
struct ui_out *mi_uiout = interp_ui_out (top_level_interpreter ());
struct cleanup *old_chain;
if (mi_suppress_notification.breakpoint)
return;
@@ -825,7 +883,9 @@ mi_breakpoint_modified (struct breakpoint *b)
if (b->number <= 0)
return;
target_terminal_ours ();
old_chain = make_cleanup_restore_target_terminal ();
target_terminal_ours_for_output ();
fprintf_unfiltered (mi->event_channel,
"breakpoint-modified");
/* We want the output from gdb_breakpoint_query to go to
@@ -848,6 +908,8 @@ mi_breakpoint_modified (struct breakpoint *b)
ui_out_redirect (mi_uiout, NULL);
gdb_flush (mi->event_channel);
do_cleanups (old_chain);
}
static int
@@ -936,7 +998,7 @@ mi_on_resume (ptid_t ptid)
for MI3, and may be removed even earlier. SYNC_EXECUTION is
checked here because we only need to emit a prompt if a
synchronous command was issued when the target is async. */
if (!target_is_async_p () || sync_execution)
if (!target_can_async_p () || sync_execution)
fputs_unfiltered ("(gdb) \n", raw_stdout);
}
gdb_flush (raw_stdout);
@@ -947,8 +1009,10 @@ mi_solib_loaded (struct so_list *solib)
{
struct mi_interp *mi = (struct mi_interp *) top_level_interpreter_data ();
struct ui_out *uiout = interp_ui_out (top_level_interpreter ());
struct cleanup *old_chain;
target_terminal_ours ();
old_chain = make_cleanup_restore_target_terminal ();
target_terminal_ours_for_output ();
fprintf_unfiltered (mi->event_channel, "library-loaded");
@@ -960,12 +1024,15 @@ mi_solib_loaded (struct so_list *solib)
ui_out_field_int (uiout, "symbols-loaded", solib->symbols_loaded);
if (!gdbarch_has_global_solist (target_gdbarch ()))
{
ui_out_field_fmt (uiout, "thread-group", "i%d", current_inferior ()->num);
ui_out_field_fmt (uiout, "thread-group", "i%d",
current_inferior ()->num);
}
ui_out_redirect (uiout, NULL);
gdb_flush (mi->event_channel);
do_cleanups (old_chain);
}
static void
@@ -973,8 +1040,10 @@ mi_solib_unloaded (struct so_list *solib)
{
struct mi_interp *mi = (struct mi_interp *) top_level_interpreter_data ();
struct ui_out *uiout = interp_ui_out (top_level_interpreter ());
struct cleanup *old_chain;
target_terminal_ours ();
old_chain = make_cleanup_restore_target_terminal ();
target_terminal_ours_for_output ();
fprintf_unfiltered (mi->event_channel, "library-unloaded");
@@ -985,12 +1054,15 @@ mi_solib_unloaded (struct so_list *solib)
ui_out_field_string (uiout, "host-name", solib->so_name);
if (!gdbarch_has_global_solist (target_gdbarch ()))
{
ui_out_field_fmt (uiout, "thread-group", "i%d", current_inferior ()->num);
ui_out_field_fmt (uiout, "thread-group", "i%d",
current_inferior ()->num);
}
ui_out_redirect (uiout, NULL);
gdb_flush (mi->event_channel);
do_cleanups (old_chain);
}
/* Emit notification about the command parameter change. */
@@ -1000,11 +1072,13 @@ mi_command_param_changed (const char *param, const char *value)
{
struct mi_interp *mi = (struct mi_interp *) top_level_interpreter_data ();
struct ui_out *mi_uiout = interp_ui_out (top_level_interpreter ());
struct cleanup *old_chain;
if (mi_suppress_notification.cmd_param_changed)
return;
target_terminal_ours ();
old_chain = make_cleanup_restore_target_terminal ();
target_terminal_ours_for_output ();
fprintf_unfiltered (mi->event_channel,
"cmd-param-changed");
@@ -1017,6 +1091,8 @@ mi_command_param_changed (const char *param, const char *value)
ui_out_redirect (mi_uiout, NULL);
gdb_flush (mi->event_channel);
do_cleanups (old_chain);
}
/* Emit notification about the target memory change. */
@@ -1028,11 +1104,13 @@ mi_memory_changed (struct inferior *inferior, CORE_ADDR memaddr,
struct mi_interp *mi = (struct mi_interp *) top_level_interpreter_data ();
struct ui_out *mi_uiout = interp_ui_out (top_level_interpreter ());
struct obj_section *sec;
struct cleanup *old_chain;
if (mi_suppress_notification.memory)
return;
target_terminal_ours ();
old_chain = make_cleanup_restore_target_terminal ();
target_terminal_ours_for_output ();
fprintf_unfiltered (mi->event_channel,
"memory-changed");
@@ -1058,6 +1136,8 @@ mi_memory_changed (struct inferior *inferior, CORE_ADDR memaddr,
ui_out_redirect (mi_uiout, NULL);
gdb_flush (mi->event_channel);
do_cleanups (old_chain);
}
static int
@@ -1068,12 +1148,17 @@ report_initial_inferior (struct inferior *inf, void *closure)
and top_level_interpreter_data is set, we cannot call
it here. */
struct mi_interp *mi = (struct mi_interp *) closure;
struct cleanup *old_chain;
old_chain = make_cleanup_restore_target_terminal ();
target_terminal_ours_for_output ();
target_terminal_ours ();
fprintf_unfiltered (mi->event_channel,
"thread-group-added,id=\"i%d\"",
inf->num);
gdb_flush (mi->event_channel);
do_cleanups (old_chain);
return 0;
}

View File

@@ -415,6 +415,8 @@ run_one_inferior (struct inferior *inf, void *arg)
{
int start_p = *(int *) arg;
const char *run_cmd = start_p ? "start" : "run";
struct target_ops *run_target = find_run_target ();
int async_p = mi_async && run_target->to_can_async_p (run_target);
if (inf->pid != 0)
{
@@ -435,8 +437,8 @@ run_one_inferior (struct inferior *inf, void *arg)
switch_to_thread (null_ptid);
set_current_program_space (inf->pspace);
}
mi_execute_cli_command (run_cmd, mi_async_p (),
mi_async_p () ? "&" : NULL);
mi_execute_cli_command (run_cmd, async_p,
async_p ? "&" : NULL);
return 0;
}
@@ -489,9 +491,11 @@ mi_cmd_exec_run (char *command, char **argv, int argc)
else
{
const char *run_cmd = start_p ? "start" : "run";
struct target_ops *run_target = find_run_target ();
int async_p = mi_async && run_target->to_can_async_p (run_target);
mi_execute_cli_command (run_cmd, mi_async_p (),
mi_async_p () ? "&" : NULL);
mi_execute_cli_command (run_cmd, async_p,
async_p ? "&" : NULL);
}
}
@@ -2171,12 +2175,17 @@ mi_execute_command (const char *cmd, int from_tty)
if (report_change)
{
struct thread_info *ti = inferior_thread ();
struct cleanup *old_chain;
old_chain = make_cleanup_restore_target_terminal ();
target_terminal_ours_for_output ();
target_terminal_ours ();
fprintf_unfiltered (mi->event_channel,
"thread-selected,id=\"%d\"",
ti->global_num);
gdb_flush (mi->event_channel);
do_cleanups (old_chain);
}
}

View File

@@ -119,14 +119,14 @@ struct buffer;
/* The x86 kernel gets some of the si_code values backwards, like
this:
| what | si_code |
|------------------------------------------+------------|
| software breakpoints (int3) | SI_KERNEL |
| single-steps | TRAP_TRACE |
| single-stepping a syscall | TRAP_BRKPT |
| user sent SIGTRAP | 0 |
| exec SIGTRAP (when no PTRACE_EVENT_EXEC) | 0 |
| hardware breakpoints/watchpoints | TRAP_HWBPT |
| what | si_code |
|------------------------------------------+-------------|
| software breakpoints (int3) | SI_KERNEL |
| single-steps | TRAP_TRACE |
| single-stepping a syscall | TRAP_BRKPT |
| user sent SIGTRAP | 0 |
| exec SIGTRAP (when no PTRACE_EVENT_EXEC) | 0 |
| hardware breakpoints/watchpoints | TRAP_HWBKPT |
That is, it reports SI_KERNEL for software breakpoints (and only
for those), and TRAP_BRKPT for single-stepping a syscall... If the
@@ -140,14 +140,35 @@ struct buffer;
in SPU code on a Cell/B.E. However, SI_KERNEL is never seen
on a SIGTRAP for any other reason.
The generic Linux target code should use GDB_ARCH_IS_TRAP_BRKPT
instead of TRAP_BRKPT to abstract out these peculiarities. */
The MIPS kernel up until 4.5 used SI_KERNEL for all kernel
generated traps. Since:
- MIPS doesn't do hardware single-step.
- We don't need to care about exec SIGTRAPs --- we assume
PTRACE_EVENT_EXEC is available.
- The MIPS kernel doesn't support hardware breakpoints.
on MIPS, all we need to care about is distinguishing between
software breakpoints and hardware watchpoints, which can be done by
peeking the debug registers.
Beginning with Linux 4.6, the MIPS port reports proper TRAP_BRKPT and
TRAP_HWBKPT codes, so we also match them.
The generic Linux target code should use GDB_ARCH_IS_TRAP_* instead
of TRAP_* to abstract out these peculiarities. */
#if defined __i386__ || defined __x86_64__
# define GDB_ARCH_IS_TRAP_BRKPT(X) ((X) == SI_KERNEL)
# define GDB_ARCH_IS_TRAP_HWBKPT(X) ((X) == TRAP_HWBKPT)
#elif defined __powerpc__
# define GDB_ARCH_IS_TRAP_BRKPT(X) ((X) == SI_KERNEL || (X) == TRAP_BRKPT)
# define GDB_ARCH_IS_TRAP_HWBKPT(X) ((X) == TRAP_HWBKPT)
#elif defined __mips__
# define GDB_ARCH_IS_TRAP_BRKPT(X) ((X) == SI_KERNEL || (X) == TRAP_BRKPT)
# define GDB_ARCH_IS_TRAP_HWBKPT(X) ((X) == SI_KERNEL || (X) == TRAP_HWBKPT)
#else
# define GDB_ARCH_IS_TRAP_BRKPT(X) ((X) == TRAP_BRKPT)
# define GDB_ARCH_IS_TRAP_HWBKPT(X) ((X) == TRAP_HWBKPT)
#endif
#ifndef TRAP_HWBKPT

View File

@@ -1717,27 +1717,25 @@ message == an error message without a stack will be printed."),
progname = concat (ldirname (python_libdir), SLASH_STRING, "bin",
SLASH_STRING, "python", NULL);
#ifdef IS_PY3K
oldloc = setlocale (LC_ALL, NULL);
oldloc = xstrdup (setlocale (LC_ALL, NULL));
setlocale (LC_ALL, "");
progsize = strlen (progname);
if (progsize == (size_t) -1)
{
fprintf (stderr, "Could not convert python path to string\n");
return;
}
progname_copy = (wchar_t *) PyMem_Malloc ((progsize + 1) * sizeof (wchar_t));
if (!progname_copy)
{
xfree (oldloc);
fprintf (stderr, "out of memory\n");
return;
}
count = mbstowcs (progname_copy, progname, progsize + 1);
if (count == (size_t) -1)
{
xfree (oldloc);
fprintf (stderr, "Could not convert python path to string\n");
return;
}
setlocale (LC_ALL, oldloc);
xfree (oldloc);
/* Note that Py_SetProgramName expects the string it is passed to
remain alive for the duration of the program's execution, so

View File

@@ -389,6 +389,9 @@ struct remote_state
int last_sent_step;
/* The execution direction of the last resume we got. */
enum exec_direction_kind last_resume_exec_dir;
char *finished_object;
char *finished_annex;
ULONGEST finished_offset;
@@ -477,6 +480,7 @@ new_remote_state (void)
result->buf = (char *) xmalloc (result->buf_size);
result->remote_traceframe_number = -1;
result->last_sent_signal = GDB_SIGNAL_0;
result->last_resume_exec_dir = EXEC_FORWARD;
result->fs_pid = -1;
return result;
@@ -4017,6 +4021,25 @@ remote_start_remote (int from_tty, struct target_ops *target, int extended_p)
if (packet_support (PACKET_QAllow) != PACKET_DISABLE)
remote_set_permissions (target);
/* gdbserver < 7.7 (before its fix from 2013-12-11) did reply to any
unknown 'v' packet with string "OK". "OK" gets interpreted by GDB
as a reply to known packet. For packet "vFile:setfs:" it is an
invalid reply and GDB would return error in
remote_hostio_set_filesystem, making remote files access impossible.
Disable "vFile:setfs:" in such case. Do not disable other 'v' packets as
other "vFile" packets get correctly detected even on gdbserver < 7.7. */
{
const char v_mustreplyempty[] = "vMustReplyEmpty";
putpkt (v_mustreplyempty);
getpkt (&rs->buf, &rs->buf_size, 0);
if (strcmp (rs->buf, "OK") == 0)
remote_protocol_packets[PACKET_vFile_setfs].support = PACKET_DISABLE;
else if (strcmp (rs->buf, "") != 0)
error (_("Remote replied unexpectedly to '%s': %s"), v_mustreplyempty,
rs->buf);
}
/* Next, we possibly activate noack mode.
If the QStartNoAckMode packet configuration is set to AUTO,
@@ -4928,6 +4951,8 @@ remote_open_1 (const char *name, int from_tty,
rs->continue_thread = not_sent_ptid;
rs->remote_traceframe_number = -1;
rs->last_resume_exec_dir = EXEC_FORWARD;
/* Probe for ability to use "ThreadInfo" query, as required. */
rs->use_threadinfo_query = 1;
rs->use_threadextra_query = 1;
@@ -5563,6 +5588,8 @@ remote_resume (struct target_ops *ops,
rs->last_sent_signal = siggnal;
rs->last_sent_step = step;
rs->last_resume_exec_dir = execution_direction;
/* The vCont packet doesn't need to specify threads via Hc. */
/* No reverse support (yet) for vCont. */
if (execution_direction != EXEC_REVERSE)
@@ -6166,7 +6193,12 @@ remove_new_fork_children (struct threads_listing_context *context)
fork child threads from the CONTEXT list. */
ALL_NON_EXITED_THREADS (thread)
{
struct target_waitstatus *ws = &thread->pending_follow;
struct target_waitstatus *ws;
if (thread->suspend.waitstatus_pending_p)
ws = &thread->suspend.waitstatus;
else
ws = &thread->pending_follow;
if (is_pending_fork_parent (ws, pid, thread->ptid))
{
@@ -13013,6 +13045,17 @@ remote_can_do_single_step (struct target_ops *ops)
return 0;
}
/* Implementation of the to_execution_direction method for the remote
target. */
static enum exec_direction_kind
remote_execution_direction (struct target_ops *self)
{
struct remote_state *rs = get_remote_state ();
return rs->last_resume_exec_dir;
}
static void
init_remote_ops (void)
{
@@ -13158,6 +13201,7 @@ Specify the serial device it is connected to\n\
remote_ops.to_remove_vfork_catchpoint = remote_remove_vfork_catchpoint;
remote_ops.to_insert_exec_catchpoint = remote_insert_exec_catchpoint;
remote_ops.to_remove_exec_catchpoint = remote_remove_exec_catchpoint;
remote_ops.to_execution_direction = remote_execution_direction;
}
/* Set up the extended remote vector by making a copy of the standard

View File

@@ -1509,27 +1509,32 @@ frame_info (char *addr_exp, int from_tty)
wrap_here (" ");
printf_filtered ("saved %s = ", pc_regname);
TRY
if (!frame_id_p (frame_unwind_caller_id (fi)))
val_print_unavailable (gdb_stdout);
else
{
caller_pc = frame_unwind_caller_pc (fi);
caller_pc_p = 1;
}
CATCH (ex, RETURN_MASK_ERROR)
{
switch (ex.error)
TRY
{
case NOT_AVAILABLE_ERROR:
val_print_unavailable (gdb_stdout);
break;
case OPTIMIZED_OUT_ERROR:
val_print_not_saved (gdb_stdout);
break;
default:
fprintf_filtered (gdb_stdout, _("<error: %s>"), ex.message);
break;
caller_pc = frame_unwind_caller_pc (fi);
caller_pc_p = 1;
}
CATCH (ex, RETURN_MASK_ERROR)
{
switch (ex.error)
{
case NOT_AVAILABLE_ERROR:
val_print_unavailable (gdb_stdout);
break;
case OPTIMIZED_OUT_ERROR:
val_print_not_saved (gdb_stdout);
break;
default:
fprintf_filtered (gdb_stdout, _("<error: %s>"), ex.message);
break;
}
}
END_CATCH
}
END_CATCH
if (caller_pc_p)
fputs_filtered (paddress (gdbarch, caller_pc), gdb_stdout);

View File

@@ -3293,19 +3293,21 @@ find_pc_overlay (CORE_ADDR pc)
struct obj_section *osect, *best_match = NULL;
if (overlay_debugging)
ALL_OBJSECTIONS (objfile, osect)
if (section_is_overlay (osect))
{
if (pc_in_mapped_range (pc, osect))
{
ALL_OBJSECTIONS (objfile, osect)
if (section_is_overlay (osect))
{
if (section_is_mapped (osect))
return osect;
else
if (pc_in_mapped_range (pc, osect))
{
if (section_is_mapped (osect))
return osect;
else
best_match = osect;
}
else if (pc_in_unmapped_range (pc, osect))
best_match = osect;
}
else if (pc_in_unmapped_range (pc, osect))
best_match = osect;
}
}
return best_match;
}
@@ -3320,9 +3322,11 @@ find_pc_mapped_section (CORE_ADDR pc)
struct obj_section *osect;
if (overlay_debugging)
ALL_OBJSECTIONS (objfile, osect)
if (pc_in_mapped_range (pc, osect) && section_is_mapped (osect))
return osect;
{
ALL_OBJSECTIONS (objfile, osect)
if (pc_in_mapped_range (pc, osect) && section_is_mapped (osect))
return osect;
}
return NULL;
}
@@ -3338,31 +3342,33 @@ list_overlays_command (char *args, int from_tty)
struct obj_section *osect;
if (overlay_debugging)
ALL_OBJSECTIONS (objfile, osect)
{
ALL_OBJSECTIONS (objfile, osect)
if (section_is_mapped (osect))
{
struct gdbarch *gdbarch = get_objfile_arch (objfile);
const char *name;
bfd_vma lma, vma;
int size;
{
struct gdbarch *gdbarch = get_objfile_arch (objfile);
const char *name;
bfd_vma lma, vma;
int size;
vma = bfd_section_vma (objfile->obfd, osect->the_bfd_section);
lma = bfd_section_lma (objfile->obfd, osect->the_bfd_section);
size = bfd_get_section_size (osect->the_bfd_section);
name = bfd_section_name (objfile->obfd, osect->the_bfd_section);
vma = bfd_section_vma (objfile->obfd, osect->the_bfd_section);
lma = bfd_section_lma (objfile->obfd, osect->the_bfd_section);
size = bfd_get_section_size (osect->the_bfd_section);
name = bfd_section_name (objfile->obfd, osect->the_bfd_section);
printf_filtered ("Section %s, loaded at ", name);
fputs_filtered (paddress (gdbarch, lma), gdb_stdout);
puts_filtered (" - ");
fputs_filtered (paddress (gdbarch, lma + size), gdb_stdout);
printf_filtered (", mapped at ");
fputs_filtered (paddress (gdbarch, vma), gdb_stdout);
puts_filtered (" - ");
fputs_filtered (paddress (gdbarch, vma + size), gdb_stdout);
puts_filtered ("\n");
printf_filtered ("Section %s, loaded at ", name);
fputs_filtered (paddress (gdbarch, lma), gdb_stdout);
puts_filtered (" - ");
fputs_filtered (paddress (gdbarch, lma + size), gdb_stdout);
printf_filtered (", mapped at ");
fputs_filtered (paddress (gdbarch, vma), gdb_stdout);
puts_filtered (" - ");
fputs_filtered (paddress (gdbarch, vma + size), gdb_stdout);
puts_filtered ("\n");
nmapped++;
}
nmapped++;
}
}
if (nmapped == 0)
printf_filtered (_("No sections are mapped.\n"));
}

View File

@@ -1,3 +1,91 @@
2016-05-25 Pedro Alves <palves@redhat.com>
PR gdb/19828
* gdb.threads/clone-attach-detach.c: New file.
* gdb.threads/clone-attach-detach.exp: New file.
* gdb.threads/attach-many-short-lived-threads.exp: Skip.
2016-05-18 Simon Marchi <simon.marchi@ericsson.com>
* gdb.mi/mi-threads-interrupt.c: New file.
* gdb.mi/mi-threads-interrupt.exp: New file.
2016-05-17 Simon Marchi <simon.marchi@ericsson.com>
PR gdb/18077
* gdb.mi/mi-async-run.exp: New file.
* gdb.mi/mi-async-run.c: New file.
2016-03-31 Pedro Alves <palves@redhat.com>
PR gdb/19858
* gdb.base/jit-main.c: Include unistd.h.
(ATTACH): Define to 0 if not already defined.
(wait_for_gdb, mypid): New globals.
(WAIT_FOR_GDB): New macro.
(MAIN): Set an alarm. Store the process's pid. Wait for GDB at
some breakpoint locations.
* gdb.base/jit.exp (clean_reattach, continue_to_test_location):
New procedures.
(one_jit_test): Add REATTACH parameter, and handle it. Use
continue_to_test_location.
(top level): Test attach, and adjusts calls to one_jit_test.
2016-03-31 Pedro Alves <palves@redhat.com>
PR gdb/19858
* gdb.base/jit.exp (compile_jit_test): Add intro comment. Add
BINSUFFIX parameter, and handle it.
(top level): Adjust calls compile_jit_test.
2016-03-17 Markus Metzger <markus.t.metzger@intel.com>
PR gdb/19829
* gdb.btrace/tailcall-only.exp: New.
* gdb.btrace/tailcall-only.c: New.
* gdb.btrace/x86_64-tailcall-only.S: New.
* gdb.btrace/i686-tailcall-only.S: New.
2016-02-16 Don Breazeal <donb@codesourcery.com>
PR remote/19496
* gdb.threads/forking-threads-plus-breakpoint.exp (do_test):
Remove kfail for PR remote/19496.
2016-02-15 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.arch/i386-prologue.c: Add missing prototypes.
2016-02-15 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.arch/i386-gnu-cfi.exp: Use standard_output_file.
* gdb.arch/i386-prologue.exp: Likewise.
* gdb.arch/i386-size.exp: Likewise.
2016-02-15 Simon Marchi <simon.marchi@ericsson.com>
* i386-biarch-core.exp: Define corefile using
standard_output_file.
2016-02-14 Jan Kratochvil <jan.kratochvil@redhat.com>
Fix compatibility with recent gfortran-5.3.1.
* gdb.fortran/vla-history.exp (print vla1 allocated)
(print vla2 allocated, print $2, print $3): Remove
(print $4): Rename to ...
(print $2): ... here.
(print $9): Rename to ...
(print $5): ... here.
(print $10): Rename to ...
(print $6): ... here.
* gdb.fortran/vla.f90: Add pvla initialization.
2016-02-14 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.fortran/vla-value-sub-finish.exp (set max-value-size 1024*1024):
New test.
* gdb.fortran/vla-value-sub.exp: Likewise.
2016-02-09 Keith Seitz <keiths@redhat.com>
PR breakpoints/19546

View File

@@ -40,7 +40,7 @@ gdb_test_multiple "complete set gnutarget " $test {
}
set corebz2file ${srcdir}/${subdir}/${testfile}.core.bz2
set corefile ${objdir}/${subdir}/${testfile}.core
set corefile [standard_output_file ${testfile}.core]
# Entry point of the original executable.
set address 0x400078

View File

@@ -31,7 +31,7 @@ if { ![is_x86_like_target] } then {
set testfile "i386-gnu-cfi"
set srcfilec ${testfile}.c
set srcfileasm ${testfile}-asm.S
set binfile ${objdir}/${subdir}/${testfile}
set binfile [standard_output_file ${testfile}]
# some targets have leading underscores on assembly symbols.
set additional_flags [gdb_target_symbol_prefix_flags]

View File

@@ -27,6 +27,10 @@ void gdb1253 (void);
void gdb1718 (void);
void gdb1338 (void);
void jump_at_beginning (void);
void standard (void);
void stack_align_ecx (void);
void stack_align_edx (void);
void stack_align_eax (void);
int
main (void)

View File

@@ -28,7 +28,7 @@ if { ![is_x86_like_target] } then {
set testfile "i386-prologue"
set srcfile ${testfile}.c
set binfile ${objdir}/${subdir}/${testfile}
set binfile [standard_output_file ${testfile}]
# some targets have leading underscores on assembly symbols.
set additional_flags [gdb_target_symbol_prefix_flags]

View File

@@ -27,7 +27,7 @@ if { ![is_x86_like_target] } then {
set testfile "i386-size"
set srcfile ${testfile}.c
set binfile ${objdir}/${subdir}/${testfile}
set binfile [standard_output_file ${testfile}]
# some targets have leading underscores on assembly symbols.
set additional_flags [gdb_target_symbol_prefix_flags]

View File

@@ -27,6 +27,7 @@
#include <string.h>
#include <sys/mman.h>
#include <sys/stat.h>
#include <unistd.h>
/* ElfW is coming from linux. On other platforms it does not exist.
Let us define it here. */
@@ -116,10 +117,22 @@ update_locations (const void *const addr, int idx)
}
}
/* Defined by the .exp file if testing attach. */
#ifndef ATTACH
#define ATTACH 0
#endif
#ifndef MAIN
#define MAIN main
#endif
/* Used to spin waiting for GDB. */
volatile int wait_for_gdb = ATTACH;
#define WAIT_FOR_GDB while (wait_for_gdb)
/* The current process's PID. GDB retrieves this. */
int mypid;
int
MAIN (int argc, char *argv[])
{
@@ -127,6 +140,10 @@ MAIN (int argc, char *argv[])
const char *libname = NULL;
int count = 0;
alarm (300);
mypid = getpid ();
count = count; /* gdb break here 0 */
if (argc < 2)
@@ -190,7 +207,7 @@ MAIN (int argc, char *argv[])
__jit_debug_register_code ();
}
i = 0; /* gdb break here 1 */
WAIT_FOR_GDB; i = 0; /* gdb break here 1 */
/* Now unregister them all in reverse order. */
while (__jit_debug_descriptor.relevant_entry != NULL)
@@ -215,5 +232,5 @@ MAIN (int argc, char *argv[])
free (entry);
}
}
return 0; /* gdb break here 2 */
WAIT_FOR_GDB; return 0; /* gdb break here 2 */
}

View File

@@ -24,18 +24,19 @@ if {[get_compiler_info]} {
return 1
}
#
# test running programs
#
# Compile the testcase program and library. BINSUFFIX is the suffix
# to append to the program and library filenames, to make them unique
# between invocations. OPTIONS is passed to gdb_compile when
# compiling the program.
proc compile_jit_test {testname options} {
proc compile_jit_test {testname binsuffix options} {
global testfile srcfile binfile srcdir subdir
global solib_testfile solib_srcfile solib_binfile solib_binfile_test_msg
global solib_binfile_target
set testfile jit-main
set srcfile ${testfile}.c
set binfile [standard_output_file $testfile]
set binfile [standard_output_file $testfile$binsuffix]
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" \
executable [concat debug $options]] != "" } {
untested $testname
@@ -44,8 +45,8 @@ proc compile_jit_test {testname options} {
set solib_testfile "jit-solib"
set solib_srcfile "${srcdir}/${subdir}/${solib_testfile}.c"
set solib_binfile [standard_output_file ${solib_testfile}.so]
set solib_binfile_test_msg "SHLIBDIR/${solib_testfile}.so"
set solib_binfile [standard_output_file ${solib_testfile}$binsuffix.so]
set solib_binfile_test_msg "SHLIBDIR/${solib_testfile}$binsuffix.so"
# Note: compiling without debug info: the library goes through
# symbol renaming by munging on its symbol table, and that
@@ -65,7 +66,49 @@ proc compile_jit_test {testname options} {
return 0
}
proc one_jit_test {count match_str} {
# Detach, restart GDB, and re-attach to the program.
proc clean_reattach {} {
global decimal gdb_prompt srcfile testfile
# Get PID of test program.
set testpid -1
set test "get inferior process ID"
gdb_test_multiple "p mypid" $test {
-re ".* = ($decimal).*$gdb_prompt $" {
set testpid $expect_out(1,string)
pass $test
}
}
gdb_test_no_output "set var wait_for_gdb = 1"
gdb_test "detach" "Detaching from .*"
clean_restart $testfile
set test "attach"
gdb_test_multiple "attach $testpid" "$test" {
-re "Attaching to program.*.*main.*at .*$srcfile:.*$gdb_prompt $" {
pass "$test"
}
}
gdb_test_no_output "set var wait_for_gdb = 0"
}
# Continue to LOCATION in the program. If REATTACH, detach and
# re-attach to the program from scratch.
proc continue_to_test_location {location reattach} {
gdb_breakpoint [gdb_get_line_number $location]
gdb_continue_to_breakpoint $location
if {$reattach} {
with_test_prefix "$location" {
clean_reattach
}
}
}
proc one_jit_test {count match_str reattach} {
with_test_prefix "one_jit_test-$count" {
global verbose testfile solib_binfile_target solib_binfile_test_msg
@@ -90,8 +133,7 @@ proc one_jit_test {count match_str} {
gdb_test_no_output "set var libname = \"$solib_binfile_target\"" "set var libname = \"$solib_binfile_test_msg\""
gdb_test_no_output "set var count = $count"
gdb_breakpoint [gdb_get_line_number "break here 1"]
gdb_continue_to_breakpoint "break here 1"
continue_to_test_location "break here 1" $reattach
gdb_test "info function ^jit_function" "$match_str"
@@ -101,25 +143,39 @@ proc one_jit_test {count match_str} {
gdb_test "maintenance info break"
}
gdb_breakpoint [gdb_get_line_number "break here 2"]
gdb_continue_to_breakpoint "break here 2"
continue_to_test_location "break here 2" $reattach
# All jit librares must have been unregistered
gdb_test "info function jit_function" \
"All functions matching regular expression \"jit_function\":"
}
}
if {[compile_jit_test jit.exp {}] < 0} {
if {[compile_jit_test jit.exp "" {}] < 0} {
return
}
one_jit_test 1 "${hex} jit_function_0000"
one_jit_test 2 "${hex} jit_function_0000\[\r\n\]+${hex} jit_function_0001"
one_jit_test 1 "${hex} jit_function_0000" 0
one_jit_test 2 "${hex} jit_function_0000\[\r\n\]+${hex} jit_function_0001" 0
with_test_prefix PIE {
if {[compile_jit_test "jit.exp PIE tests" \
{additional_flags=-fPIE ldflags=-pie}] < 0} {
# Test attaching to an inferior with some JIT libraries already
# registered. We reuse the normal test, and detach/reattach at
# specific interesting points.
if {[can_spawn_for_attach]} {
if {[compile_jit_test "jit.exp attach tests" \
"-attach" {additional_flags=-DATTACH=1}] < 0} {
return
}
one_jit_test 1 "${hex} jit_function_0000"
with_test_prefix attach {
one_jit_test 2 "${hex} jit_function_0000\[\r\n\]+${hex} jit_function_0001" 1
}
}
with_test_prefix PIE {
if {[compile_jit_test "jit.exp PIE tests" \
"-pie" {additional_flags=-fPIE ldflags=-pie}] < 0} {
return
}
one_jit_test 1 "${hex} jit_function_0000" 0
}

View File

@@ -0,0 +1,447 @@
/* This testcase is part of GDB, the GNU debugger.
Copyright 2016 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
This file has been generated using:
gcc -m32 -march=i686 -S -O2 -dA -g tailcall-only.c -o i686-tailcall-only.S
*/
.file "tailcall-only.c"
.text
.Ltext0:
.p2align 4,,15
.type bar_1, @function
bar_1:
.LFB0:
.file 1 "tailcall-only.c"
# tailcall-only.c:22
.loc 1 22 0
.cfi_startproc
# BLOCK 2 freq:10000 seq:0
# PRED: ENTRY [100.0%] (FALLTHRU)
# tailcall-only.c:24
.loc 1 24 0
movl $42, %eax
# SUCC: EXIT [100.0%]
ret
.cfi_endproc
.LFE0:
.size bar_1, .-bar_1
.p2align 4,,15
.type bar, @function
bar:
.LFB1:
# tailcall-only.c:28
.loc 1 28 0
.cfi_startproc
# BLOCK 2 freq:10000 seq:0
# PRED: ENTRY [100.0%] (FALLTHRU)
# tailcall-only.c:29
.loc 1 29 0
jmp bar_1
# SUCC: EXIT [100.0%] (ABNORMAL,SIBCALL)
.LVL0:
.cfi_endproc
.LFE1:
.size bar, .-bar
.p2align 4,,15
.type foo_1, @function
foo_1:
.LFB2:
# tailcall-only.c:34
.loc 1 34 0
.cfi_startproc
# BLOCK 2 freq:10000 seq:0
# PRED: ENTRY [100.0%] (FALLTHRU)
# tailcall-only.c:35
.loc 1 35 0
jmp bar
# SUCC: EXIT [100.0%] (ABNORMAL,SIBCALL)
.LVL1:
.cfi_endproc
.LFE2:
.size foo_1, .-foo_1
.p2align 4,,15
.type foo, @function
foo:
.LFB3:
# tailcall-only.c:40
.loc 1 40 0
.cfi_startproc
# BLOCK 2 freq:10000 seq:0
# PRED: ENTRY [100.0%] (FALLTHRU)
# tailcall-only.c:41
.loc 1 41 0
jmp foo_1
# SUCC: EXIT [100.0%] (ABNORMAL,SIBCALL)
.LVL2:
.cfi_endproc
.LFE3:
.size foo, .-foo
.section .text.startup,"ax",@progbits
.p2align 4,,15
.globl main
.type main, @function
main:
.LFB4:
# tailcall-only.c:46
.loc 1 46 0
.cfi_startproc
# BLOCK 2 freq:10000 seq:0
# PRED: ENTRY [100.0%] (FALLTHRU)
# tailcall-only.c:49
.loc 1 49 0
call foo
.LVL3:
# tailcall-only.c:50
.loc 1 50 0
addl $1, %eax
.LVL4:
# SUCC: EXIT [100.0%]
# tailcall-only.c:53
.loc 1 53 0
ret
.cfi_endproc
.LFE4:
.size main, .-main
.text
.Letext0:
.section .debug_info,"",@progbits
.Ldebug_info0:
.long 0xd5 # Length of Compilation Unit Info
.value 0x4 # DWARF version number
.long .Ldebug_abbrev0 # Offset Into Abbrev. Section
.byte 0x4 # Pointer Size (in bytes)
.uleb128 0x1 # (DIE (0xb) DW_TAG_compile_unit)
.long .LASF1 # DW_AT_producer: "GNU C 4.8.3 20140911 (Red Hat 4.8.3-9) -m32 -march=i686 -g -O2"
.byte 0x1 # DW_AT_language
.long .LASF2 # DW_AT_name: "tailcall-only.c"
.long .LASF3 # DW_AT_comp_dir: ""
.long .Ldebug_ranges0+0 # DW_AT_ranges
.long 0 # DW_AT_low_pc
.long .Ldebug_line0 # DW_AT_stmt_list
.uleb128 0x2 # (DIE (0x25) DW_TAG_subprogram)
.long .LASF4 # DW_AT_name: "bar_1"
.byte 0x1 # DW_AT_decl_file (tailcall-only.c)
.byte 0x15 # DW_AT_decl_line
# DW_AT_prototyped
.long 0x3a # DW_AT_type
.long .LFB0 # DW_AT_low_pc
.long .LFE0-.LFB0 # DW_AT_high_pc
.uleb128 0x1 # DW_AT_frame_base
.byte 0x9c # DW_OP_call_frame_cfa
# DW_AT_GNU_all_call_sites
.uleb128 0x3 # (DIE (0x3a) DW_TAG_base_type)
.byte 0x4 # DW_AT_byte_size
.byte 0x5 # DW_AT_encoding
.ascii "int\0" # DW_AT_name
.uleb128 0x4 # (DIE (0x41) DW_TAG_subprogram)
.ascii "bar\0" # DW_AT_name
.byte 0x1 # DW_AT_decl_file (tailcall-only.c)
.byte 0x1b # DW_AT_decl_line
# DW_AT_prototyped
.long 0x3a # DW_AT_type
.long .LFB1 # DW_AT_low_pc
.long .LFE1-.LFB1 # DW_AT_high_pc
.uleb128 0x1 # DW_AT_frame_base
.byte 0x9c # DW_OP_call_frame_cfa
# DW_AT_GNU_all_call_sites
.long 0x64 # DW_AT_sibling
.uleb128 0x5 # (DIE (0x5a) DW_TAG_GNU_call_site)
.long .LVL0 # DW_AT_low_pc
# DW_AT_GNU_tail_call
.long 0x25 # DW_AT_abstract_origin
.byte 0 # end of children of DIE 0x41
.uleb128 0x6 # (DIE (0x64) DW_TAG_subprogram)
.long .LASF0 # DW_AT_name: "foo_1"
.byte 0x1 # DW_AT_decl_file (tailcall-only.c)
.byte 0x21 # DW_AT_decl_line
# DW_AT_prototyped
.long 0x3a # DW_AT_type
.long .LFB2 # DW_AT_low_pc
.long .LFE2-.LFB2 # DW_AT_high_pc
.uleb128 0x1 # DW_AT_frame_base
.byte 0x9c # DW_OP_call_frame_cfa
# DW_AT_GNU_all_call_sites
.long 0x87 # DW_AT_sibling
.uleb128 0x5 # (DIE (0x7d) DW_TAG_GNU_call_site)
.long .LVL1 # DW_AT_low_pc
# DW_AT_GNU_tail_call
.long 0x41 # DW_AT_abstract_origin
.byte 0 # end of children of DIE 0x64
.uleb128 0x4 # (DIE (0x87) DW_TAG_subprogram)
.ascii "foo\0" # DW_AT_name
.byte 0x1 # DW_AT_decl_file (tailcall-only.c)
.byte 0x27 # DW_AT_decl_line
# DW_AT_prototyped
.long 0x3a # DW_AT_type
.long .LFB3 # DW_AT_low_pc
.long .LFE3-.LFB3 # DW_AT_high_pc
.uleb128 0x1 # DW_AT_frame_base
.byte 0x9c # DW_OP_call_frame_cfa
# DW_AT_GNU_all_call_sites
.long 0xaa # DW_AT_sibling
.uleb128 0x5 # (DIE (0xa0) DW_TAG_GNU_call_site)
.long .LVL2 # DW_AT_low_pc
# DW_AT_GNU_tail_call
.long 0x64 # DW_AT_abstract_origin
.byte 0 # end of children of DIE 0x87
.uleb128 0x7 # (DIE (0xaa) DW_TAG_subprogram)
# DW_AT_external
.long .LASF5 # DW_AT_name: "main"
.byte 0x1 # DW_AT_decl_file (tailcall-only.c)
.byte 0x2d # DW_AT_decl_line
# DW_AT_prototyped
.long 0x3a # DW_AT_type
.long .LFB4 # DW_AT_low_pc
.long .LFE4-.LFB4 # DW_AT_high_pc
.uleb128 0x1 # DW_AT_frame_base
.byte 0x9c # DW_OP_call_frame_cfa
# DW_AT_GNU_all_call_sites
.uleb128 0x8 # (DIE (0xbf) DW_TAG_variable)
.long .LASF6 # DW_AT_name: "answer"
.byte 0x1 # DW_AT_decl_file (tailcall-only.c)
.byte 0x2f # DW_AT_decl_line
.long 0x3a # DW_AT_type
.long .LLST0 # DW_AT_location
.uleb128 0x9 # (DIE (0xce) DW_TAG_GNU_call_site)
.long .LVL3 # DW_AT_low_pc
.long 0x87 # DW_AT_abstract_origin
.byte 0 # end of children of DIE 0xaa
.byte 0 # end of children of DIE 0xb
.section .debug_abbrev,"",@progbits
.Ldebug_abbrev0:
.uleb128 0x1 # (abbrev code)
.uleb128 0x11 # (TAG: DW_TAG_compile_unit)
.byte 0x1 # DW_children_yes
.uleb128 0x25 # (DW_AT_producer)
.uleb128 0xe # (DW_FORM_strp)
.uleb128 0x13 # (DW_AT_language)
.uleb128 0xb # (DW_FORM_data1)
.uleb128 0x3 # (DW_AT_name)
.uleb128 0xe # (DW_FORM_strp)
.uleb128 0x1b # (DW_AT_comp_dir)
.uleb128 0xe # (DW_FORM_strp)
.uleb128 0x55 # (DW_AT_ranges)
.uleb128 0x17 # (DW_FORM_sec_offset)
.uleb128 0x11 # (DW_AT_low_pc)
.uleb128 0x1 # (DW_FORM_addr)
.uleb128 0x10 # (DW_AT_stmt_list)
.uleb128 0x17 # (DW_FORM_sec_offset)
.byte 0
.byte 0
.uleb128 0x2 # (abbrev code)
.uleb128 0x2e # (TAG: DW_TAG_subprogram)
.byte 0 # DW_children_no
.uleb128 0x3 # (DW_AT_name)
.uleb128 0xe # (DW_FORM_strp)
.uleb128 0x3a # (DW_AT_decl_file)
.uleb128 0xb # (DW_FORM_data1)
.uleb128 0x3b # (DW_AT_decl_line)
.uleb128 0xb # (DW_FORM_data1)
.uleb128 0x27 # (DW_AT_prototyped)
.uleb128 0x19 # (DW_FORM_flag_present)
.uleb128 0x49 # (DW_AT_type)
.uleb128 0x13 # (DW_FORM_ref4)
.uleb128 0x11 # (DW_AT_low_pc)
.uleb128 0x1 # (DW_FORM_addr)
.uleb128 0x12 # (DW_AT_high_pc)
.uleb128 0x6 # (DW_FORM_data4)
.uleb128 0x40 # (DW_AT_frame_base)
.uleb128 0x18 # (DW_FORM_exprloc)
.uleb128 0x2117 # (DW_AT_GNU_all_call_sites)
.uleb128 0x19 # (DW_FORM_flag_present)
.byte 0
.byte 0
.uleb128 0x3 # (abbrev code)
.uleb128 0x24 # (TAG: DW_TAG_base_type)
.byte 0 # DW_children_no
.uleb128 0xb # (DW_AT_byte_size)
.uleb128 0xb # (DW_FORM_data1)
.uleb128 0x3e # (DW_AT_encoding)
.uleb128 0xb # (DW_FORM_data1)
.uleb128 0x3 # (DW_AT_name)
.uleb128 0x8 # (DW_FORM_string)
.byte 0
.byte 0
.uleb128 0x4 # (abbrev code)
.uleb128 0x2e # (TAG: DW_TAG_subprogram)
.byte 0x1 # DW_children_yes
.uleb128 0x3 # (DW_AT_name)
.uleb128 0x8 # (DW_FORM_string)
.uleb128 0x3a # (DW_AT_decl_file)
.uleb128 0xb # (DW_FORM_data1)
.uleb128 0x3b # (DW_AT_decl_line)
.uleb128 0xb # (DW_FORM_data1)
.uleb128 0x27 # (DW_AT_prototyped)
.uleb128 0x19 # (DW_FORM_flag_present)
.uleb128 0x49 # (DW_AT_type)
.uleb128 0x13 # (DW_FORM_ref4)
.uleb128 0x11 # (DW_AT_low_pc)
.uleb128 0x1 # (DW_FORM_addr)
.uleb128 0x12 # (DW_AT_high_pc)
.uleb128 0x6 # (DW_FORM_data4)
.uleb128 0x40 # (DW_AT_frame_base)
.uleb128 0x18 # (DW_FORM_exprloc)
.uleb128 0x2117 # (DW_AT_GNU_all_call_sites)
.uleb128 0x19 # (DW_FORM_flag_present)
.uleb128 0x1 # (DW_AT_sibling)
.uleb128 0x13 # (DW_FORM_ref4)
.byte 0
.byte 0
.uleb128 0x5 # (abbrev code)
.uleb128 0x4109 # (TAG: DW_TAG_GNU_call_site)
.byte 0 # DW_children_no
.uleb128 0x11 # (DW_AT_low_pc)
.uleb128 0x1 # (DW_FORM_addr)
.uleb128 0x2115 # (DW_AT_GNU_tail_call)
.uleb128 0x19 # (DW_FORM_flag_present)
.uleb128 0x31 # (DW_AT_abstract_origin)
.uleb128 0x13 # (DW_FORM_ref4)
.byte 0
.byte 0
.uleb128 0x6 # (abbrev code)
.uleb128 0x2e # (TAG: DW_TAG_subprogram)
.byte 0x1 # DW_children_yes
.uleb128 0x3 # (DW_AT_name)
.uleb128 0xe # (DW_FORM_strp)
.uleb128 0x3a # (DW_AT_decl_file)
.uleb128 0xb # (DW_FORM_data1)
.uleb128 0x3b # (DW_AT_decl_line)
.uleb128 0xb # (DW_FORM_data1)
.uleb128 0x27 # (DW_AT_prototyped)
.uleb128 0x19 # (DW_FORM_flag_present)
.uleb128 0x49 # (DW_AT_type)
.uleb128 0x13 # (DW_FORM_ref4)
.uleb128 0x11 # (DW_AT_low_pc)
.uleb128 0x1 # (DW_FORM_addr)
.uleb128 0x12 # (DW_AT_high_pc)
.uleb128 0x6 # (DW_FORM_data4)
.uleb128 0x40 # (DW_AT_frame_base)
.uleb128 0x18 # (DW_FORM_exprloc)
.uleb128 0x2117 # (DW_AT_GNU_all_call_sites)
.uleb128 0x19 # (DW_FORM_flag_present)
.uleb128 0x1 # (DW_AT_sibling)
.uleb128 0x13 # (DW_FORM_ref4)
.byte 0
.byte 0
.uleb128 0x7 # (abbrev code)
.uleb128 0x2e # (TAG: DW_TAG_subprogram)
.byte 0x1 # DW_children_yes
.uleb128 0x3f # (DW_AT_external)
.uleb128 0x19 # (DW_FORM_flag_present)
.uleb128 0x3 # (DW_AT_name)
.uleb128 0xe # (DW_FORM_strp)
.uleb128 0x3a # (DW_AT_decl_file)
.uleb128 0xb # (DW_FORM_data1)
.uleb128 0x3b # (DW_AT_decl_line)
.uleb128 0xb # (DW_FORM_data1)
.uleb128 0x27 # (DW_AT_prototyped)
.uleb128 0x19 # (DW_FORM_flag_present)
.uleb128 0x49 # (DW_AT_type)
.uleb128 0x13 # (DW_FORM_ref4)
.uleb128 0x11 # (DW_AT_low_pc)
.uleb128 0x1 # (DW_FORM_addr)
.uleb128 0x12 # (DW_AT_high_pc)
.uleb128 0x6 # (DW_FORM_data4)
.uleb128 0x40 # (DW_AT_frame_base)
.uleb128 0x18 # (DW_FORM_exprloc)
.uleb128 0x2117 # (DW_AT_GNU_all_call_sites)
.uleb128 0x19 # (DW_FORM_flag_present)
.byte 0
.byte 0
.uleb128 0x8 # (abbrev code)
.uleb128 0x34 # (TAG: DW_TAG_variable)
.byte 0 # DW_children_no
.uleb128 0x3 # (DW_AT_name)
.uleb128 0xe # (DW_FORM_strp)
.uleb128 0x3a # (DW_AT_decl_file)
.uleb128 0xb # (DW_FORM_data1)
.uleb128 0x3b # (DW_AT_decl_line)
.uleb128 0xb # (DW_FORM_data1)
.uleb128 0x49 # (DW_AT_type)
.uleb128 0x13 # (DW_FORM_ref4)
.uleb128 0x2 # (DW_AT_location)
.uleb128 0x17 # (DW_FORM_sec_offset)
.byte 0
.byte 0
.uleb128 0x9 # (abbrev code)
.uleb128 0x4109 # (TAG: DW_TAG_GNU_call_site)
.byte 0 # DW_children_no
.uleb128 0x11 # (DW_AT_low_pc)
.uleb128 0x1 # (DW_FORM_addr)
.uleb128 0x31 # (DW_AT_abstract_origin)
.uleb128 0x13 # (DW_FORM_ref4)
.byte 0
.byte 0
.byte 0
.section .debug_loc,"",@progbits
.Ldebug_loc0:
.LLST0:
.long .LVL3 # Location list begin address (*.LLST0)
.long .LVL4 # Location list end address (*.LLST0)
.value 0x3 # Location expression size
.byte 0x70 # DW_OP_breg0
.sleb128 1
.byte 0x9f # DW_OP_stack_value
.long .LVL4 # Location list begin address (*.LLST0)
.long .LFE4 # Location list end address (*.LLST0)
.value 0x1 # Location expression size
.byte 0x50 # DW_OP_reg0
.long 0 # Location list terminator begin (*.LLST0)
.long 0 # Location list terminator end (*.LLST0)
.section .debug_aranges,"",@progbits
.long 0x24 # Length of Address Ranges Info
.value 0x2 # DWARF Version
.long .Ldebug_info0 # Offset of Compilation Unit Info
.byte 0x4 # Size of Address
.byte 0 # Size of Segment Descriptor
.value 0 # Pad to 8 byte boundary
.value 0
.long .Ltext0 # Address
.long .Letext0-.Ltext0 # Length
.long .LFB4 # Address
.long .LFE4-.LFB4 # Length
.long 0
.long 0
.section .debug_ranges,"",@progbits
.Ldebug_ranges0:
.long .Ltext0 # Offset 0
.long .Letext0
.long .LFB4 # Offset 0x8
.long .LFE4
.long 0
.long 0
.section .debug_line,"",@progbits
.Ldebug_line0:
.section .debug_str,"MS",@progbits,1
.LASF4:
.string "bar_1"
.LASF2:
.string "tailcall-only.c"
.LASF1:
.string "GNU C 4.8.3 20140911 (Red Hat 4.8.3-9) -m32 -march=i686 -g -O2"
.LASF6:
.string "answer"
.LASF5:
.string "main"
.LASF3:
.string ""
.LASF0:
.string "foo_1"
.ident "GCC: (GNU) 4.8.3 20140911 (Red Hat 4.8.3-9)"
.section .note.GNU-stack,"",@progbits

View File

@@ -0,0 +1,53 @@
/* This testcase is part of GDB, the GNU debugger.
Copyright 2016 Free Software Foundation, Inc.
Contributed by Intel Corp. <markus.t.metzger@intel.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
static __attribute__ ((noinline)) int
bar_1 (void)
{
return 42;
}
static __attribute__ ((noinline)) int
bar (void)
{
return bar_1 ();
}
static __attribute__ ((noinline)) int
foo_1 (void)
{
return bar ();
}
static __attribute__ ((noinline)) int
foo (void)
{
return foo_1 ();
}
int
main (void)
{
int answer;
answer = foo ();
answer += 1;
return answer;
}

View File

@@ -0,0 +1,97 @@
# This testcase is part of GDB, the GNU debugger.
#
# Copyright 2016 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
#
# This is a variant of tailcall.exp where the entire trace contains only tail
# calls. This used to cause a crash in get_frame_type.
#
# check for btrace support
if { [skip_btrace_tests] } { return -1 }
# This test requires the compiler to generate a tail call. To guarantee that
# we always get one, we use an assembly source file.
#
# We use different assembly sources based on the target architecture.
#
# Luckily, they are similar enough that a single test script can handle
# both.
set opts {}
if [info exists COMPILE] {
# make check RUNTESTFLAGS="gdb.btrace/tailcall-only.exp COMPILE=1"
standard_testfile tailcall-only.c
lappend opts debug optimize=-O2
} elseif {[istarget "x86_64-*-*"]} {
standard_testfile x86_64-tailcall-only.S
} elseif {[istarget "i?86-*-*"]} {
standard_testfile i686-tailcall-only.S
} else {
verbose "Skipping ${testfile}."
return
}
if [prepare_for_testing tailcall-only.exp $testfile $srcfile $opts] {
return -1
}
if ![runto_main] {
return -1
}
# we want to see the full trace for this test
gdb_test_no_output "set record function-call-history-size 0"
# trace foo
gdb_test "step" ".*" "prepare for recording"
gdb_test_no_output "record btrace"
gdb_test "stepi 4" ".*" "record branch trace"
# for debugging
gdb_test "info record" ".*"
# show the branch trace with calls indented
gdb_test "record function-call-history /c 1" [multi_line \
"1\tfoo" \
"2\t foo_1" \
"3\t bar" \
"4\t bar_1"
] "function-call-history"
# We can step
gdb_test "record goto begin" ".*foo.*"
gdb_test "stepi" ".*foo_1.*" "step into foo_1"
gdb_test "step" ".*bar.*" "step into bar"
gdb_test "stepi" ".*bar_1.*" "step into bar_1"
# We can neither finish nor return.
gdb_test "finish" "Cannot find the caller frame.*"
gdb_test_multiple "return" "return" {
-re "Make .* return now.*y or n. $" {
send_gdb "y\n"
exp_continue
}
-re "Cannot find the caller frame.*$gdb_prompt $" {
pass "return"
}
}
# But we can reverse-finish
gdb_test "reverse-finish" ".*bar.*"
gdb_test "reverse-step" ".*foo_1.*"
# Info frame isn't useful but doesn't crash as it used to.
gdb_test "up" ".*foo.*"
gdb_test "info frame" ".*"

View File

@@ -0,0 +1,446 @@
/* This testcase is part of GDB, the GNU debugger.
Copyright 2016 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
This file has been generated using:
gcc -S -O2 -dA -g tailcall-only.c -o x86_64-tailcall-only.S */
.file "tailcall-only.c"
.text
.Ltext0:
.p2align 4,,15
.type bar_1, @function
bar_1:
.LFB0:
.file 1 "tailcall-only.c"
# tailcall-only.c:22
.loc 1 22 0
.cfi_startproc
# BLOCK 2 freq:10000 seq:0
# PRED: ENTRY [100.0%] (FALLTHRU)
# tailcall-only.c:24
.loc 1 24 0
movl $42, %eax
# SUCC: EXIT [100.0%]
ret
.cfi_endproc
.LFE0:
.size bar_1, .-bar_1
.p2align 4,,15
.type bar, @function
bar:
.LFB1:
# tailcall-only.c:28
.loc 1 28 0
.cfi_startproc
# BLOCK 2 freq:10000 seq:0
# PRED: ENTRY [100.0%] (FALLTHRU)
# tailcall-only.c:29
.loc 1 29 0
jmp bar_1
# SUCC: EXIT [100.0%] (ABNORMAL,SIBCALL)
.LVL0:
.cfi_endproc
.LFE1:
.size bar, .-bar
.p2align 4,,15
.type foo_1, @function
foo_1:
.LFB2:
# tailcall-only.c:34
.loc 1 34 0
.cfi_startproc
# BLOCK 2 freq:10000 seq:0
# PRED: ENTRY [100.0%] (FALLTHRU)
# tailcall-only.c:35
.loc 1 35 0
jmp bar
# SUCC: EXIT [100.0%] (ABNORMAL,SIBCALL)
.LVL1:
.cfi_endproc
.LFE2:
.size foo_1, .-foo_1
.p2align 4,,15
.type foo, @function
foo:
.LFB3:
# tailcall-only.c:40
.loc 1 40 0
.cfi_startproc
# BLOCK 2 freq:10000 seq:0
# PRED: ENTRY [100.0%] (FALLTHRU)
# tailcall-only.c:41
.loc 1 41 0
jmp foo_1
# SUCC: EXIT [100.0%] (ABNORMAL,SIBCALL)
.LVL2:
.cfi_endproc
.LFE3:
.size foo, .-foo
.section .text.startup,"ax",@progbits
.p2align 4,,15
.globl main
.type main, @function
main:
.LFB4:
# tailcall-only.c:46
.loc 1 46 0
.cfi_startproc
# BLOCK 2 freq:10000 seq:0
# PRED: ENTRY [100.0%] (FALLTHRU)
# tailcall-only.c:49
.loc 1 49 0
call foo
.LVL3:
# tailcall-only.c:50
.loc 1 50 0
addl $1, %eax
.LVL4:
# SUCC: EXIT [100.0%]
# tailcall-only.c:53
.loc 1 53 0
ret
.cfi_endproc
.LFE4:
.size main, .-main
.text
.Letext0:
.section .debug_info,"",@progbits
.Ldebug_info0:
.long 0x111 # Length of Compilation Unit Info
.value 0x4 # DWARF version number
.long .Ldebug_abbrev0 # Offset Into Abbrev. Section
.byte 0x8 # Pointer Size (in bytes)
.uleb128 0x1 # (DIE (0xb) DW_TAG_compile_unit)
.long .LASF1 # DW_AT_producer: "GNU C 4.8.3 20140911 (Red Hat 4.8.3-9) -mtune=generic -march=x86-64 -g -O2"
.byte 0x1 # DW_AT_language
.long .LASF2 # DW_AT_name: "tailcall-only.c"
.long .LASF3 # DW_AT_comp_dir: ""
.long .Ldebug_ranges0+0 # DW_AT_ranges
.quad 0 # DW_AT_low_pc
.long .Ldebug_line0 # DW_AT_stmt_list
.uleb128 0x2 # (DIE (0x29) DW_TAG_subprogram)
.long .LASF4 # DW_AT_name: "bar_1"
.byte 0x1 # DW_AT_decl_file (tailcall-only.c)
.byte 0x15 # DW_AT_decl_line
# DW_AT_prototyped
.long 0x46 # DW_AT_type
.quad .LFB0 # DW_AT_low_pc
.quad .LFE0-.LFB0 # DW_AT_high_pc
.uleb128 0x1 # DW_AT_frame_base
.byte 0x9c # DW_OP_call_frame_cfa
# DW_AT_GNU_all_call_sites
.uleb128 0x3 # (DIE (0x46) DW_TAG_base_type)
.byte 0x4 # DW_AT_byte_size
.byte 0x5 # DW_AT_encoding
.ascii "int\0" # DW_AT_name
.uleb128 0x4 # (DIE (0x4d) DW_TAG_subprogram)
.ascii "bar\0" # DW_AT_name
.byte 0x1 # DW_AT_decl_file (tailcall-only.c)
.byte 0x1b # DW_AT_decl_line
# DW_AT_prototyped
.long 0x46 # DW_AT_type
.quad .LFB1 # DW_AT_low_pc
.quad .LFE1-.LFB1 # DW_AT_high_pc
.uleb128 0x1 # DW_AT_frame_base
.byte 0x9c # DW_OP_call_frame_cfa
# DW_AT_GNU_all_call_sites
.long 0x7c # DW_AT_sibling
.uleb128 0x5 # (DIE (0x6e) DW_TAG_GNU_call_site)
.quad .LVL0 # DW_AT_low_pc
# DW_AT_GNU_tail_call
.long 0x29 # DW_AT_abstract_origin
.byte 0 # end of children of DIE 0x4d
.uleb128 0x6 # (DIE (0x7c) DW_TAG_subprogram)
.long .LASF0 # DW_AT_name: "foo_1"
.byte 0x1 # DW_AT_decl_file (tailcall-only.c)
.byte 0x21 # DW_AT_decl_line
# DW_AT_prototyped
.long 0x46 # DW_AT_type
.quad .LFB2 # DW_AT_low_pc
.quad .LFE2-.LFB2 # DW_AT_high_pc
.uleb128 0x1 # DW_AT_frame_base
.byte 0x9c # DW_OP_call_frame_cfa
# DW_AT_GNU_all_call_sites
.long 0xab # DW_AT_sibling
.uleb128 0x5 # (DIE (0x9d) DW_TAG_GNU_call_site)
.quad .LVL1 # DW_AT_low_pc
# DW_AT_GNU_tail_call
.long 0x4d # DW_AT_abstract_origin
.byte 0 # end of children of DIE 0x7c
.uleb128 0x4 # (DIE (0xab) DW_TAG_subprogram)
.ascii "foo\0" # DW_AT_name
.byte 0x1 # DW_AT_decl_file (tailcall-only.c)
.byte 0x27 # DW_AT_decl_line
# DW_AT_prototyped
.long 0x46 # DW_AT_type
.quad .LFB3 # DW_AT_low_pc
.quad .LFE3-.LFB3 # DW_AT_high_pc
.uleb128 0x1 # DW_AT_frame_base
.byte 0x9c # DW_OP_call_frame_cfa
# DW_AT_GNU_all_call_sites
.long 0xda # DW_AT_sibling
.uleb128 0x5 # (DIE (0xcc) DW_TAG_GNU_call_site)
.quad .LVL2 # DW_AT_low_pc
# DW_AT_GNU_tail_call
.long 0x7c # DW_AT_abstract_origin
.byte 0 # end of children of DIE 0xab
.uleb128 0x7 # (DIE (0xda) DW_TAG_subprogram)
# DW_AT_external
.long .LASF5 # DW_AT_name: "main"
.byte 0x1 # DW_AT_decl_file (tailcall-only.c)
.byte 0x2d # DW_AT_decl_line
# DW_AT_prototyped
.long 0x46 # DW_AT_type
.quad .LFB4 # DW_AT_low_pc
.quad .LFE4-.LFB4 # DW_AT_high_pc
.uleb128 0x1 # DW_AT_frame_base
.byte 0x9c # DW_OP_call_frame_cfa
# DW_AT_GNU_all_call_sites
.uleb128 0x8 # (DIE (0xf7) DW_TAG_variable)
.long .LASF6 # DW_AT_name: "answer"
.byte 0x1 # DW_AT_decl_file (tailcall-only.c)
.byte 0x2f # DW_AT_decl_line
.long 0x46 # DW_AT_type
.long .LLST0 # DW_AT_location
.uleb128 0x9 # (DIE (0x106) DW_TAG_GNU_call_site)
.quad .LVL3 # DW_AT_low_pc
.long 0xab # DW_AT_abstract_origin
.byte 0 # end of children of DIE 0xda
.byte 0 # end of children of DIE 0xb
.section .debug_abbrev,"",@progbits
.Ldebug_abbrev0:
.uleb128 0x1 # (abbrev code)
.uleb128 0x11 # (TAG: DW_TAG_compile_unit)
.byte 0x1 # DW_children_yes
.uleb128 0x25 # (DW_AT_producer)
.uleb128 0xe # (DW_FORM_strp)
.uleb128 0x13 # (DW_AT_language)
.uleb128 0xb # (DW_FORM_data1)
.uleb128 0x3 # (DW_AT_name)
.uleb128 0xe # (DW_FORM_strp)
.uleb128 0x1b # (DW_AT_comp_dir)
.uleb128 0xe # (DW_FORM_strp)
.uleb128 0x55 # (DW_AT_ranges)
.uleb128 0x17 # (DW_FORM_sec_offset)
.uleb128 0x11 # (DW_AT_low_pc)
.uleb128 0x1 # (DW_FORM_addr)
.uleb128 0x10 # (DW_AT_stmt_list)
.uleb128 0x17 # (DW_FORM_sec_offset)
.byte 0
.byte 0
.uleb128 0x2 # (abbrev code)
.uleb128 0x2e # (TAG: DW_TAG_subprogram)
.byte 0 # DW_children_no
.uleb128 0x3 # (DW_AT_name)
.uleb128 0xe # (DW_FORM_strp)
.uleb128 0x3a # (DW_AT_decl_file)
.uleb128 0xb # (DW_FORM_data1)
.uleb128 0x3b # (DW_AT_decl_line)
.uleb128 0xb # (DW_FORM_data1)
.uleb128 0x27 # (DW_AT_prototyped)
.uleb128 0x19 # (DW_FORM_flag_present)
.uleb128 0x49 # (DW_AT_type)
.uleb128 0x13 # (DW_FORM_ref4)
.uleb128 0x11 # (DW_AT_low_pc)
.uleb128 0x1 # (DW_FORM_addr)
.uleb128 0x12 # (DW_AT_high_pc)
.uleb128 0x7 # (DW_FORM_data8)
.uleb128 0x40 # (DW_AT_frame_base)
.uleb128 0x18 # (DW_FORM_exprloc)
.uleb128 0x2117 # (DW_AT_GNU_all_call_sites)
.uleb128 0x19 # (DW_FORM_flag_present)
.byte 0
.byte 0
.uleb128 0x3 # (abbrev code)
.uleb128 0x24 # (TAG: DW_TAG_base_type)
.byte 0 # DW_children_no
.uleb128 0xb # (DW_AT_byte_size)
.uleb128 0xb # (DW_FORM_data1)
.uleb128 0x3e # (DW_AT_encoding)
.uleb128 0xb # (DW_FORM_data1)
.uleb128 0x3 # (DW_AT_name)
.uleb128 0x8 # (DW_FORM_string)
.byte 0
.byte 0
.uleb128 0x4 # (abbrev code)
.uleb128 0x2e # (TAG: DW_TAG_subprogram)
.byte 0x1 # DW_children_yes
.uleb128 0x3 # (DW_AT_name)
.uleb128 0x8 # (DW_FORM_string)
.uleb128 0x3a # (DW_AT_decl_file)
.uleb128 0xb # (DW_FORM_data1)
.uleb128 0x3b # (DW_AT_decl_line)
.uleb128 0xb # (DW_FORM_data1)
.uleb128 0x27 # (DW_AT_prototyped)
.uleb128 0x19 # (DW_FORM_flag_present)
.uleb128 0x49 # (DW_AT_type)
.uleb128 0x13 # (DW_FORM_ref4)
.uleb128 0x11 # (DW_AT_low_pc)
.uleb128 0x1 # (DW_FORM_addr)
.uleb128 0x12 # (DW_AT_high_pc)
.uleb128 0x7 # (DW_FORM_data8)
.uleb128 0x40 # (DW_AT_frame_base)
.uleb128 0x18 # (DW_FORM_exprloc)
.uleb128 0x2117 # (DW_AT_GNU_all_call_sites)
.uleb128 0x19 # (DW_FORM_flag_present)
.uleb128 0x1 # (DW_AT_sibling)
.uleb128 0x13 # (DW_FORM_ref4)
.byte 0
.byte 0
.uleb128 0x5 # (abbrev code)
.uleb128 0x4109 # (TAG: DW_TAG_GNU_call_site)
.byte 0 # DW_children_no
.uleb128 0x11 # (DW_AT_low_pc)
.uleb128 0x1 # (DW_FORM_addr)
.uleb128 0x2115 # (DW_AT_GNU_tail_call)
.uleb128 0x19 # (DW_FORM_flag_present)
.uleb128 0x31 # (DW_AT_abstract_origin)
.uleb128 0x13 # (DW_FORM_ref4)
.byte 0
.byte 0
.uleb128 0x6 # (abbrev code)
.uleb128 0x2e # (TAG: DW_TAG_subprogram)
.byte 0x1 # DW_children_yes
.uleb128 0x3 # (DW_AT_name)
.uleb128 0xe # (DW_FORM_strp)
.uleb128 0x3a # (DW_AT_decl_file)
.uleb128 0xb # (DW_FORM_data1)
.uleb128 0x3b # (DW_AT_decl_line)
.uleb128 0xb # (DW_FORM_data1)
.uleb128 0x27 # (DW_AT_prototyped)
.uleb128 0x19 # (DW_FORM_flag_present)
.uleb128 0x49 # (DW_AT_type)
.uleb128 0x13 # (DW_FORM_ref4)
.uleb128 0x11 # (DW_AT_low_pc)
.uleb128 0x1 # (DW_FORM_addr)
.uleb128 0x12 # (DW_AT_high_pc)
.uleb128 0x7 # (DW_FORM_data8)
.uleb128 0x40 # (DW_AT_frame_base)
.uleb128 0x18 # (DW_FORM_exprloc)
.uleb128 0x2117 # (DW_AT_GNU_all_call_sites)
.uleb128 0x19 # (DW_FORM_flag_present)
.uleb128 0x1 # (DW_AT_sibling)
.uleb128 0x13 # (DW_FORM_ref4)
.byte 0
.byte 0
.uleb128 0x7 # (abbrev code)
.uleb128 0x2e # (TAG: DW_TAG_subprogram)
.byte 0x1 # DW_children_yes
.uleb128 0x3f # (DW_AT_external)
.uleb128 0x19 # (DW_FORM_flag_present)
.uleb128 0x3 # (DW_AT_name)
.uleb128 0xe # (DW_FORM_strp)
.uleb128 0x3a # (DW_AT_decl_file)
.uleb128 0xb # (DW_FORM_data1)
.uleb128 0x3b # (DW_AT_decl_line)
.uleb128 0xb # (DW_FORM_data1)
.uleb128 0x27 # (DW_AT_prototyped)
.uleb128 0x19 # (DW_FORM_flag_present)
.uleb128 0x49 # (DW_AT_type)
.uleb128 0x13 # (DW_FORM_ref4)
.uleb128 0x11 # (DW_AT_low_pc)
.uleb128 0x1 # (DW_FORM_addr)
.uleb128 0x12 # (DW_AT_high_pc)
.uleb128 0x7 # (DW_FORM_data8)
.uleb128 0x40 # (DW_AT_frame_base)
.uleb128 0x18 # (DW_FORM_exprloc)
.uleb128 0x2117 # (DW_AT_GNU_all_call_sites)
.uleb128 0x19 # (DW_FORM_flag_present)
.byte 0
.byte 0
.uleb128 0x8 # (abbrev code)
.uleb128 0x34 # (TAG: DW_TAG_variable)
.byte 0 # DW_children_no
.uleb128 0x3 # (DW_AT_name)
.uleb128 0xe # (DW_FORM_strp)
.uleb128 0x3a # (DW_AT_decl_file)
.uleb128 0xb # (DW_FORM_data1)
.uleb128 0x3b # (DW_AT_decl_line)
.uleb128 0xb # (DW_FORM_data1)
.uleb128 0x49 # (DW_AT_type)
.uleb128 0x13 # (DW_FORM_ref4)
.uleb128 0x2 # (DW_AT_location)
.uleb128 0x17 # (DW_FORM_sec_offset)
.byte 0
.byte 0
.uleb128 0x9 # (abbrev code)
.uleb128 0x4109 # (TAG: DW_TAG_GNU_call_site)
.byte 0 # DW_children_no
.uleb128 0x11 # (DW_AT_low_pc)
.uleb128 0x1 # (DW_FORM_addr)
.uleb128 0x31 # (DW_AT_abstract_origin)
.uleb128 0x13 # (DW_FORM_ref4)
.byte 0
.byte 0
.byte 0
.section .debug_loc,"",@progbits
.Ldebug_loc0:
.LLST0:
.quad .LVL3 # Location list begin address (*.LLST0)
.quad .LVL4 # Location list end address (*.LLST0)
.value 0x3 # Location expression size
.byte 0x70 # DW_OP_breg0
.sleb128 1
.byte 0x9f # DW_OP_stack_value
.quad .LVL4 # Location list begin address (*.LLST0)
.quad .LFE4 # Location list end address (*.LLST0)
.value 0x1 # Location expression size
.byte 0x50 # DW_OP_reg0
.quad 0 # Location list terminator begin (*.LLST0)
.quad 0 # Location list terminator end (*.LLST0)
.section .debug_aranges,"",@progbits
.long 0x3c # Length of Address Ranges Info
.value 0x2 # DWARF Version
.long .Ldebug_info0 # Offset of Compilation Unit Info
.byte 0x8 # Size of Address
.byte 0 # Size of Segment Descriptor
.value 0 # Pad to 16 byte boundary
.value 0
.quad .Ltext0 # Address
.quad .Letext0-.Ltext0 # Length
.quad .LFB4 # Address
.quad .LFE4-.LFB4 # Length
.quad 0
.quad 0
.section .debug_ranges,"",@progbits
.Ldebug_ranges0:
.quad .Ltext0 # Offset 0
.quad .Letext0
.quad .LFB4 # Offset 0x10
.quad .LFE4
.quad 0
.quad 0
.section .debug_line,"",@progbits
.Ldebug_line0:
.section .debug_str,"MS",@progbits,1
.LASF4:
.string "bar_1"
.LASF2:
.string "tailcall-only.c"
.LASF1:
.string "GNU C 4.8.3 20140911 (Red Hat 4.8.3-9) -mtune=generic -march=x86-64 -g -O2"
.LASF6:
.string "answer"
.LASF5:
.string "main"
.LASF3:
.string ""
.LASF0:
.string "foo_1"
.ident "GCC: (GNU) 4.8.3 20140911 (Red Hat 4.8.3-9)"
.section .note.GNU-stack,"",@progbits

View File

@@ -32,10 +32,6 @@ gdb_test "print vla1" " = <not allocated>" "print non-allocated vla1"
gdb_breakpoint [gdb_get_line_number "vla2-allocated"]
gdb_continue_to_breakpoint "vla2-allocated"
gdb_test "print vla1" " = \\( *\\( *\\( *0, *0, *0,\[()0, .\]*\\)" \
"print vla1 allocated"
gdb_test "print vla2" " = \\( *\\( *\\( *0, *0, *0,\[()0, .\]*\\)" \
"print vla2 allocated"
gdb_breakpoint [gdb_get_line_number "vla1-filled"]
gdb_continue_to_breakpoint "vla1-filled"
@@ -45,12 +41,8 @@ gdb_test "print vla1" \
# Try to access history values for full vla prints.
gdb_test "print \$1" " = <not allocated>" "print \$1"
gdb_test "print \$2" " = \\( *\\( *\\( *0, *0, *0,\[()0, .\]*\\)" \
"print \$2"
gdb_test "print \$3" " = \\( *\\( *\\( *0, *0, *0,\[()0, .\]*\\)" \
"print \$3"
gdb_test "print \$4" \
" = \\( *\\( *\\( *1311, *1311, *1311,\[()1311, .\]*\\)" "print \$4"
gdb_test "print \$2" \
" = \\( *\\( *\\( *1311, *1311, *1311,\[()1311, .\]*\\)" "print \$2"
gdb_breakpoint [gdb_get_line_number "vla2-filled"]
gdb_continue_to_breakpoint "vla2-filled"
@@ -58,5 +50,5 @@ gdb_test "print vla2(1,43,20)" " = 1311" "print vla2(1,43,20)"
gdb_test "print vla1(1,3,8)" " = 1001" "print vla2(1,3,8)"
# Try to access history values for vla values.
gdb_test "print \$9" " = 1311" "print \$9"
gdb_test "print \$10" " = 1001" "print \$10"
gdb_test "print \$5" " = 1311" "print \$5"
gdb_test "print \$6" " = 1001" "print \$6"

View File

@@ -32,6 +32,8 @@ if ![runto_main] {
gdb_breakpoint [gdb_get_line_number "array2-almost-filled"]
gdb_continue_to_breakpoint "array2-almost-filled"
# array2 size is 296352 bytes.
gdb_test_no_output "set max-value-size 1024*1024"
gdb_test "print array2" " = \\( *\\( *\\( *30, *3, *3,\[()3, .\]*\\)" \
"print array2 in foo after it was filled"
gdb_test "print array2(2,1,1)=20" " = 20" \

View File

@@ -42,6 +42,8 @@ gdb_test "print array1(1, 1)" " = 30" \
gdb_breakpoint [gdb_get_line_number "array2-almost-filled"]
gdb_continue_to_breakpoint "array2-almost-filled (1st)"
# array2 size is 296352 bytes.
gdb_test_no_output "set max-value-size 1024*1024"
gdb_test "print array2" " = \\( *\\( *\\( *30, *3, *3,\[()3, .\]*\\)" \
"print array2 in foo after it was filled (passed fixed array)"
gdb_test "print array2(2,1,1)=20" " = 20" \

View File

@@ -19,6 +19,7 @@ program vla
real, target, allocatable :: vla3 (:, :)
real, pointer :: pvla (:, :, :)
logical :: l
nullify(pvla)
allocate (vla1 (10,10,10)) ! vla1-init
l = allocated(vla1)

View File

@@ -0,0 +1,31 @@
/* Copyright 2016 Free Software Foundation, Inc.
This file is part of GDB.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include <unistd.h>
int
main ()
{
int i;
for (i = 0; i < 30; i++)
{
sleep (1);
}
return 0;
}

View File

@@ -0,0 +1,50 @@
# Copyright 2016 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
load_lib mi-support.exp
standard_testfile
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
untested "mi-async-run.exp"
return -1
}
# Test the resolution of PR 18077
#
# When doing an -exec-run with a fresh copy of GDB, it would result in
# synchronous execution, even though mi-async was on.
proc test_async_run {} {
global GDBFLAGS
save_vars { GDBFLAGS } {
global binfile
set GDBFLAGS [concat $GDBFLAGS " -ex \"set mi-async on\""]
gdb_exit
if [mi_gdb_start] {
continue
}
mi_gdb_load ${binfile}
mi_run_cmd
mi_gdb_test "123-exec-interrupt --all" "123\\^done" "send interrupt command"
mi_expect_interrupt "expect interrupt"
}
}
test_async_run

View File

@@ -0,0 +1,61 @@
/* This testcase is part of GDB, the GNU debugger.
Copyright 2016 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include <pthread.h>
#include <unistd.h>
#define NUM_THREADS 2
static pthread_barrier_t barrier;
static void *
thread_func (void *v)
{
int i;
pthread_barrier_wait (&barrier);
for (i = 0; i < 100; i++)
sleep (1);
}
static void
all_threads_created (void)
{
}
int
main (void)
{
int i;
pthread_t threads[NUM_THREADS];
/* +1 to account for the main thread */
pthread_barrier_init (&barrier, NULL, NUM_THREADS + 1);
for (i = 0; i < NUM_THREADS; i++)
pthread_create (&threads[i], NULL, thread_func, NULL);
pthread_barrier_wait (&barrier);
all_threads_created ();
for (i = 0; i < 100; i++)
sleep (1);
return 0;
}

View File

@@ -0,0 +1,69 @@
# Copyright 2016 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
load_lib mi-support.exp
set MIFLAGS "-i=mi"
standard_testfile
if {[gdb_compile_pthreads "$srcdir/$subdir/$srcfile" $binfile executable {debug}] != "" } {
return -1
}
# This tests the resolution of PR 20039.
#
# With a multi-threaded inferior and with MI/all-stop, it was not possible
# to interrupt it with ctrl-C after a continue.
proc test_continue_interrupt { } {
global binfile
global async
gdb_exit
if {[mi_gdb_start]} {
continue
}
# Load the binary in gdb...
mi_gdb_load $binfile
# ... and run it.
#
# Note this test relies on mi_runto deleting the breakpoint.
# A step-over here would mask the bug.
mi_runto "all_threads_created"
# Consistency check.
mi_check_thread_states {"stopped" "stopped" "stopped"} "check thread states"
# Continue.
mi_send_resuming_command "exec-continue" "continue"
# Wait a bit to make sure all MI events are sent, before sending the
# interruption request.
sleep 1
# Send the interrupt request.
if { $async } {
mi_gdb_test "888-exec-interrupt" "888\\^done" "interrupt"
} else {
send_gdb "\003"
}
# Wait for the *stopped.
mi_expect_interrupt "interrupt reported"
}
test_continue_interrupt

View File

@@ -21,6 +21,10 @@
# end up leaving stale state behind that confuse the following
# attach).
# Disabled in gdb 7.11.1 because the fix for PR gdb/19828 exposes
# latent inefficiencies that make this test often time out.
return
if {![can_spawn_for_attach]} {
return 0
}

View File

@@ -0,0 +1,66 @@
/* This testcase is part of GDB, the GNU debugger.
Copyright 2016 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#define _GNU_SOURCE
#include <sched.h>
#include <assert.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <unistd.h>
#define STACK_SIZE 0x1000
int clone_pid;
static int
clone_fn (void *unused)
{
/* Wait for alarm. */
while (1)
sleep (1);
return 0;
}
int
main (int argc, char **argv)
{
unsigned char *stack;
int res;
alarm (300);
stack = malloc (STACK_SIZE);
assert (stack != NULL);
#define CLONE_FLAGS (CLONE_THREAD | CLONE_SIGHAND | CLONE_VM)
#ifdef __ia64__
clone_pid = __clone2 (clone_fn, stack, STACK_SIZE, CLONE_FLAGS, NULL);
#else
clone_pid = clone (clone_fn, stack + STACK_SIZE, CLONE_FLAGS, NULL);
#endif
assert (clone_pid > 0);
/* Wait for alarm. */
while (1)
sleep (1);
return 0;
}

View File

@@ -0,0 +1,98 @@
# This testcase is part of GDB, the GNU debugger.
# Copyright 2016 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# Test attach / detach from a process that uses raw clone. We use raw
# clone as proxy for when libthread_db is not available.
# This only works on targets with the Linux kernel.
if ![istarget *-*-linux*] {
return
}
if {![can_spawn_for_attach]} {
return 0
}
standard_testfile
if [prepare_for_testing "failed to prepare" $testfile $srcfile {debug}] {
return -1
}
clean_restart ${binfile}
set test_spawn_id [spawn_wait_for_attach $binfile]
set testpid [spawn_id_get_pid $test_spawn_id]
# Native/gdbserver.
set thread_re "(LWP $decimal|Thread )"
# Try attach / detach a few times, in case GDB ends up with stale
# state after detaching.
set attempts 3
for {set attempt 1} {$attempt <= $attempts} {incr attempt} {
with_test_prefix "fg attach $attempt" {
gdb_test "attach $testpid" \
"Attaching to program.*process $testpid.*" \
"attach"
gdb_test "info threads" \
"1.*${thread_re}.*\r\n.*2.*${thread_re}.*" \
"info threads shows two LWPs"
gdb_test "detach" "Detaching from .*, process $testpid"
}
}
# Same, but use async/background attach.
# If debugging with target remote, check whether the all-stop variant
# of the RSP is being used. If so, we can't run the background tests.
if {[target_info exists gdb_protocol]
&& ([target_info gdb_protocol] == "remote"
|| [target_info gdb_protocol] == "extended-remote")} {
set test "maint show target-non-stop"
gdb_test_multiple "maint show target-non-stop" $test {
-re "(is|currently) on.*$gdb_prompt $" {
}
-re "(is|currently) off.*$gdb_prompt $" {
unsupported "bg attach: can't issue info threads while target is running"
return 0
}
}
}
set attempts 3
for {set attempt 1} {$attempt <= $attempts} {incr attempt} {
with_test_prefix "bg attach $attempt" {
gdb_test "attach $testpid &" \
"Attaching to program.*process $testpid.*" \
"attach"
gdb_test "info threads" \
"1.*${thread_re}.*\\(running\\)\r\n.*2.*${thread_re}.*\\(running\\)" \
"info threads shows two LWPs"
gdb_test "detach" "Detaching from .*, process $testpid"
}
}
kill_wait_spawned_process $test_spawn_id

View File

@@ -100,12 +100,6 @@ proc do_test { cond_bp_target detach_on_fork displaced } {
set fork_count 0
set ok 0
if {$displaced == "off"
&& [target_info exists gdb_protocol]
&& ([target_info gdb_protocol] == "remote"
|| [target_info gdb_protocol] == "extended-remote")} {
setup_kfail "remote/19496" *-*-*
}
set test "inferior 1 exited"
gdb_test_multiple "" $test {
-re "Inferior 1 \(\[^\r\n\]+\) exited normally" {

View File

@@ -1 +1 @@
7.10.50.DATE-git
7.11.1