• R/O
  • HTTP
  • SSH
  • HTTPS

List of commits

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

GNU Binutils with patches for OS216


users/mwk/s390-relro-rel
RSS
Rev. Time Author
4b32e69 users/mwk/s390-relro-rel 2016-07-04 18:04:10 Marcin Kościelnicki

gold/s390: Support partial got relro.

6257e07 2016-07-04 18:04:10 Marcin Kościelnicki

bfd/elf64-s390: Support partial got relro.

6f074b2 2016-07-04 18:04:10 Marcin Kościelnicki

bfd/elf32-s390: Support partial got relro.

137afa2 2016-06-22 20:06:44 Marcin Kościelnicki

bfd/elf32-s390: Prepare for _GLOBAL_OFFSET_TABLE_ != DT_PLTGOT

This will be used for got relro support.

2dacf3e 2016-06-22 20:06:44 Marcin Kościelnicki

bfd/elf64-s390: Prepare for _GLOBAL_OFFSET_TABLE_ != DT_PLTGOT

This will be used for got relro support.

cbbdd10 2016-06-22 20:06:44 Marcin Kościelnicki

ld: Enable using separate linker script for -z relro

This will be used for s390 relro got support.

ld/ChangeLog:

* emultempl/elf32.em: Use .xo, .xso, .xdo scripts if
GENERATE_RELRO_SCRIPT is set.
* genscripts.sh: Create .xo, .xso, .xdo scripts if
GENERATE_RELRO_SCRIPT is set.

6edaf4d 2016-06-22 18:14:08 Trevor Saunders

tilegx: move TILEGX_NUM_PIPELINE_ENCODINGS to tilegx_pipeline enum

Its closely related to what the encodings are, more than a set of random
constants, so it seems to make sense to put it here.

include/ChangeLog:

2016-06-22 Trevor Saunders <tbsaunde+binutils@tbsaunde.org>

* opcode/tilegx.h: Move TILEGX_NUM_PIPELINE_ENCODINGS into
tilegx_pipeline.

b0b7934 2016-06-22 18:10:37 Trevor Saunders

xtensa: include elf/xtensa.h in tc-xtensa.c

There's no reason to define these macros twice.

gas/ChangeLog:

2016-06-22 Trevor Saunders <tbsaunde+binutils@tbsaunde.org>

* config/tc-xtensa.c: Include elf/xtensa.h.

d5b07ef 2016-06-22 17:55:50 Nick Clifton

Increase size of string buffer used to hold printed versions of timestamps.

binutils* readelf.c (dynamic_section_mips_val): Increase size of timebuf.
(process_mips_specific): Likewise.
(process_gnu_liblist): Likewise.

cbf5535 2016-06-22 09:00:09 GDB Administrator

Automatic date update in version.in

41947d9 2016-06-22 07:00:20 Maciej W. Rozycki

MIPS/GAS: Handle resolved R6 PC-relative relocations

Complement commit 7361da2c952e ("Add support for MIPS R6.") and fix
internal errors like:

foo.s: Assembler messages:
foo.s: Internal error!
Assertion failure in md_apply_fix at .../gas/config/tc-mips.c:15028.
Please report this bug.

triggered by resolved R6 PC-relative relocations in sources containing
R6 code fragments wrapped into ISA override blocks embedded within code
otherwise assembled for an older ISA.

gas/
* config/tc-mips.c (calculate_reloc) <BFD_RELOC_HI16_S_PCREL>
<BFD_RELOC_LO16_PCREL>: New switch cases.
(md_apply_fix) <BFD_RELOC_HI16_S_PCREL, BFD_RELOC_LO16_PCREL>:
Move switch cases along `BFD_RELOC_MIPS_JMP'.
<BFD_RELOC_MIPS_21_PCREL_S2, BFD_RELOC_MIPS_26_PCREL_S2>
<BFD_RELOC_MIPS_18_PCREL_S3, BFD_RELOC_MIPS_19_PCREL_S2>: Handle
the resolved case.
* testsuite/gas/mips/pcrel-reloc-4.d: New test.
* testsuite/gas/mips/pcrel-reloc-4-r6.d: New test.
* testsuite/gas/mips/pcrel-reloc-5.d: New test.
* testsuite/gas/mips/pcrel-reloc-5-r6.d: New test.
* testsuite/gas/mips/pcrel-reloc-6.d: New test.
* testsuite/gas/mips/pcrel-reloc-6.l: New list test.
* testsuite/gas/mips/pcrel-reloc-4.s: New test source.
* testsuite/gas/mips/pcrel-reloc-6.s: New test source.
* testsuite/gas/mips/mips.exp: Run the new tests.

717ba20 2016-06-22 07:00:01 Maciej W. Rozycki

MIPS/GAS: Fix null pointer dereferences in R6 PC-relative relocation checks

Avoid segmentation faults in alignment checks made in `md_apply_fix' for
BFD_RELOC_MIPS_18_PCREL_S3 and BFD_RELOC_MIPS_19_PCREL_S2 relocations
caused by dereferencing `fixP->fx_addsy' which will be null if the
relocation processed has been fully resolved.

gas/
* config/tc-mips.c (md_apply_fix) <BFD_RELOC_MIPS_18_PCREL_S3>
<BFD_RELOC_MIPS_19_PCREL_S2>: Avoid null pointer dereferences
via `fixP->fx_addsy'.

51f6035 2016-06-22 06:58:50 Maciej W. Rozycki

MIPS/GAS: Correct BFD_RELOC_MIPS_18_PCREL_S3 calculation

The PC-relative R_MIPS_PC18_S3 relocation and consequently its BFD
internal BFD_RELOC_MIPS_18_PCREL_S3 representation is calculated from
the address of the aligned doubleword containing the location being
relocated: (sign_extend(A) + S - (P & ~0x7)) >> 3 rather than the
address of the location itself. Reflect this in calculations made by
GAS so that the relocated field is set correctly if resolved by GAS,
such as with local symbols in the same section which do not require
relocations to be propagated to the link stage.

gas/
* config/tc-mips.c (md_pcrel_from) <BFD_RELOC_MIPS_18_PCREL_S3>:
Calculate relocation from the containing aligned doubleword.
(tc_gen_reloc) <BFD_RELOC_MIPS_18_PCREL_S3>: Calculate the
addend from the containing aligned doubleword.

912815f 2016-06-22 02:05:18 Maciej W. Rozycki

MIPS/GAS: Use the module level ISA setting for R6 relaxation

Use the module level ISA setting rather than the last ISA selected with
a `.set' directive in the source file in determination as to whether to
keep PC-relative relocations and then with the original symbol referred,
for the purpose of R6 linker relaxation.

This is so that with e.g. code like this:

b foo
.set mips32r2
...

it's the command line options or any `.module' directive that decides
how to encode any relocation for `foo' rather than the presence of `.set
mips32r2'.

gas/
* config/tc-mips.c (mips_force_relocation): Use `file_mips_opts'
rather than `mips_opts' for the R6 ISA check.
(mips_fix_adjustable): Likewise.
* testsuite/gas/mips/pcrel-reloc-1.d: New test.
* testsuite/gas/mips/pcrel-reloc-1-r6.d: New test.
* testsuite/gas/mips/pcrel-reloc-2.d: New test.
* testsuite/gas/mips/pcrel-reloc-2-r6.d: New test.
* testsuite/gas/mips/pcrel-reloc-3.d: New test.
* testsuite/gas/mips/pcrel-reloc-3-r6.d: New test.
* testsuite/gas/mips/pcrel-reloc-1.s: New test source.
* testsuite/gas/mips/mips.exp: Run the new tests.

5f68df2 2016-06-21 22:18:23 Maciej W. Rozycki

MIPS/BFD: Don't stop processing on a cross-mode jump conversion error

As with commit ed53407eec9e ("MIPS/BFD: Don't stop processing on
`bfd_reloc_outofrange'") don't bail out right away and instead continue
processing on a cross-mode jump conversion error, so that any further
issues are also reported. Adjust message formatting accordingly, using
`%X' to abort processing at conclusion. Remove the full stop from the
end of the message, for consistency across error reporting.

Adjust the corresponding test case accordingly and make it trigger the
error twice.

bfd/
* elfxx-mips.c (mips_elf_perform_relocation): Call
`info->callbacks->einfo' rather than `*_bfd_error_handler' and
use the `%X%H' format for the cross-mode jump conversion error
message. Remove the full stop from the end of the message.
Continue processing rather than returning failure.

ld/
* testsuite/ld-mips-elf/mode-change-error-1a.s: Trigger an error
twice rather than once.
* testsuite/ld-mips-elf/mode-change-error-1.d: Adjust
accordingly. Remove the full stop from the end of the message.

04d59df 2016-06-21 22:15:04 Walfred Tedeschi

Improve user experience in printing Fortran derived types.

Output for Fortran derived classes is like:

"( 9, 'abc')"

with this changes the output is changed to:

"( lucky_number = 9, letters = 'abc')"

2016-06-21 Walfred Tedeschi <walfred.tedeschi@intel.com>

* f-valprint.c (f_val_print): Add field names for printing
derived types fields.


gdb/testsuite:

* gdb.fortran/derived-type.exp (print q): Add fields to the output.
* gdb.fortran/vla-type.exp (print twov): Fix vla tests with
structs.
* gdb.fortran/derived-type-function.exp: New file.
* gdb.fortran/derived-type-function.f90: New file.

bdd582d 2016-06-21 22:03:08 Graham Markall

Arc assembler: Convert nps400 from a machine type to an extension.

gas * config/tc-arc.c (check_cpu_feature, md_parse_option):
Add nps400 option and feature. Add check for nps400
feature. Refactor existing checks to check subclass before
feature enablement.
(md_show_usage): Document flags for NPS-400 and add some other
undocumented flags.
(cpu_type): Remove nps400 CPU type entry
(check_zol): Remove bfd_mach_arc_nps400 case.
(md_show_usage): Add help on -mcpu=nps400.
(cpu_types): Add entry for nps400 as arc700 plus nps400 extension
set.
* doc/c-arc.texi: Document the -mnps400, -mspfp, -mdpfp, and
-fpuda flags. Document -mcpu=nps400.
* testsuite/gas/arc/nps-400-0.d: Use -mcpu=arc700 -mnps400. Change
expected flags to match ARC700 instead of NPS400.
* testsuite/gas/arc/nps-400-1.d: Use -mcpu=arc700 -mnps400.
* testsuite/gas/arc/nps-400-2.d: Likewise.
* testsuite/gas/arc/nps-400-3.d: Likewise.
* testsuite/gas/arc/nps-400-4.d: Likewise.
* testsuite/gas/arc/nps-400-5.d: Likewise.
* testsuite/gas/arc/nps-400-6.d: Likewise.
* testsuite/gas/arc/nps-400-7.d: Likewise.
* testsuite/gas/arc/textinsn2op01.s: Change opcode of myinsn to
avoid clash with cbba instruction.
* testsuite/gas/arc/textinsn2op01.d: Likewise.
* testsuite/gas/arc/textinsn3op.d: Likewise.
* testsuite/gas/arc/textinsn3op.s: Likewise.
* testsuite/gas/arc/nps-400-0.d: Test using NPS-400 using
-mcpu=nps400 as an alternative to -mcpu=arc700 -mnps400 flags.

binutils* readelf.c (decode_ARC_machine_flags): Remove E_ARC_MACH_NPS400
case.

ld * testsuite/ld-arc/nps-1a.d: Use -mcpu=arc700 -mnps400.
* testsuite/ld-arc/nps-1b.d: Likewise.

include * opcode/arc.h: Add nps400 extension and instruction
subclass.
Remove ARC_OPCODE_NPS400
* elf/arc.h: Remove E_ARC_MACH_NPS400

opcodes * arc-dis.c (arc_insn_length): Add comment on instruction length.
Use same method for determining instruction length on ARC700 and
NPS-400.
(arc_insn_length, print_insn_arc): Remove bfd_mach_arc_nps400.
* arc-nps400-tbl.h: Make all nps400 instructions ARC700 instructions
with the NPS400 subclass.
* arc-opc.c: Likewise.

bfd * archures.c: Remove bfd_mach_arc_nps400.
* bfd-in2.h: Likewise.
* cpu-arc.c (arch_info_struct): Likewise.
* elf32-arc.c (arc_elf_object_p, arc_elf_final_write_processing):
Likewise.

782c112 2016-06-21 20:26:11 Andreas Arnez

S390 gdbserver: Mark local funcs/vars as static

Compiling with '-Wmissing-declarations' yields warnings in
linux-s390-low.c. To fix this, mark appropriate functions as static.

gdb/gdbserver/ChangeLog:

* linux-s390-low.c (s390_emit_eq_goto): Mark function static.
(s390_emit_ne_goto): Likewise.
(s390_emit_lt_goto): Likewise.
(s390_emit_le_goto): Likewise.
(s390_emit_gt_goto): Likewise.
(s390_emit_ge_goto): Likewise.
(s390x_emit_eq_goto): Likewise.
(s390x_emit_ne_goto): Likewise.
(s390x_emit_lt_goto): Likewise.
(s390x_emit_le_goto): Likewise.
(s390x_emit_gt_goto): Likewise.
(s390x_emit_ge_goto): Likewise.
(s390_emit_ops_impl): Mark variable static.
(s390x_emit_ops): Likewise.

34a60dd 2016-06-21 20:26:11 Andreas Arnez

S390: Fix typo "s930" -> "s390"

This fixes a typo in the name of the "last-break" regset.

gdb/ChangeLog:

* s390-linux-tdep.c (s390_iterate_over_regset_sections): Fix typo
in name of last-break regset.

f70be8a 2016-06-21 12:13:08 Cary Coutant

Update gold to version 1.12.

gold/
* NEWS: Add new features in 1.12.
* version.cc (version_string): Bump to 1.12.

ac69f78 2016-06-21 09:11:57 Pedro Alves

Add "new-ui console" tests

This adds a test that uses new-ui to create a secondary console, and
then runs some basic smoke tests. It ensures that:

- synchronous commands send output to the UI that initiated it

- asynchronous events like breakpoint hits are reported on all
consoles.

- "new-ui" without arguments doesn't crash.

- The "new-ui" command doesn't repeat.

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

* gdb.base/new-ui.exp: New file.
* lib/mi-support.exp (switch_gdb_spawn_id): Move to ...
* lib/gdb.exp (switch_gdb_spawn_id): ... here.
(with_spawn_id): New procedure.

4994078 2016-06-21 09:11:57 Pedro Alves

Always switch fork child to the main UI

The following scenario:

- gdb started in normal CLI mode.

- separate MI channel created with new-ui

- inferior output redirected with the "set inferior-tty" command.

- use -exec-run in the MI channel to run the inferior

is presently mishandled.

When we create the inferior, in fork-child.c, right after vfork, we'll
close all the file descriptors in the vfork child, and then dup the
tty to file descriptors 0/1/2, create a session, etc. Note that when
we close all descriptors, we close the file descriptors behind
gdb_stdin/gdb_stdout/gdb_stderr of all secondary UIs... So if
anything goes wrong in the child and it calls warning/error, it'll end
up writting to the current UI's stdout/stderr streams, which are
backed by file descriptors that have since been closed. Because this
happens in a vfork region, the corresponding stdin/stdout/stderr in
the parent/gdb end up corrupted.

The fix is to switch to the main UI right after the vfork, so that
gdb_stdin/gdb_stdout/gdb_stderr are correctly mapped to
stdin/stdout/stderr (and thus to file descriptors 0/1/2), so this code
works as it has always worked.

(Technically, we're doing a lot of stuff we shouldn't be doing after a
vfork, while we should only be calling async-signal-safe functions.)

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

* fork-child.c (fork_inferior): Switch the child to the main UI
right after vfork. Save/restore the current UI in the parent.
Flush outputs of the main UI instead of the current UI.

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

* gdb.mi/mi-exec-run.exp: New file.

ef274d2 2016-06-21 09:11:56 Pedro Alves

Make mi-break.exp always expect breakpoint commands output on the main UI

mi-break.exp regresses when tested with MI running on a secondary UI,
with RUNTESTFLAGS="FORCE_SEPARATE_MI_TTY=1".

The problem is simply that the test sets a breakpoint, and attaches
"print" commands to the breakpoint. Since breakpoint commands always
run with the main UI as current UI, the breakpoint command's output
goes to the main UI. So we need to tweak the test to expect it there.

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

* gdb.mi/mi-break.exp (test_breakpoint_commands): Always expect
breakpoint command's output on the main UI.
(test_break): New procedure, factored out from calls in the top
level.
(top level): Use foreach_with_prefix to test MI as main UI and as
separate UI.

468afe6 2016-06-21 09:11:56 Pedro Alves

Send deleted watchpoint-scope output to all UIs

Testing with:

make check RUNTESTFLAGS="SEPARATE_MI_TTY=1"

shows this, in gdb.mi/mi-watch.exp:

-*stopped,reason="watchpoint-scope",wpnum="2",frame={addr="0x00000000004005cb",
+*stopped,frame={addr="0x00000000004005cb",
(...)
-PASS: gdb.mi/mi-watch.exp: hw: watchpoint trigger
+FAIL: gdb.mi/mi-watch.exp: hw: watchpoint trigger (unknown output after running)

That is, we lose the "watchpoint-scope" output on the MI UI.

This commit fixes it, and makes the test run with MI running as both
main UI and separate UI.

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

* breakpoint.c (watchpoint_check): Send watchpoint-deleted output
to all UIs.

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

* gdb.mi/mi-watch.exp (test_watchpoint_creation_and_listing)
(test_awatch_creation_and_listing)
(test_rwatch_creation_and_listing, test_watchpoint_triggering):
Remove 'type' parameter.
(test_watchpoint_all): New parameter mi_mode. Remove
with_test_prefix.
(top level): Use foreach_with_prefix, and add main/separate UI MI
testing axis.

51f77c3 2016-06-21 09:11:55 Pedro Alves

Add testing infrastruture bits for running with MI on a separate UI

With this, a specific test may can start GDB with MI on a separate UI
by using:

mi_gdb_start separate-mi-tty

In addition, it's also possible to run the whole testsuite with MI on
a separate tty, with:

make check RUNTESTFLAGS="FORCE_SEPARATE_MI_TTY=1"

gdb_main_spawn_id and mi_spawn_id are added so that tests may expect
output from either channel.

While at it, inferior_spawn_id was not being cleared when gdb exits,
unlike the other spawn ids, thus a test that starts gdb more than once
would end up using a stale spawn id.

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

* README (Testsuite Parameters): Document FORCE_SEPARATE_MI_TTY.
* lib/gdb.exp (default_gdb_exit): Clear inferior_spawn_id.
* lib/mi-support.exp (mi_uncatched_gdb_exit): Unset
gdb_main_spawn_id, mi_spawn_id, unset inferior_spawn_id.
(gdb_main_spawn_id, mi_spawn_id): Declare and
comment.
(mi_create_inferior_pty): New procedure,
factored out from default_mi_gdb_start.
(switch_gdb_spawn_id, mi_gdb_start_separate_mi_tty): New
procedures.
(default_mi_gdb_start): Call mi_gdb_start_separate_mi_tty if the
separate-mi-tty option is specified, or SEPARATE_MI_TTY is set.
Use mi_create_inferior_pty.
(mi_gdb_start): Use eval to pass down args list.

86f7816 2016-06-21 09:11:55 Pedro Alves

[DOC] Document support for running interpreters on separate UIs

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

* NEWS: Mention support for running interpreters on separate
UIs and the new new-ui command.

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

* gdb.texinfo (Interpreters): Update intepreter-exec section,
document new-ui and explain use case.

60eb539 2016-06-21 09:11:55 Pedro Alves

Add new command to create extra console/mi UIs

With all the previous plumbing in place, it's now easy to add a
command that actually creates a new console/mi UI.

The intended use case is to make it possible and easy for MI frontends
to provide a fully featured GDB console to users, with readline
support, command line editing, history, etc., just like if gdb was
started on the command line. Currently MI frontends have to try to
implement all of that theirselves and make use of "-interpreter-exec
console ...", which is far from perfect. If you ever tried Eclipse's
gdb console window, you'll know what I mean...

Instead of trying to multiplex console through MI, this command let's
just leverage all the built in readline/editing support already inside
gdb.

The plan is for the MI frontend to start GDB in regular console mode,
running inside a terminal emulator widget embedded in Eclipse (which
already exists, for supporting the shell widget; other frontends have
similar widgets), and then tell GDB to run a full MI interpreter on an
specified input/output device, independent of the console.

My original prototype planned to do things the other way around --
start GDB in MI mode, and then start an extra CLI console on separate
tty. I handed over that prototype to Marc Khouzam @ Eclipse CDT, and
after experimentation and discussion, we ended up concluding that
starting GDB in CLI mode instead was both easier and actually also
supported an interesting use case -- connect an Eclipse frontend to a
GDB that is already running outside Eclipse.

The current usage is "new-ui <interpreter> <tty>".

E.g., on a terminal run this scriplet:

$ cat gdb-client
#!/bin/bash

reset
tty
tail -f /dev/null

$ gdb-client
/dev/pts/15

Now run gdb on another terminal, and tell it to start a MI interpreter
on the tty of the other terminal:

...
(gdb) new-ui mi /dev/pts/15
New UI allocated

Now back to the the gdb-client terminal, we'll get an MI prompt, ready
for MI input:

/dev/pts/15
=thread-group-added,id="i1"
(gdb)

You can also start a new UI running a CLI, with:

(gdb) new-ui console /dev/pts/15

Though note that this console won't support readline command editing.
It works as if "set editing off" was entered.

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

* interps.c (set_top_level_interpreter): New function, factored
out from captured_main.
(interpreter_completer): Make extern.
* interps.h (set_top_level_interpreter, interpreter_completer):
New declarations.
(captured_main): Use set_top_level_interpreter.
* top.c [!O_NOCTTY] (O_NOCTTY): Define as 0.
(open_terminal_stream, new_ui_command): New functions.
(init_main): Install the "new-ui" command.

268a799 2016-06-21 09:11:54 Pedro Alves

Make stdin be per UI

This commit makes each UI have its own "stdin" stream pointer. This
is used to determine whether the "from_tty" argument to
execute_command, etc. should be true.

Related, this commit makes input_from_terminal_p take an UI parameter,
and then avoids the gdb_has_a_terminal in it. gdb_has_a_terminal only
returns info on gdb's own main/primary terminal (the real stdin).
However, the places that call input_from_terminal_p really want to
know is whether the command came from an interactive tty. This patch
thus renames input_from_terminal_p to input_interactive_p for clarity,
and then makes input_interactive_p check for "set interactive" itself,
along with ISATTY, instead of calling gdb_has_a_terminal. Actually,
quit_force wants to call input_interactive_p _after_ stdin is closed,
we can't call ISATTY that late. So instead we save the result of
ISATTY in a field of the UI.

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

* cli/cli-script.c (read_next_line): Adjust to per-UI stdin.
(read_command_lines): Use input_interactive_p instead of
input_from_terminal_p.
* defs.h (struct ui): Forward declare.
(input_from_terminal_p): Rename to ...
(input_interactive_p): ... this.
* event-top.c (stdin_event_handler): Pass 0 as from_tty argument
to quit_command.
(command_handler): Adjust to per-UI stdin.
(handle_line_of_input): Adjust to per-UI stdin and use
input_interactive_p instead of ISATTY and input_from_terminal_p.
(gdb_readline_no_editing_callback): Adjust to per-UI stdin.
(command_line_handler): Always pass true as "from_tty" parameter
of handle_line_of_input and execute_command.
(async_sigterm_handler): Pass 0 as from_tty argument to
quit_command.
* inflow.c (interactive_mode, show_interactive_mode): Moved to ...
(gdb_has_a_terminal): Don't check interactive_mode here.
(_initialize_inflow): Don't install "set interactive-mode" here.
* main.c (captured_command_loop): Adjust to per-UI stdin.
* mi/mi-interp.c (mi_execute_command_wrapper): Adjust to per-UI
stdin.
* top.c (new_ui): Save the stdin stream and whether it's a tty.
(dont_repeat): Adjust to per-UI stdin.
(command_line_input): Adjust to per-UI stdin and to use
input_interactive_p.
(quit_force): Write history if any UI supports interactive input.
(interactive_mode, show_interactive_mode): Move here, from
inflow.c.
(input_from_terminal_p): Rename to ...
(input_interactive_p): ... this, and check the "interactive_mode"
global instead of calling gdb_has_a_terminal.
(_initialize_top): Install "set interactive-mode" here.
* top.h (struct ui) <stdin_stream, input_interactive_p>: New
fields.
* utils.c (quit): Pass 0 as from_tty argument to quit_force.
(defaulted_query): Adjust to per-UI stdin and to use
input_interactive_p.

07169ff 2016-06-21 09:11:54 Pedro Alves

Handle UI's terminal closing

Without this, GDB exits if a secondary UIs terminal/input stream is
closed:

$ ./gdb -ex "new-ui mi /dev/pts/6"
New UI allocated
<<< close /dev/pts/6
(gdb) Error detected on fd 9
$

We want that for the main UI, but not secondary UIs.

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

* event-top.c (stdin_event_handler): Don't quit gdb if it was a
secondary UI's input stream that closed. Instead, just delete the
UI.

98d9f24 2016-06-21 09:11:53 Pedro Alves

Make main_ui be heap allocated

This is preparation for being able to create more than one UI object.

The change to gdb_main to stop using catch_errors is necessary because
catch_errors references current_uiout, which expands to
current_ui->m_current_ui, which would crash because current_ui is not
initialized yet at that point. It didn't trigger earlier in the
series because before this patch, main_ui/current_ui always start out
non-NULL.

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

* event-top.c (main_ui_): Delete.
(main_ui, current_ui, ui_list): No longer initialize here.
* main.c (captured_main): UI initialization code factored out to
new new_ui function.
(gdb_main): Wrap captured_main with TRY/CATCH instead of
catch_errors.
* top.c (highest_ui_num): New global.
(new_ui): New function.
* top.h (struct ui) <num>: New field.
(new_ui): New declaration.