]> git.ipfire.org Git - thirdparty/binutils-gdb.git/log
thirdparty/binutils-gdb.git
8 years agoRemove assert on exec_bfd in cris_delayed_get_disassembler
Yao Qi [Mon, 12 Dec 2016 09:09:43 +0000 (09:09 +0000)] 
Remove assert on exec_bfd in cris_delayed_get_disassembler

cris_delayed_get_disassembler has an assert that exec_bfd can't be
NULL, but this assert can be triggered like this,

(gdb) set architecture cris
The target architecture is assumed to be cris
(gdb) disassemble 0x0,+4
Dump of assembler code from 0x0 to 0x4:
   0x00000000:
../../binutils-gdb/gdb/cris-tdep.c:3798: internal-error: int cris_delayed_get_disassembler(bfd_vma, disassemble_info*): Assertion `exec_bfd != NULL' failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.

however, cris_get_disassembler does have code to handle the case that
bfd is NULL,

  /* If there's no bfd in sight, we return what is valid as input in all
     contexts if fed back to the assembler: disassembly *with* register
     prefix.  Unfortunately this will be totally wrong for v32.  */
  if (abfd == NULL)
    return print_insn_cris_with_register_prefix;

This patch is to remove this assert.

gdb:

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

PR tdep/20955
* cris-tdep.c (cris_delayed_get_disassembler): Remove the
assert.

8 years agoAutomatic date update in version.in
GDB Administrator [Mon, 12 Dec 2016 00:00:42 +0000 (00:00 +0000)] 
Automatic date update in version.in

8 years agoAutomatic date update in version.in
GDB Administrator [Sun, 11 Dec 2016 00:00:48 +0000 (00:00 +0000)] 
Automatic date update in version.in

8 years agoAutomatic date update in version.in
GDB Administrator [Sat, 10 Dec 2016 00:00:47 +0000 (00:00 +0000)] 
Automatic date update in version.in

8 years agoCreate tdep->rx_psw_type and tdep->rx_fpsw_type lazily
Yao Qi [Fri, 9 Dec 2016 15:53:58 +0000 (15:53 +0000)] 
Create tdep->rx_psw_type and tdep->rx_fpsw_type lazily

I build GDB with all targets enabled, and "set architecture rx",
GDB crashes,

(gdb) set architecture rx

Program received signal SIGSEGV, Segmentation fault.
append_flags_type_flag (type=0x20cc360, bitpos=bitpos@entry=0, name=name@entry=0xd27529 "C") at ../../binutils-gdb/gdb/gdbtypes.c:4926
4926                               name);
(gdb) bt 10
 #0  append_flags_type_flag (type=0x20cc360, bitpos=bitpos@entry=0, name=name@entry=0xd27529 "C") at ../../binutils-gdb/gdb/gdbtypes.c:4926
 #1  0x00000000004ce725 in rx_gdbarch_init (info=..., arches=<optimized out>) at ../../binutils-gdb/gdb/rx-tdep.c:1051
 #2  0x00000000006b05a4 in gdbarch_find_by_info (info=...) at ../../binutils-gdb/gdb/gdbarch.c:5269
 #3  0x000000000060eee4 in gdbarch_update_p (info=...) at ../../binutils-gdb/gdb/arch-utils.c:557
 #4  0x000000000060f8a8 in set_architecture (ignore_args=<optimized out>, from_tty=1, c=<optimized out>) at ../../binutils-gdb/gdb/arch-utils.c:531
 #5  0x0000000000593d0b in do_set_command (arg=<optimized out>, arg@entry=0x20bee81 "rx ", from_tty=from_tty@entry=1, c=c@entry=0x20b1540)
    at ../../binutils-gdb/gdb/cli/cli-setshow.c:455
 #6  0x00000000007665c3 in execute_command (p=<optimized out>, p@entry=0x20bee70 "set architecture rx ", from_tty=1) at ../../binutils-gdb/gdb/top.c:666
 #7  0x00000000006935f4 in command_handler (command=0x20bee70 "set architecture rx ") at ../../binutils-gdb/gdb/event-top.c:577
 #8  0x00000000006938d8 in command_line_handler (rl=<optimized out>) at ../../binutils-gdb/gdb/event-top.c:767
 #9  0x0000000000692c2c in gdb_rl_callback_handler (rl=0x20be7f0 "") at ../../binutils-gdb/gdb/event-top.c:200

The cause is that we want to access some builtin types in gdbarch init, but
it is not initialized yet.  I fix it by creating the type when it is to be
used.  We've already done this in sparc, sparc64 and m68k.

gdb:

2016-12-09  Yao Qi  <yao.qi@linaro.org>

PR tdep/20954
* rx-tdep.c (rx_psw_type): New function.
(rx_fpsw_type): New function.
(rx_register_type): Call rx_psw_type and rx_fpsw_type.
(rx_gdbarch_init): Move code to rx_psw_type and
rx_fpsw_type.

8 years agoCreate tdep->rl78_psw_type lazily
Yao Qi [Fri, 9 Dec 2016 15:52:37 +0000 (15:52 +0000)] 
Create tdep->rl78_psw_type lazily

I build GDB for all targets enabled.  When I "set architecture rl78",
GDB crashes,

(gdb) set architecture rl78

Program received signal SIGSEGV, Segmentation fault.
append_flags_type_flag (type=0x20cc0e0, bitpos=bitpos@entry=0, name=name@entry=0x11dba3f "CY") at ../../binutils-gdb/gdb/gdbtypes.c:4926
4926                               name);
(gdb) bt 10
 #0  append_flags_type_flag (type=0x20cc0e0, bitpos=bitpos@entry=0, name=name@entry=0x11dba3f "CY") at ../../binutils-gdb/gdb/gdbtypes.c:4926
 #1  0x00000000004aaca8 in rl78_gdbarch_init (info=..., arches=<optimized out>) at ../../binutils-gdb/gdb/rl78-tdep.c:1410
 #2  0x00000000006b05a4 in gdbarch_find_by_info (info=...) at ../../binutils-gdb/gdb/gdbarch.c:5269
 #3  0x000000000060eee4 in gdbarch_update_p (info=...) at ../../binutils-gdb/gdb/arch-utils.c:557
 #4  0x000000000060f8a8 in set_architecture (ignore_args=<optimized out>, from_tty=1, c=<optimized out>) at ../../binutils-gdb/gdb/arch-utils.c:531
 #5  0x0000000000593d0b in do_set_command (arg=<optimized out>, arg@entry=0x20be851 "rl78", from_tty=from_tty@entry=1, c=c@entry=0x20b1540)
    at ../../binutils-gdb/gdb/cli/cli-setshow.c:455
 #6  0x00000000007665c3 in execute_command (p=<optimized out>, p@entry=0x20be840 "set architecture rl78", from_tty=1) at ../../binutils-gdb/gdb/top.c:666
 #7  0x00000000006935f4 in command_handler (command=0x20be840 "set architecture rl78") at ../../binutils-gdb/gdb/event-top.c:577
 #8  0x00000000006938d8 in command_line_handler (rl=<optimized out>) at ../../binutils-gdb/gdb/event-top.c:767
 #9  0x0000000000692c2c in gdb_rl_callback_handler (rl=0x20be890 "") at ../../binutils-gdb/gdb/event-top.c:200

The cause is that we want to access some builtin types in gdbarch init, but
it is not initialized yet.  I fix it by creating the type when it is to be
used.  We've already done this in sparc, sparc64 and m68k.

gdb:

2016-12-09  Yao Qi  <yao.qi@linaro.org>

PR tdep/20953
* rl78-tdep.c (rl78_psw_type): New function.
(rl78_register_type): Call rl78_psw_type.
(rl78_gdbarch_init): Move code to rl78_psw_type.

8 years agoAutomatic date update in version.in
GDB Administrator [Fri, 9 Dec 2016 00:00:47 +0000 (00:00 +0000)] 
Automatic date update in version.in

8 years agoAutomatic date update in version.in
GDB Administrator [Thu, 8 Dec 2016 00:00:56 +0000 (00:00 +0000)] 
Automatic date update in version.in

8 years agoAutomatic date update in version.in
GDB Administrator [Wed, 7 Dec 2016 00:00:49 +0000 (00:00 +0000)] 
Automatic date update in version.in

8 years agoAutomatic date update in version.in
GDB Administrator [Tue, 6 Dec 2016 00:01:22 +0000 (00:01 +0000)] 
Automatic date update in version.in

8 years agoAutomatic date update in version.in
GDB Administrator [Mon, 5 Dec 2016 00:01:11 +0000 (00:01 +0000)] 
Automatic date update in version.in

8 years agoAutomatic date update in version.in users/ARM/embedded-gdb-7.12-branch-2016q4
GDB Administrator [Sun, 4 Dec 2016 00:01:07 +0000 (00:01 +0000)] 
Automatic date update in version.in

8 years agoAutomatic date update in version.in
GDB Administrator [Sat, 3 Dec 2016 00:01:11 +0000 (00:01 +0000)] 
Automatic date update in version.in

8 years agoAutomatic date update in version.in
GDB Administrator [Fri, 2 Dec 2016 00:00:58 +0000 (00:00 +0000)] 
Automatic date update in version.in

8 years agoAutomatic date update in version.in
GDB Administrator [Thu, 1 Dec 2016 00:00:50 +0000 (00:00 +0000)] 
Automatic date update in version.in

8 years agoAutomatic date update in version.in
GDB Administrator [Wed, 30 Nov 2016 00:00:46 +0000 (00:00 +0000)] 
Automatic date update in version.in

8 years agoAutomatic date update in version.in
GDB Administrator [Tue, 29 Nov 2016 00:00:45 +0000 (00:00 +0000)] 
Automatic date update in version.in

8 years agoAutomatic date update in version.in
GDB Administrator [Mon, 28 Nov 2016 00:00:45 +0000 (00:00 +0000)] 
Automatic date update in version.in

8 years agoAutomatic date update in version.in
GDB Administrator [Sun, 27 Nov 2016 00:00:53 +0000 (00:00 +0000)] 
Automatic date update in version.in

8 years agoAutomatic date update in version.in
GDB Administrator [Sat, 26 Nov 2016 00:00:43 +0000 (00:00 +0000)] 
Automatic date update in version.in

8 years agoAutomatic date update in version.in
GDB Administrator [Fri, 25 Nov 2016 00:00:31 +0000 (00:00 +0000)] 
Automatic date update in version.in

8 years agoAutomatic date update in version.in
GDB Administrator [Thu, 24 Nov 2016 00:00:57 +0000 (00:00 +0000)] 
Automatic date update in version.in

8 years agoAutomatic date update in version.in
GDB Administrator [Wed, 23 Nov 2016 00:00:56 +0000 (00:00 +0000)] 
Automatic date update in version.in

8 years agoAutomatic date update in version.in
GDB Administrator [Tue, 22 Nov 2016 00:00:43 +0000 (00:00 +0000)] 
Automatic date update in version.in

8 years agoAutomatic date update in version.in
GDB Administrator [Mon, 21 Nov 2016 00:00:54 +0000 (00:00 +0000)] 
Automatic date update in version.in

8 years agoAutomatic date update in version.in
GDB Administrator [Sun, 20 Nov 2016 00:00:48 +0000 (00:00 +0000)] 
Automatic date update in version.in

8 years agoAutomatic date update in version.in
GDB Administrator [Sat, 19 Nov 2016 00:00:56 +0000 (00:00 +0000)] 
Automatic date update in version.in

8 years agoAutomatic date update in version.in
GDB Administrator [Fri, 18 Nov 2016 00:00:47 +0000 (00:00 +0000)] 
Automatic date update in version.in

8 years agoAutomatic date update in version.in
GDB Administrator [Thu, 17 Nov 2016 00:00:42 +0000 (00:00 +0000)] 
Automatic date update in version.in

8 years agoAutomatic date update in version.in
GDB Administrator [Wed, 16 Nov 2016 00:00:45 +0000 (00:00 +0000)] 
Automatic date update in version.in

8 years agoAutomatic date update in version.in
GDB Administrator [Tue, 15 Nov 2016 00:00:45 +0000 (00:00 +0000)] 
Automatic date update in version.in

8 years agoAutomatic date update in version.in
GDB Administrator [Mon, 14 Nov 2016 00:00:43 +0000 (00:00 +0000)] 
Automatic date update in version.in

8 years agoAutomatic date update in version.in
GDB Administrator [Sun, 13 Nov 2016 00:00:43 +0000 (00:00 +0000)] 
Automatic date update in version.in

8 years agosim: mips: add PR info to ChangeLog
Mike Frysinger [Sat, 12 Nov 2016 06:02:23 +0000 (01:02 -0500)] 
sim: mips: add PR info to ChangeLog

8 years agoAutomatic date update in version.in
GDB Administrator [Sat, 12 Nov 2016 00:00:40 +0000 (00:00 +0000)] 
Automatic date update in version.in

8 years agosim: mips: fix dv-tx3904cpu build error
Mike Frysinger [Fri, 11 Nov 2016 06:29:21 +0000 (01:29 -0500)] 
sim: mips: fix dv-tx3904cpu build error

When building for mipstx39-rtems4.12 targets, some funcs use SD and CPU
implicitly.  Restore the defines for these to the local sd and cpu vars.

This was broken by the clean up in commit d47f5b30d8481272e9480118bdcb.

Reported-by: Joel Sherrill <joel.sherrill@oarcorp.com>
8 years agosim: mips: fix builds for r3900 cpus due to missing check_u64
Mike Frysinger [Fri, 11 Nov 2016 06:28:36 +0000 (01:28 -0500)] 
sim: mips: fix builds for r3900 cpus due to missing check_u64

8 years agoAutomatic date update in version.in
GDB Administrator [Fri, 11 Nov 2016 00:00:36 +0000 (00:00 +0000)] 
Automatic date update in version.in

8 years agoAutomatic date update in version.in
GDB Administrator [Thu, 10 Nov 2016 00:00:47 +0000 (00:00 +0000)] 
Automatic date update in version.in

8 years agoAutomatic date update in version.in
GDB Administrator [Wed, 9 Nov 2016 00:00:48 +0000 (00:00 +0000)] 
Automatic date update in version.in

8 years agoAutomatic date update in version.in
GDB Administrator [Tue, 8 Nov 2016 00:00:54 +0000 (00:00 +0000)] 
Automatic date update in version.in

8 years agoAutomatic date update in version.in
GDB Administrator [Mon, 7 Nov 2016 00:00:45 +0000 (00:00 +0000)] 
Automatic date update in version.in

8 years agoAutomatic date update in version.in
GDB Administrator [Sun, 6 Nov 2016 00:00:46 +0000 (00:00 +0000)] 
Automatic date update in version.in

8 years agoAutomatic date update in version.in
GDB Administrator [Sat, 5 Nov 2016 00:00:43 +0000 (00:00 +0000)] 
Automatic date update in version.in

8 years agoAutomatic date update in version.in
GDB Administrator [Fri, 4 Nov 2016 00:00:44 +0000 (00:00 +0000)] 
Automatic date update in version.in

8 years agoAutomatic date update in version.in
GDB Administrator [Thu, 3 Nov 2016 00:00:45 +0000 (00:00 +0000)] 
Automatic date update in version.in

8 years agoAutomatic date update in version.in
GDB Administrator [Wed, 2 Nov 2016 00:00:38 +0000 (00:00 +0000)] 
Automatic date update in version.in

8 years agoAutomatic date update in version.in
GDB Administrator [Tue, 1 Nov 2016 00:00:44 +0000 (00:00 +0000)] 
Automatic date update in version.in

8 years agoAutomatic date update in version.in
GDB Administrator [Mon, 31 Oct 2016 00:00:43 +0000 (00:00 +0000)] 
Automatic date update in version.in

8 years agoAutomatic date update in version.in
GDB Administrator [Sun, 30 Oct 2016 00:00:44 +0000 (00:00 +0000)] 
Automatic date update in version.in

8 years agoAutomatic date update in version.in
GDB Administrator [Sat, 29 Oct 2016 00:00:41 +0000 (00:00 +0000)] 
Automatic date update in version.in

8 years agoAutomatic date update in version.in
GDB Administrator [Fri, 28 Oct 2016 00:00:46 +0000 (00:00 +0000)] 
Automatic date update in version.in

8 years agoAutomatic date update in version.in
GDB Administrator [Thu, 27 Oct 2016 00:00:39 +0000 (00:00 +0000)] 
Automatic date update in version.in

8 years agoAutomatic date update in version.in
GDB Administrator [Wed, 26 Oct 2016 00:00:42 +0000 (00:00 +0000)] 
Automatic date update in version.in

8 years agoAdded forgotten gdb/ChangeLog entry.
Rainer Orth [Tue, 25 Oct 2016 14:08:04 +0000 (16:08 +0200)] 
Added forgotten gdb/ChangeLog entry.

8 years agoFix gdb C++ compilation on Solaris (PR build/20712)
Rainer Orth [Tue, 25 Oct 2016 13:51:40 +0000 (15:51 +0200)] 
Fix gdb C++ compilation on Solaris (PR build/20712)

gdb 7.12 doesn't compile as C++ (tried with g++ 4.9) on Solaris (tried
10 and 12, sparc and x86).  The following patch (relative to the 7.12
release, though I expect most if not all issues to be present on trunk,
too) fixes this.

Only a few of the changes bear explanation:

* Initially, compilation failed whereever defs.h. was included:

In file included from /vol/src/gnu/gdb/gdb-7.12/gdb/gdb.c:19:0:
/vol/src/gnu/gdb/gdb-7.12/gdb/defs.h:630:33: error: 'double atof(const char*)' conflicts with a previous declaration
 extern double atof (const char *); /* X3.159-1989  4.10.1.1 */
                                 ^
In file included from /usr/include/stdlib.h:17:0,
                 from build-gnulib/import/stdlib.h:36,
                 from /vol/src/gnu/gdb/gdb-7.12/gdb/common/common-defs.h:32,
                 from /vol/src/gnu/gdb/gdb-7.12/gdb/defs.h:28,
                 from /vol/src/gnu/gdb/gdb-7.12/gdb/gdb.c:19:
/vol/gcc-4.9/lib/gcc/i386-pc-solaris2.10/4.9.0/include-fixed/iso/stdlib_iso.h:119:15: note: previous declaration 'double std::atof(const char*)'
 extern double atof(const char *);
               ^

  This is due to this gem in gdb/defs.h which seems to have been present
  like forever:

#ifndef atof
extern double atof (const char *); /* X3.159-1989  4.10.1.1 */
#endif

  In the Solaris headers, the appropriate functions are in namespace std,
  thus the conflict.  I've wrapped the defs.h declaration in !__cplusplus
  to avoid this; perhaps it can go completely instead.

* All the casts are necessary to appease g++ and should be pretty
  obvious.

* The sol-thread.c changes are here to handle

/vol/src/gnu/gdb/gdb-7.12/gdb/sol-thread.c: In function 'void _initialize_sol_thread()':
/vol/src/gnu/gdb/gdb-7.12/gdb/sol-thread.c:1252:36: error: invalid conversion from 'void*' to 'void (*)(int)' [-fpermissive]
   if (!(p_##X = dlsym (dlhandle, #X))) \
                                    ^
/vol/src/gnu/gdb/gdb-7.12/gdb/sol-thread.c:1255:3: note: in expansion of macro 'resolve'
   resolve (td_log);
   ^

  and are modeled after linux-thread-db.c (try_thread_db_load_1).

The patch allowed both 32 and 64-bit C++ builds on sparc-sun-solaris2.10
and i386-pc-solaris2.10 to complete.  The resulting binary hasn't seen
more than a smoke test (invoke it on itself, b main, run) yet.

When investigating the failure to detect -static-libstdc++
support (more below), I found two more issues which only show up with
-Werror:

/vol/src/gnu/gdb/gdb/local/gdb/procfs.c: In function 'ssd* proc_get_LDT_entry(procinfo*, int)':
/vol/src/gnu/gdb/gdb/local/gdb/procfs.c:2487:19: error: variable 'old_chain' set but not used [-Werror=unused-but-set-variable]
   struct cleanup *old_chain = NULL;
                   ^

Unless I'm mistaken, you need to run do_cleanups on every return from
the function.

Afterwards, I ran a 32-bit compilation, which (after adding
--disable-largefile to avoid

In file included from /usr/include/sys/procfs.h:28:0,
                 from /vol/src/gnu/gdb/gdb/local/gdb/i386-sol2-nat.c:23:
/usr/include/sys/old_procfs.h:39:2: error: #error "Cannot use procfs in the large file compilation environment"
 #error "Cannot use procfs in the large file compilation environment"
  ^

and two more instances) revealed

/vol/src/gnu/gdb/gdb/local/gdb/top.c: In function 'void gdb_safe_append_history()':
/vol/src/gnu/gdb/gdb/local/gdb/top.c:1170:59: error: format '%d' expects argument of type 'int', but argument 3 has type 'pid_t {aka long int}' [-Werror=format=]
     = xstrprintf ("%s-gdb%d~", history_filename, getpid ());
                                                           ^

Fixed by casting pid_t to long and printing it as such.

8 years agoAutomatic date update in version.in
GDB Administrator [Tue, 25 Oct 2016 00:00:43 +0000 (00:00 +0000)] 
Automatic date update in version.in

8 years agoPR gdb/20653 - small cleanup in string_to_explicit_location
Tom Tromey [Mon, 24 Oct 2016 11:06:39 +0000 (12:06 +0100)] 
PR gdb/20653 - small cleanup in string_to_explicit_location

This bug points out that string_to_explicit_location compares a char*
against '\0'; whereas comparing against NULL is more normal.

2016-10-24  Tom Tromey  <tom@tromey.com>

PR breakpoints/20653:
* location.c (string_to_explicit_location): Use NULL, not '\0'.

8 years ago[GDBserver] Fix conversion warning
Yao Qi [Mon, 24 Oct 2016 09:59:11 +0000 (10:59 +0100)] 
[GDBserver] Fix conversion warning

I got the following warning if I build GDBserver for aarch64_be-linux-gnu,

git/gdb/gdbserver/linux-aarch64-low.c:1539:39: error: invalid conversion from 'void*' to 'uint32_t* {aka unsigned int*}' [-fpermissive]
   uint32_t *le_buf = xmalloc (byte_len);
                                       ^
The patch is to fix the warning.

gdb/gdbserver:

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

PR server/20733
* linux-aarch64-low.c (append_insns): Cast the return value to
'uint32_t *'.

8 years agoAutomatic date update in version.in
GDB Administrator [Mon, 24 Oct 2016 00:00:40 +0000 (00:00 +0000)] 
Automatic date update in version.in

8 years agoAutomatic date update in version.in
GDB Administrator [Sun, 23 Oct 2016 00:00:42 +0000 (00:00 +0000)] 
Automatic date update in version.in

8 years agoAutomatic date update in version.in
GDB Administrator [Sat, 22 Oct 2016 00:00:42 +0000 (00:00 +0000)] 
Automatic date update in version.in

8 years agoAutomatic date update in version.in
GDB Administrator [Fri, 21 Oct 2016 00:00:40 +0000 (00:00 +0000)] 
Automatic date update in version.in

8 years agoAutomatic date update in version.in
GDB Administrator [Thu, 20 Oct 2016 00:00:42 +0000 (00:00 +0000)] 
Automatic date update in version.in

8 years agoAutomatic date update in version.in
GDB Administrator [Wed, 19 Oct 2016 00:00:42 +0000 (00:00 +0000)] 
Automatic date update in version.in

8 years agoAutomatic date update in version.in
GDB Administrator [Tue, 18 Oct 2016 00:00:45 +0000 (00:00 +0000)] 
Automatic date update in version.in

8 years agoAutomatic date update in version.in
GDB Administrator [Mon, 17 Oct 2016 00:00:45 +0000 (00:00 +0000)] 
Automatic date update in version.in

8 years agoAutomatic date update in version.in
GDB Administrator [Sun, 16 Oct 2016 00:00:46 +0000 (00:00 +0000)] 
Automatic date update in version.in

8 years agoAutomatic date update in version.in
GDB Administrator [Sat, 15 Oct 2016 00:00:39 +0000 (00:00 +0000)] 
Automatic date update in version.in

8 years agoInclude strings.h where available
Eli Zaretskii [Fri, 14 Oct 2016 07:08:25 +0000 (10:08 +0300)] 
Include strings.h where available

gdb/ChangeLog

2016-10-14  Eli Zaretskii  <eliz@gnu.org>

* common/common-defs.h [HAVE_STRINGS_H]: Include strings.h if
available, to get prototypes of 'strcasecmp' and 'strncasecmp'.

(cherry picked from commit 8ffc1bb12a22e548835c9291871ad0eb68b7f6f0)

8 years agoAutomatic date update in version.in
GDB Administrator [Fri, 14 Oct 2016 00:00:48 +0000 (00:00 +0000)] 
Automatic date update in version.in

8 years agoAutomatic date update in version.in
GDB Administrator [Thu, 13 Oct 2016 00:00:49 +0000 (00:00 +0000)] 
Automatic date update in version.in

8 years ago[AArch64] Track FP registers in prologue analyzer
Yao Qi [Wed, 12 Oct 2016 11:38:56 +0000 (12:38 +0100)] 
[AArch64] Track FP registers in prologue analyzer

We don't track FP registers in aarch64 prologue analyzer, so this causes
an internal error when FP registers are saved by "stp" instruction in
prologue (stp d8, d9, [sp,#128]),

 tbreak _Unwind_RaiseException^M
 aarch64-tdep.c:335: internal-error: CORE_ADDR aarch64_analyze_prologue(gdbarch*, CORE_ADDR, CORE_ADDR, aarch64_prologue_cache*): Assertion `inst.operands[0].type == AARCH64_OPND_Rt' failed.^M
 A problem internal to GDB has been detected,

This patch teaches GDB to track FP registers (D registers) in prologue
analyzer.

gdb:

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

PR tdep/20682
* aarch64-tdep.c: Replace 32 with AARCH64_D_REGISTER_COUNT.
(aarch64_analyze_prologue): Extend array 'regs' for D registers.
Assert that operand 0 and 1 can be X or D registers.  Update
register number for D registers.  Update registers in frame
cache.
* aarch64-tdep.h (AARCH64_D_REGISTER_COUNT): New macro.

8 years agoAutomatic date update in version.in
GDB Administrator [Wed, 12 Oct 2016 00:00:42 +0000 (00:00 +0000)] 
Automatic date update in version.in

8 years agoAutomatic date update in version.in
GDB Administrator [Tue, 11 Oct 2016 00:00:42 +0000 (00:00 +0000)] 
Automatic date update in version.in

8 years agoAutomatic date update in version.in
GDB Administrator [Mon, 10 Oct 2016 00:00:44 +0000 (00:00 +0000)] 
Automatic date update in version.in

8 years agoAutomatic date update in version.in
GDB Administrator [Sun, 9 Oct 2016 00:00:53 +0000 (00:00 +0000)] 
Automatic date update in version.in

8 years agoAutomatic date update in version.in
GDB Administrator [Sat, 8 Oct 2016 00:00:40 +0000 (00:00 +0000)] 
Automatic date update in version.in

8 years agoBump GDB version number to 7.12.0.DATE-git.
Joel Brobecker [Fri, 7 Oct 2016 17:27:09 +0000 (10:27 -0700)] 
Bump GDB version number to 7.12.0.DATE-git.

gdb/ChangeLog:

* version.in: Set GDB version number to 7.12.0.DATE-git.

8 years agoDocument the GDB 7.12 release in gdb/ChangeLog
Joel Brobecker [Fri, 7 Oct 2016 17:18:32 +0000 (10:18 -0700)] 
Document the GDB 7.12 release in gdb/ChangeLog

gdb/ChangeLog:

GDB 7.12 released.

8 years agoSet GDB version number to 7.12. gdb-7.12-release
Joel Brobecker [Fri, 7 Oct 2016 17:09:22 +0000 (10:09 -0700)] 
Set GDB version number to 7.12.

gdb/ChangeLog:

* version.in: Set GDB version number to 7.12.

8 years agoAutomatic date update in version.in
GDB Administrator [Fri, 7 Oct 2016 00:00:52 +0000 (00:00 +0000)] 
Automatic date update in version.in

8 years agoframe.h: Forward-declare struct ui_out
Simon Marchi [Thu, 6 Oct 2016 17:01:37 +0000 (13:01 -0400)] 
frame.h: Forward-declare struct ui_out

Fixes this failure when building in C mode.  I think it's relevant for master
as well, since it's a good practice to include (or forward-declare) what you
use.

In file included from ../../binutils-gdb/gdb/gdbarch.h:38:0,
                 from ../../binutils-gdb/gdb/defs.h:653,
                 from ../../binutils-gdb/gdb/dictionary.c:23:
../../binutils-gdb/gdb/frame.h:710:48: warning: ‘struct ui_out’ declared inside parameter list will not be visible outside of this definition or declaration
 extern void print_stack_frame_to_uiout (struct ui_out *uiout,

gdb/ChangeLog:

* frame.h: Forward-declare struct ui_out.

8 years agomips-tdep: Make FCRs always 32-bit
Maciej W. Rozycki [Thu, 6 Oct 2016 15:51:18 +0000 (16:51 +0100)] 
mips-tdep: Make FCRs always 32-bit

Fix a regression from commit f8b73d13b7ca ("Target-described register
support for MIPS"),
<https://sourceware.org/ml/gdb-patches/2007-05/msg00340.html>,
<https://sourceware.org/ml/gdb-patches/2007-06/msg00256.html>, which
caused Floating Point Control Registers (FCRs) to be shown as 64-bit
with 64-bit targets.

This came from the legacy register format where all raw registers
matched the width of the architecture regardless of their actual size.
The correct size was then set in `mips_register_type' for cooked
registers presented to the user, which in the case of FCRs meant the
cooked size was always forced to 32 bits, reflecting their actual
hardware size, even though the raw format carried them in 64-bit
quantities on 64-bit targets.  The upper 32 bits carried in the raw FCR
format have always been don't-cares, not actually retrieved from
hardware and never written back.

With the introduction of XML register descriptions the layout of
previously defined raw registers has been preserved, so as to keep
existing register handling code unchanged and make it easier for GDB and
`gdbserver' to interact with each other whether neither, either or both
parties talking over RSP support XML register descriptions.  For the
XML-described case however `mips_register_type' is not used in raw to
cooked register conversion, so any special cases coded there are not
taken into account.

Instead a new function, `mips_pseudo_register_type', has been introduced
to handle size conversion, however lacking the special case for FCRs for
the Linux and the now defunct IRIX target.  The correct size has been
maintained for embedded targets however, due to the bundling of FCRs
with the embedded registers under the `rawnum >= MIPS_EMBED_FP0_REGNUM +
32' condition.

Add the missing case to `mips_pseudo_register_type' then, referring to
the FCR indices explicitly, and observing that between
`MIPS_EMBED_FP0_REGNUM + 32' and `MIPS_FIRST_EMBED_REGNUM' there is an
unused register slot whose contents are ignored so with the removal of
embedded FCRs from under that condition we don't have to care about it
and we can refer to the embedded registers starting from
MIPS_FIRST_EMBED_REGNUM instead.

Add a test case too so that we have means to check automatically that
the correct user-visible size of FCRs is maintained.

gdb/
* mips-tdep.c (mips_pseudo_register_type): Make FCRs always
32-bit.

gdb/testsuite/
* gdb.arch/mips-fcr.exp: New test.
* gdb.arch/mips-fcr.c: Source for the new test.
(cherry picked from commit 78b86327b5301231005b08a7c589b2b58e6b4322)

8 years agomips-tdep: Rearrange comments in `mips_pseudo_register_type'
Maciej W. Rozycki [Thu, 6 Oct 2016 15:19:38 +0000 (16:19 +0100)] 
mips-tdep: Rearrange comments in `mips_pseudo_register_type'

Rearrange comments throughout `mips_pseudo_register_type', placing them
ahead the condtionals they apply to consistently.

gdb/
* mips-tdep.c (mips_pseudo_register_type): Rearrange comments
throughout.
(cherry picked from commit a6912260f813b1493efefd27cbcb6a73d933accc)

8 years agotestsuite: solib-disc: Use `standard_output_file'
Maciej W. Rozycki [Thu, 6 Oct 2016 14:12:54 +0000 (15:12 +0100)] 
testsuite: solib-disc: Use `standard_output_file'

Correct a commit 2151ccc56c74 ("Always organize test artifacts in a
directory hierarchy") regression causing:

Running .../gdb/testsuite/gdb.base/solib-disc.exp ...
gdb compile failed, Assembler messages:
Fatal error: can't create .../gdb/testsuite/gdb.base/so-disc-shr.c.o: No such file or directory

by using `standard_output_file' to construct output file names
throughout.

gdb/testsuite/
* gdb.base/solib-disc.exp: Use `standard_output_file'
throughout.
(cherry picked from commit 7470adbb872d5363580eb5e0a8dbb231c286ee4c)

8 years agostack: fix gdb.dwarf2/dw2-undefined-ret-addr.exp regression
Markus Metzger [Fri, 22 Jul 2016 08:01:19 +0000 (10:01 +0200)] 
stack: fix gdb.dwarf2/dw2-undefined-ret-addr.exp regression

Commit a038fa3e14a4 stack: check frame_unwind_caller_id adds a frame_id check to
frame_info and treats a missing frame_id as NOT_AVAILABLE_ERROR.  This causes a
regression in gdb.dwarf2/dw2-undefined-ret-addr.exp.

Treat a missing frame_id as OPTIMIZED_OUT_ERROR instead.

See also https://sourceware.org/ml/gdb-patches/2016-07/msg00273.html.

8 years agoFix PR11094: JIT breakpoint is not properly recreated on reruns
Pedro Alves [Thu, 6 Oct 2016 11:57:40 +0000 (12:57 +0100)] 
Fix PR11094: JIT breakpoint is not properly recreated on reruns

Even though this was supposedly in the gdb 7.2 timeframe, the testcase
in PR11094 crashes current GDB with a segfault:

  Program received signal SIGSEGV, Segmentation fault.
  0x00000000005ee894 in event_location_to_string (location=0x0) at
  src/gdb/location.c:412
  412       if (EL_STRING (location) == NULL)
  (top-gdb) bt
  #0  0x00000000005ee894 in event_location_to_string (location=0x0) at
  src/gdb/location.c:412
  #1  0x000000000057411a in print_breakpoint_location (b=0x18288e0, loc=0x0) at
  src/gdb/breakpoint.c:6201
  #2  0x000000000057483f in print_one_breakpoint_location (b=0x18288e0,
  loc=0x182cf10, loc_number=0, last_loc=0x7fffffffd258, allflag=1)
      at src/gdb/breakpoint.c:6473
  #3  0x00000000005751e1 in print_one_breakpoint (b=0x18288e0,
  last_loc=0x7fffffffd258, allflag=1) at
  src/gdb/breakpoint.c:6707
  #4  0x000000000057589c in breakpoint_1 (args=0x0, allflag=1, filter=0x0) at
  src/gdb/breakpoint.c:6947
  #5  0x0000000000575aa8 in maintenance_info_breakpoints (args=0x0, from_tty=0)
  at src/gdb/breakpoint.c:7026
  [...]

This is GDB trying to print the location spec of the JIT event
breakpoint, but that's an internal breakpoint without one.

If I add a NULL check, then we see that the JIT breakpoint is now
pending (because its location has shlib_disabled set):

  (gdb) maint info breakpoints
  Num     Type           Disp Enb Address            What
  [...]
  -8      jit events     keep y   <PENDING>           inf 1
  [...]

But that's incorrect.  GDB should have managed to recreate the JIT
breakpoint's location for the second run.  So the problem is
elsewhere.

The problem is that if the JIT loads at the same address on the second
run, we never recreate the JIT breakpoint, because we hit this early
return:

  static int
  jit_breakpoint_re_set_internal (struct gdbarch *gdbarch,
  struct jit_program_space_data *ps_data)
  {
    [...]
    if (ps_data->cached_code_address == addr)
      return 0;

    [...]
      delete_breakpoint (ps_data->jit_breakpoint);
    [...]
    ps_data->jit_breakpoint = create_jit_event_breakpoint (gdbarch, addr);

Fix this by deleting the breakpoint and discarding the cached code
address when the objfile where the previous JIT breakpoint was found
is deleted/unloaded in the first place.

The test that was originally added for PR11094 doesn't trip on this
because:

  #1 - It doesn't test the case of the JIT descriptor's address _not_
       changing between reruns.

  #2 - And then it doesn't do "maint info breakpoints", or really
       anything with the JIT at all.

  #3 - and even then, to trigger the problem the JIT descriptor needs
       to be in a separate library, while the current test puts it in
       the main program.

The patch extends the test to cover all combinations of these
scenarios.

gdb/ChangeLog:
2016-10-06  Pedro Alves  <palves@redhat.com>

* jit.c (free_objfile_data): Delete the JIT breakpoint and clear
the cached code address.

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

* gdb.base/jit-simple-dl.c: New file.
* gdb.base/jit-simple-jit.c: New file, factored out from ...
* gdb.base/jit-simple.c: ... this.
* gdb.base/jit-simple.exp (jit_run): Delete.
(build_jit): New proc.
(jit_test_reread): Recompile either the main program or the shared
library, depending on what is being tested.  Skip changing address
if caller wants to.  Compare before/after addresses.  If testing
standalone, explicitly load the binary.  Test "maint info
breakpoints".
(top level): Add "standalone vs shared lib" and "change address"
vs "same address" axes.

8 years agoFix a few gdb.base/jit-simple.exp problems
Pedro Alves [Thu, 6 Oct 2016 11:57:39 +0000 (12:57 +0100)] 
Fix a few gdb.base/jit-simple.exp problems

I noticed that we sometimes get this:

  (gdb) print &__jit_debug_descriptor
  $1 = (struct jit_descriptor *) 0x601040 <__jit_debug_descriptor>
  (gdb) PASS: gdb.base/jit-simple.exp: blah 1
  [...]
  (gdb) run
  [...]
  Starting program: build/gdb/testsuite/outputs/gdb.base/jit-simple/jit-simple
  Unsupported JIT protocol version 4 in descriptor (expected 1)

  Breakpoint 2, main () at src/gdb/testsuite/gdb.base/jit-simple.c:36
  36        return 0;
  (gdb) print &__jit_debug_descriptor
  $2 = (struct jit_descriptor *) 0x601040 <__jit_debug_descriptor>
  (gdb) PASS: gdb.base/jit-simple.exp: blah 1

All tests PASSed, but note the "Unsupported JIT protocol version 4"
message.

Also notice that "__jit_debug_descriptor" has the same address before
and after the rerun, while the test is built in a way that should make
that address change between runs.

The test doesn't catch any of this because it doesn't compare
before/after addresses.

And then notice the "blah 1" test messages.  "blah" is clearly a WIP
message, but it should be at least "blah 2" the second time.  :-)

The reason this sometimes happens is that the test recompiles the
program and expects gdb to reload it automaticallyt on "run".  However,
if the original program and the new recompilation happen to be in the
same second, then gdb does not realize that the binary needs to be
reloaded.  (This is an old problem out of scope of this series.)  If
that happens, then GDB ends up using the wrong symbols for the program
that it spawns, reads the JIT descriptor out of the wrong address,
finds garbage, and prints that "unsupported version" notice.

Fix that in the same way gdb.base/reread.exp handles it -- by sleeping
one second before recompiling.

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

* gdb.base/jit-simple.exp (top level) Delete get_compiler_info
call.
(jit_run): Delete.
(jit_test_reread): Use with_test_prefix.  Reload the main binary
explicitly.  Compare the before/after addresses of the JIT
descriptor.

8 years agoAutomatic date update in version.in
GDB Administrator [Thu, 6 Oct 2016 00:00:42 +0000 (00:00 +0000)] 
Automatic date update in version.in

8 years agoAutomatic date update in version.in
GDB Administrator [Wed, 5 Oct 2016 00:00:45 +0000 (00:00 +0000)] 
Automatic date update in version.in

8 years agoAutomatic date update in version.in
GDB Administrator [Tue, 4 Oct 2016 00:00:43 +0000 (00:00 +0000)] 
Automatic date update in version.in

8 years agoIntroduce cleanup to restore current_uiout
Simon Marchi [Fri, 16 Sep 2016 19:44:29 +0000 (15:44 -0400)] 
Introduce cleanup to restore current_uiout

Make a globally available cleanup from a pre-existing one in infrun.c.
This is used in a following patch.

gdb/ChangeLog:

* infrun.c (restore_current_uiout_cleanup): Move to ui-out.c.
(print_stop_event): Use make_cleanup_restore_current_uiout.
* python/python.c (execute_gdb_command): Likewise.
* ui-out.c (restore_current_uiout_cleanup): Move from infrun.c.
(make_cleanup_restore_current_uiout): New function definition.
* ui-out.h (make_cleanup_restore_current_uiout): New function
declaration.
* utils.c (do_restore_ui_out): Remove.
(make_cleanup_restore_ui_out): Remove.
* utils.h (make_cleanup_restore_ui_out): Remove.

8 years agoAdd test for user context selection sync
Antoine Tremblay [Mon, 3 Oct 2016 20:55:35 +0000 (16:55 -0400)] 
Add test for user context selection sync

This patch adds a test to verify that events are sent properly to all
UIs when the user selection context (inferior, thread, frame) changes.

The goal of the C test file is to provide two threads that are stopped with the
same predictable backtrace (so that we can test frame switching).  The barrier
helps us know when the child threads are started.  Then, scheduler-locking is
used to bring each thread one by one to the position we expect them to be
during the test.

gdb/testsuite/ChangeLog:

YYYY-MM-DD  Antoine Tremblay  <antoine.tremblay@ericsson.com>
YYYY-MM-DD  Simon Marchi  <simon.marchi@ericsson.com>

PR gdb/20487
* gdb.mi/user-selected-context-sync.exp: New file.
* gdb.mi/user-selected-context-sync.c: New file.

8 years agoEmit inferior, thread and frame selection events to all UIs
Antoine Tremblay [Mon, 3 Oct 2016 20:52:44 +0000 (16:52 -0400)] 
Emit inferior, thread and frame selection events to all UIs

With this patch, when an inferior, thread or frame is explicitly
selected by the user, notifications will appear on all CLI and MI UIs.
When a GDB console is integrated in a front-end, this allows the
front-end to follow a selection made by the user ont he CLI, and it
informs the user about selection changes made behind the scenes by the
front-end.

This patch addresses PR gdb/20487.

In order to communicate frame changes to the front-end, this patch adds
a new field to the =thread-selected event for the selected frame.  The
idea is that since inferior/thread/frame can be seen as a composition,
it makes sense to send them together in the same event.  The vision
would be to eventually send the inferior information as well, if we find
that it's needed, although the "=thread-selected" event would be
ill-named for that job.

Front-ends need to handle this new field if they want to follow the
frame selection changes that originate from the console.  The format of
the frame attribute is the same as what is found in the *stopped events.

Here's a detailed example for each command and the events they generate:

thread
------

1. CLI command:

     thread 1.3

   MI event:

     =thread-selected,id="3",frame={...}

2. MI command:

     -thread-select 3

   CLI event:

     [Switching to thread 1.3 ...]

3. MI command (CLI-in-MI):

     thread 1.3

   MI event/reply:

     &"thread 1.3\n"
     ~"#0  child_sub_function () ...
     =thread-selected,id="3",frame={level="0",...}
     ^done

frame
-----

1. CLI command:

     frame 1

   MI event:

     =thread-selected,id="3",frame={level="1",...}

2. MI command:

     -stack-select-frame 1

   CLI event:

     #1  0x00000000004007f0 in child_function...

3. MI command (CLI-in-MI):

     frame 1

   MI event/reply:

     &"frame 1\n"
     ~"#1  0x00000000004007f9 in ..."
     =thread-selected,id="3",frame={level="1"...}
     ^done

inferior
--------

Inferior selection events only go from the console to MI, since there's
no way to select the inferior in pure MI.

1. CLI command:

     inferior 2

   MI event:

     =thread-selected,id="3"

Note that if the user selects an inferior that is not started or exited,
the MI doesn't receive a notification.  Since there is no threads to
select, the =thread-selected event does not apply...

2. MI command (CLI-in-MI):

     inferior 2

   MI event/reply:

     &"inferior 2\n"
     ~"[Switching to inferior 2 ...]"
     =thread-selected,id="4",frame={level="0"...}
     ^done

Internal implementation detail: this patch makes it possible to suppress
notifications caused by a CLI command, like what is done in mi-interp.c.
This means that it's now possible to use the
add_com_suppress_notification function to register a command with some
event suppressed.  It is used to implement the select-frame command in
this patch.

The function command_notifies_uscc_observer was added to extract
the rather complicated logical expression from the if statement.  It is
also now clearer what that logic does: if the command used by the user
already notifies the user_selected_context_changed observer, there is
not need to notify it again.  It therefore protects again emitting the
event twice.

No regressions, tested on ubuntu 14.04 x86 with target boards unix and
native-extended-gdbserver.

gdb/ChangeLog:

YYYY-MM-DD  Antoine Tremblay  <antoine.tremblay@ericsson.com>
YYYY-MM-DD  Simon Marchi  <simon.marchi@ericsson.com>

PR gdb/20487
* NEWS: Mention new frame field of =thread-selected event.
* cli/cli-decode.c (add_cmd): Initialize c->suppress_notification.
(add_com_suppress_notification): New function definition.
(cmd_func): Set and restore the suppress_notification flag.
* cli/cli-deicode.h (struct cmd_list_element)
<suppress_notification>: New field.
* cli/cli-interp.c (cli_suppress_notification): New global variable.
(cli_on_user_selected_context_changed): New function.
(_initialize_cli_interp): Attach to user_selected_context_changed
observer.
* command.h (struct cli_suppress_notification): New structure.
(cli_suppress_notification): New global variable declaration.
(add_com_suppress_notification): New function declaration.
* defs.h (enum user_selected_what_flag): New enum.
(user_selected_what): New enum flag type.
* frame.h (print_stack_frame_to_uiout): New function declaration.
* gdbthread.h (print_selected_thread_frame): New function declaration.
* inferior.c (print_selected_inferior): New function definition.
(inferior_command): Remove printing of inferior/thread/frame switch
notifications, notify user_selected_context_changed observer.
* inferior.h (print_selected_inferior): New function declaration.
* mi/mi-cmds.c (struct mi_cmd): Add user_selected_context
suppression to stack-select-frame and thread-select commands.
* mi/mi-interp.c (struct mi_suppress_notification)
<user_selected_context>: Initialize.
(mi_user_selected_context_changed): New function definition.
(_initialize_mi_interp): Attach to user_selected_context_changed.
* mi/mi-main.c (mi_cmd_thread_select): Print thread selection reply.
(mi_execute_command): Handle notification suppression.  Notify
user_selected_context_changed observer on thread change instead of printing
event directly.  Don't send it if command already sends the notification.
(command_notifies_uscc_observer): New function.
(mi_cmd_execute): Don't handle notification suppression.
* mi/mi-main.h (struct mi_suppress_notification)
<user_selected_context>: New field.
* stack.c (print_stack_frame_to_uiout): New function definition.
(select_frame_command): Notify user_selected_context_changed
observer.
(frame_command): Call print_selected_thread_frame if there's no frame
change or notify user_selected_context_changed observer if there is.
(up_command): Notify user_selected_context_changed observer.
(down_command): Likewise.
(_initialize_stack): Suppress user_selected_context notification for
command select-frame.
* thread.c (thread_command): Notify
user_selected_context_changed if the thread has changed, print
thread info directly if it hasn't.
(do_captured_thread_select): Do not print thread switch event.
(print_selected_thread_frame): New function definition.
* tui/tui-interp.c (tui_on_user_selected_context_changed):
New function definition.
(_initialize_tui_interp): Attach to user_selected_context_changed
observer.

gdb/doc/ChangeLog:

PR gdb/20487
* gdb.texinfo (Context management): Update mention of frame
change notifications.
(gdb/mi Async Records): Document frame field in
=thread-select event.
* observer.texi (GDB Observers): New user_selected_context_changed
observer.

gdb/testsuite/ChangeLog:

PR gdb/20487
* gdb.mi/mi-pthreads.exp (check_mi_thread_command_set): Adapt
=thread-select-event check.

8 years agoAutomatic date update in version.in
GDB Administrator [Mon, 3 Oct 2016 00:00:45 +0000 (00:00 +0000)] 
Automatic date update in version.in

8 years agoAutomatic date update in version.in
GDB Administrator [Sun, 2 Oct 2016 00:00:39 +0000 (00:00 +0000)] 
Automatic date update in version.in

8 years agoAutomatic date update in version.in
GDB Administrator [Sat, 1 Oct 2016 00:00:54 +0000 (00:00 +0000)] 
Automatic date update in version.in

8 years agoAutomatic date update in version.in
GDB Administrator [Fri, 30 Sep 2016 00:00:43 +0000 (00:00 +0000)] 
Automatic date update in version.in

8 years agoPR gdb/20609 - attach of JIT-debug-enabled inf 7.11.1 regression
Jan Kratochvil [Thu, 29 Sep 2016 15:38:16 +0000 (17:38 +0200)] 
PR gdb/20609 - attach of JIT-debug-enabled inf 7.11.1 regression

Regression: gdb --pid $(pidof qemu-system-x86_64) stopped working with gdb 7.11.1
https://sourceware.org/bugzilla/show_bug.cgi?id=20609

It was reported for qemu-system-x86_64 but it happens for any multithreaded
inferior with a JIT debugging hook.

136613ef0c6850427317e57be1b644080ff6decb is the first bad commit
Author: Pedro Alves <palves@redhat.com>
    Fix PR gdb/19828: gdb -p <process from a container>: internal error
Message-ID: <cbdf2e04-4fa8-872a-2a23-08c9c1b26e00@redhat.com>
https://sourceware.org/ml/gdb-patches/2016-05/msg00450.html

jit_breakpoint_re_set() is specific by trying to insert a breakpoint into the
main executable, not into a shared library.  During attachment GDB thinks it
needs to use 'breakpoint always-inserted' from
breakpoints_should_be_inserted_now() as a newly attached thread is
'thread_info->executing' due to 'lwp_info->must_set_ptrace_flags' enabled and
the task not yet stopped.  This did not happen before the 'bad commit' above
which adds tracking of such thread.

GDB then fails to insert the breakpoints to invalid address as PIE executable
gets properly relocated during later phase of attachment.  One can see in the
backtraces below:
 -> jit_breakpoint_re_set_internal()
later:
 -> svr4_exec_displacement()

One can suppress the initial breakpoint_re_set() call as there will be another
breakpoint_re_set() done from the final post_create_inferior() call in
setup_inferior().

BTW additionally 'threads_executing' cache bool is somehow stale (somewhere is
missing update_threads_executing()).  I was trying to deal with that in my
first/second attempt below but in my final third attempt (attached) I have
left it as it is.

First attempt trying not to falsely require 'breakpoint always-inserted':
  https://people.redhat.com/jkratoch/rhbz1375553-fix1.patch
Reduced first attempt:
  https://people.redhat.com/jkratoch/rhbz1375553-fix2.patch

The third attempt suppresses breakpoint insertion until PIE executable gets
relocated by svr4_exec_displacement().  Applied.

gdb/ChangeLog
2016-09-29  Jan Kratochvil  <jan.kratochvil@redhat.com>

PR gdb/20609 - attach of JIT-debug-enabled inf 7.11.1 regression
* exec.c (exec_file_locate_attach): Add parameter defer_bp_reset.
Use it.
* gdbcore.h (exec_file_locate_attach): Add parameter defer_bp_reset.
* infcmd.c (setup_inferior): Update caller.
* remote.c (remote_add_inferior): Likewise.

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

PR gdb/20609 - attach of JIT-debug-enabled inf 7.11.1 regression
* gdb.base/jit-attach-pie.c: New file.
* gdb.base/jit-attach-pie.exp: New file.