Use std::string for the id field of the ui_out_table object.
I found that all users of ui_out_table_begin passed a non-NULL value to
the tblid parameter, so we don't have to worry about the NULL case. I
changed the tblid parameter to be a std::string while at it.
gdb/ChangeLog:
* ui-out.c (struct ui_out_table) <id>: Change type to
std::string.
(ui_out_table_begin): Change tblid parameter type to
std::string, adapt code.
update following type change.
(clear_table): Update.
(ui_out_new): Update.
Use a standard vector instead of the home-made version. I used a vector
of plain pointers, because the cli_ui_out_data object doesn't own the
streams objects (i.e. they shouldn't be deleted when the vector is
deleted).
gdb/ChangeLog:
* cli-out.h (cli_ui_out_data) <streams>: Change type to
std::vector.
* cli-out.c: Remove vec.h include.
(cli_uiout_dtor): Update.
(cli_field_fmt): Update.
(cli_spaces): Update.
(cli_text): Update.
(cli_message): Update.
(cli_flush): Update.
(cli_redirect): Update.
(out_field_fmt): Update.
(field_separator): Update.
(cli_out_data_ctor): Update.
(cli_out_new): Update.
(cli_out_set_stream): Update.
Use a standard vector instead of the home-made version. I used a vector
of plain pointers, because the mi_ui_out_data object doesn't own the
streams objects (i.e. they shouldn't be deleted when the vector is
deleted).
gdb/ChangeLog:
* mi/mi-out.c: Remove vec.h include.
(mi_ui_out_data) <streams>: Change type to std::vector.
(mi_field_string): Update.
(mi_field_fmt): Update.
(mi_flush): Update.
(mi_redirect): Update.
(field_separator): Update.
(mi_open): Update.
(mi_close): Update.
(mi_out_buffered): Update.
(mi_out_rewind): Update.
(mi_out_put): Update.
(mi_out_data_ctor): Update.
(mi_out_data_dtor): Don't free streams.
Convert the levels field of struct ui_out to be a vector of unique_ptr
to ui_out_level. This way, the ownership of the ui_out_level objects by
the ui_out instance is clear.
gdb/ChangeLog:
* ui-out.c (ui_out_level_p): Remove typedef.
(DEF_VEC_P (ui_out_level_p)): Remove definition.
(struct ui_out) <levels>: Change type to vector of unique_ptr of
ui_out_level.
(current_level): Update.
(push_level): Update.
(pop_level): Update, don't manually delete the ui_out_level
instance.
(ui_out_new): Update.
The following patches introduce C++ vectors and strings as fields of the
various ui_out structures. We therefore need to use new/delete so that
their contructor/destructor is called. I find it simpler to change all
the allocations in a separate preliminary patch, rather than in each
individual patch.
gdb/ChangeLog:
* cli-out.c (cli_uiout_dtor): Use delete instead of xfree.
(cli_out_new): Use new instead of XNEW.
* mi/mi-out.c (mi_out_data_dtor): Use delete instead of xfree.
(mi_out_new): Use new instead of XNEW.
* tui/tui-out.c (tui_out_new): Likewise.
* ui-out.c (push_level): Likewise.
(pop_level): Use delete instead of xfree.
(clear_header_list): Use delete instead of xfree.
(append_header_to_list): Use new instead of XNEW.
(ui_out_new): Likewise.
Since we don't use suffix rules nor implicit rules in gdb, we can
disable them. The advantage is a slightly faster make [1].
Here are some numbers about the speedup. I ran this on my trusty old
Intel Q6600, so the time numbers are probably higher than what you'd get
on any recent hardware. I ran "make" in the gdb/ directory of an
already built repository (configured with --enable-targets=all). I
recorded the time of execution (average of 5). I then ran "make -d" and
recorded the number of printed lines, which gives a rough idea of the
number of operations done.
I compared the following configurations, to see the impact of both the
empty .SUFFIXES target and the empty pattern rules, as well as running
"make -r", which can be considered the "ideal" case.
A - baseline
B - baseline + .SUFFIXES
C - baseline + pattern rules
D - baseline + .SUFFIXES + pattern rules
E - baseline + make -r
config | time (s) | "make -d"
-----------------------------
A | 5.74 | 2396643
B | 1.19 | 298469
C | 2.81 | 1266573
D | 1.13 | 245489
E | 1.01 | 163914
We can see that the empty .SUFFIXES target has a bigger impact than the
empty pattern rules, but still it doesn't hurt to disable the implicit
pattern rules as well.
There are still some mentions of implicit rules I can't get rid of in
the "make -d" output. For example, it's trying to build .c files from
.w files:
Looking for an implicit rule for '/home/simark/src/binutils-gdb/gdb/infrun.c'.
Trying pattern rule with stem 'infrun'.
Trying implicit prerequisite '/home/simark/src/binutils-gdb/gdb/infrun.w'.
and trying to build Makefile.in from a bunch of extensions:
Looking for an implicit rule for 'Makefile.in'.
Trying pattern rule with stem 'Makefile.in'.
Trying implicit prerequisite 'Makefile.in.o'.
Trying pattern rule with stem 'Makefile.in'.
Trying implicit prerequisite 'Makefile.in.c'.
Trying pattern rule with stem 'Makefile.in'.
Trying implicit prerequisite 'Makefile.in.cc'.
... many more ...
If somebody knows how to disable them, we can do it, but at this point
the returns are minimal, so it is not that important.
I verified that both in-tree and out-of-tree builds work.
[1] Switching from explicit rules to pattern rules for files in
subdirectories actually made it slower, so this is kind of a way to
redeem myself. But it the end it's faster than it was previously,
so it was all worth it. :)
gdb/ChangeLog:
* disable-implicit-rules.mk: New file.
* Makefile.in: Include disable-implicit-rules.mk.
* data-directory/Makefile.in: Likewise.
* gnulib/Makefile.in: Likewise.
gdb/doc/ChangeLog:
* Makefile.in: Likewise.
gdb/gdbserver/ChangeLog:
* Makefile.in: Include disable-implicit-rules.mk.
gdb/testsuite/ChangeLog:
* Makefile.in: Include disable-implicit-rules.mk.
When GDB read inferior memory as an address or an instruction,
it should be unsigned.
gdb:
2016-11-30 Yao Qi <yao.qi@linaro.org>
* arm-tdep.c (arm_scan_prologue): Read memory as unsigned integer.
(arm_exidx_unwind_sniffer): Likewise.
The PR20886 binary is large enough that there are two stub sections
servicing .text (which is 88M). It so happens that between one
iteration of sizing and the next that one stub section grows while
the other shrinks. Since one section is always growing, the loop
never terminates.
This patch changes the algorithm to not update previous size on
shrinking, once we go past a certain number of iterations.
PR ld/20886
* elf64-ppc.c (ppc64_elf_size_stubs): Make rawsize max size seen
on any pass past STUB_SHRINK_ITER.
This patch fixes:
- fpus and fpud are swaped.
- quarkse_em doesn't include FPX extensions.
- auto guessed opcode mechanism may ignore the option passed via -M<feature> option.
opcodes/
2016-11-29 Claudiu Zissulescu <claziss@synopsys.com>
* arc-dis.c (is_compatible_p): Remove function.
(skip_this_opcode): Don't add any decoding class to decode list.
Remove warning.
(find_format_from_table): Go through all opcodes, and warn if we
use a guessed mnemonic.
binutils/
2016-11-29 Claudiu Zissulescu <claziss@synopsys.com>
* testsuite/binutils-all/arc/objdump.exp (Warning test): Update
test.
Remove duplicate definition of TEMPLATE_NAME, only the last of these
will have any effect, so this should result in no visible changes to the
user.
ld/ChangeLog:
* emulparams/arclinux_prof.sh: Remove duplicate TEMPLATE_NAME.
While decoding 32-bit XOP instructions, 64 bit registers names are printed.
This patch fixes this by ignoring REX_B bit in 32-bit mode.
opcodes/
PR binutils/20637
* i386-dis.c (get_valid_dis386): Ignore REX_B for 32-bit XOP
instructions.
gas/
PR binutils/20637
* testsuite/gas/i386/xop32reg.d: New file.
* testsuite/gas/i386/xop32reg.s: New file.
* testsuite/gas/i386/i386.exp: Run new test.
With the previous change, value.location.address is only valid for
lval_memory. This patch restrict some checking on value.lval on
using address. Since we have a check on VALUE_VAL in
set_value_address, we need to set VALUE_VAL properly before
set_value_address too.
gdb:
2016-11-25 Yao Qi <yao.qi@linaro.org>
* ada-lang.c (ensure_lval): Call set_value_address after setting
VALUE_LVAL.
* elfread.c (elf_gnu_ifunc_resolve_addr): Set VALUE_LVAL to
lval_memory.
(elf_gnu_ifunc_resolver_return_stop): Likewise.
* value.c (value_fn_field): Likewise.
(value_from_contents_and_address_unresolved): Likewise.
(value_from_contents_and_address): Likewise.
(value_address): Check value->lval isn't
lval_memory.
(value_raw_address): Likewise.
(set_value_address): Assert value->lval is lval_memory.
value.regnum and value.next_frame_id are only used for lval_register,
so this patch moves them to union value.location. As a result, when
we copy value, only copy location, don't need to copy regnum and
next_frame_id.
This patch also changes regnum's type to int as there is no space
constraint, so update deprecated_value_regnum_hack return type too.
gdb:
2016-11-28 Yao Qi <yao.qi@linaro.org>
* valops.c (value_slice): Don't set frame id of slice.
* value.c (struct value) <regnum, next_frame_id>: Move them to...
(struct value) <location>: ... here. Update comments.
(allocate_value_lazy): Don't set frame id and regnum.
(deprecated_value_next_frame_id_hack): Adjust.
(deprecated_value_regnum_hack): Adjust.
(value_copy): Don't copy frame id and regnu.
(value_primitive_field): Likewise.
(value_from_component): Likewise.
(deprecated_value_regnum_hack): Return int *.
* value.h (deprecated_value_regnum_hack): Update declaration.
Nowadays, we set computed value's frame id, which is a misuse to me.
The computed value itself doesn't care about frame id, but function
value_computed_funcs (val)->read (or read_pieced_value) cares about
which frame the register is relative to, so 'struct piece_closure' is
a better place to fit frame id.
This patch adds a frame id in 'struct piece_closure', and use it
instead of using computed value's frame id.
gdb:
2016-11-28 Yao Qi <yao.qi@linaro.org>
* dwarf2loc.c (struct piece_closure) <frame_id>: New field.
(allocate_piece_closure): Add new parameter 'frame' and set
closure's frame_id field accordingly.
(read_pieced_value): Get frame from closure instead of value.
(dwarf2_evaluate_loc_desc_full): Remove code getting frame id.
Don't set value's frame id.
A hidden versioned symbol in executable should be forced local if it is
locally defined, not referenced by shared library and not exported. We
must do it before _bfd_elf_link_renumber_dynsyms.
bfd/
* elflink.c (_bfd_elf_fix_symbol_flags): Hide hidden versioned
symbol in executable.
(elf_link_output_extsym): Don't change bind from global to
local when linking executable.
ld/
* testsuite/ld-elf/indirect.exp: Add a test for PR 18720.
* testsuite/ld-elf/pr18720.rd: New file.
Constify the data path between ui_out_wrap_hint and the wrap_indent
global, because we can. It's clearer that the argument passed to
wrap_hint is not intended to be modified by the ui_out implementation.
gdb/ChangeLog:
* mi/mi-out.c (mi_wrap_hint): Constify argument.
* cli-out.c (cli_wrap_hint): Likewise.
* ui-out.c (ui_out_wrap_hint, uo_wrap_hint): Likewise.
* ui-out.h (ui_out_wrap_hint, wrap_hint_ftype): Likewise.
* utils.c (wrap_here): Likewise.
(wrap_indent): Constify.
* utils.h (wrap_here): Constify argument.
The wrapper uo_redirect seems like it should return the return value
from of implementation function, since callers rely on it, but it
doesn't.
gdb/ChangeLog:
* ui-out.c (uo_redirect): Return the return value from the
implementation function.
It's not actually used, and removing it simplifies the upcoming patches
a bit. After the whole series, destroying an ui_out object will be
simply "delete uiout", which will call the default destructor.
gdb/ChangeLog:
* ui-out.c (ui_out_destroy, uo_data_destroy): Remove.
* ui-out.h (ui_out_destroy): Remove.
Just a little cleanup, so the name is more consistent with the naming of
the equivalent structures of cli and tui. It goes away in subsequent
patches anyway, but it might help follow the changes in those patches...
gdb/ChangeLog:
* mi/mi-out.c (ui_out_data): Rename to ...
(mi_ui_out_data): ... this.