Now that we use a vector to store the levels, we don't have to keep a
separate level field in ui_out to keep track of the current level. We
can efficiently derive it from the vector size. That causes a little
change in the meaning of the level, as in they are now 1-based instead
of 0-based (the initial level has the "id" 1 now), but it shouldn't
change anything in the behavior.
Additionally, push_level and pop_level don't really need to return the
new level, making them return void simplifies the code a bit.
Finally, the ui_out_begin/ui_out_end callbacks in the ui_out_impl
interface don't need to be passed the level, it's never actually used.
New in v2:
- Remove or update stale comments.
gdb/ChangeLog:
* ui-out.h (ui_out_begin_ftype): Remove level parameter.
(ui_out_end_ftype): Likewise.
* ui-out.c (struct ui_out) <level>: Replace field with a method
that dynamically computes the result.
(current_level): Get vector's back item instead of using
uiout->level.
(push_level): Make return type void.
(pop_level): Make return type void and update access to
ui_out::level.
(uo_begin): Remove level parameter.
(uo_end): Likewise.
(ui_out_table_begin): Update access to uiout::level.
(ui_out_begin): Don't read return value from push_level, call
uiout->level() instead, update call to uo_begin.
(ui_out_end): Don't read return value from pop_level, update
call to uo_end.
(verify_field): Update access to uiout->level.
(ui_out_new): Don't initialize ui_out::level, call push_level
to push the initial level instead of doing it by hand.
* cli-out.c (cli_begin): Remove level parameter.
(cli_end): Likewise.
* mi/mi-out.c (mi_begin): Likewise.
(mi_end): Likewise.
This patch changes struct ui_out_level to be a real C++ class. No
behavioral changes.
gdb/ChangeLog:
* ui-out.c (struct ui_out_level): Replace with ...
(class ui_out_level): ... this.
(current_level): Update.
(push_level): Update.
(pop_level): Update.
(verify_field): Update.
(ui_out_new): Update.
This patch makes ui_out_hdr (the object that represents an ui-out table
header) a proper C++ class. No behavior changes, it's all about
encapsulation.
gdb/ChangeLog:
* ui-out.c (struct ui_out_hdr): Replace with ...
(class ui_out_hdr): ... this.
(append_header_to_list): Update.
(get_next_header): Update.
(ui_out_query_field): Update.
Instead of keeping pointers to first, last and current ui_out_hdr in
ui_out_table, we can use an std::vector and an iterator. Direct random
access of to vector helps make get_next_header a bit nicer by avoiding
iterating on all the headers. append_header_to_list is also a bit
simpler.
Also, using unique_ptr inside the vector allows expressing the ownership
of the ui_out_hdr objects by the ui_out_table object, and it simplifies
the destruction.
gdb/ChangeLog:
* ui-out.c (struct ui_out_hdr) <next>: Remove.
(struct ui_out_table) <header_first, header_last, header_next>: Remove.
<headers, headers_iterator>: New fields.
(ui_out_table_body): Update for the new data structure.
(ui_out_begin): Likewise.
(clear_header_list): Likewise.
(append_header_to_list): Likewise.
(get_next_header): Likewise.
(ui_out_query_field): Likewise.
(ui_out_new): Likewise.
This fixes offender testcases that have test names starting with uppercase
when using gdb_test_multiple in a multi-line construct.
gdb/testsuite/ChangeLog
2016-12-01 Luis Machado <lgustavo@codesourcery.com>
* gdb.cp/gdb2495.exp: Replace gdb_test_multiple
with gdb_test_no_output.
Use command as test name.
This fixes offender testcases that have test names starting with uppercase
when using gdb_test_no_output in a multi-line construct.
gdb/testsuite/ChangeLog
2016-12-01 Luis Machado <lgustavo@codesourcery.com>
Fix test names starting with uppercase throughout the files.
* gdb.ada/assign_1.exp
* gdb.ada/boolean_expr.exp
* gdb.base/arrayidx.exp
* gdb.base/del.exp
* gdb.base/gcore-buffer-overflow.exp
* gdb.base/testenv.exp
* gdb.compile/compile.exp
* gdb.python/py-framefilter-invalidarg.exp
* gdb.python/py-framefilter.exp
This fixes offender testcases that have test names starting with uppercase
when using gdb_test_multiple in a single-line construct.
gdb/testsuite/ChangeLog
2016-12-01 Luis Machado <lgustavo@codesourcery.com>
Fix test names starting with uppercase throughout the files.
* gdb.arch/i386-bp_permanent.exp
* gdb.arch/i386-gnu-cfi.exp
* gdb.base/disasm-end-cu.exp
* gdb.base/macscp.exp
* gdb.base/pending.exp
* gdb.base/watch_thread_num.exp
* gdb.cp/exception.exp
* gdb.cp/gdb2495.exp
* gdb.cp/local.exp
* gdb.python/py-evsignal.exp
* gdb.python/python.exp
* gdb.trace/tracecmd.exp
The attached patch fixes a problem where nm displays bogus information for
synthetic symbol sizes when --size-sort is used.
This happens because the synthetic symbols (dot symbols for ppc64) are
generated based on their non-dot symbols. The generation process doesn't copy
over the ELF-specific bits of the regular non-dot symbols.
When --size-sort is used, the code attempts to access the symbol size from
the ELF-specific bits and ends up reading gargabe, causing the size to be
displayed incorrectly.
With the patch, i can see dot and non-dot symbols having the same size with
--size-sort.
This doesn't fix the fact that we don't display size information for synthetic
symbols without --size-sort, which i may address in the future.
binutils/ChangeLog:
2016-12-01 Luis Machado <lgustavo@codesourcery.com>
* nm.c (sort_symbols_by_size): Don't read symbol size if symbol
is synthetic.
PR ld/20868
bfd * elfnn-aarch64.c (elfNN_aarch64_tls_relax): Use 32-bit accesses
to the GOT when operating in 32-bit mode.
ld * testsuite/ld-aarch64/tls-relax-gd-ie-ilp32.d: New test.
* testsuite/ld-aarch64/relocs-ilp32.ld: Linker script for the new
test.
* testsuite/ld-aarch64/aarch64-elf.exp: Run the new test.
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.