On irc, Christian pointed out that print_sys_errmsg could be
simplified by avoiding alloca entirely. This patch implements this.
gdb/ChangeLog
2019-11-01 Tom Tromey <tromey@adacore.com>
* utils.c (print_sys_errmsg): Simplify.
Change-Id: Ic399dade274ea61b63ef0540b3a3be2f0f80160a
The earlier patch to constify safe_strerror missed a couple of spots,
corrected here.
gdb/ChangeLog
2019-11-01 Tom Tromey <tromey@adacore.com>
* gdbsupport/mingw-strerror.c (safe_strerror): Constify result.
Change-Id: I36d5ced144d27b1a6734d9ab9a10a7b9f339ae88
The speed optimization from commit 5f6cac4085
made GDB skip reloading all symbols when the same symbol file is reloaded.
As a result, ARM targets only read the mapping symbols the first time we
load a symbol file. When reloaded, the speed optimization above will
cause an early return and gdbarch_record_special_symbol won't be called to
save mapping symbol data, which in turn affects disassembling of thumb
instructions.
First load and correct disassemble output:
Dump of assembler code for function main:
0x0000821c <+0>: bx pc
0x0000821e <+2>: nop
0x00008220 <+4>: mov r0, #0
0x00008224 <+8>: bx lr
Second load and incorrect disassemble output:
Dump of assembler code for function main:
0x0000821c <+0>: bx pc
0x0000821e <+2>: nop
0x00008220 <+4>: movs r0, r0
0x00008222 <+6>: b.n 0x8966
0x00008224 <+8>: vrhadd.u16 d14, d14, d31
This happens because the mapping symbol data is stored in an objfile_key-based
container, and that data isn't preserved across the two symbol loading
operations.
The following patch fixes this by storing the mapping symbol data in a
bfd_key-based container, which doesn't change as long as the bfd is the same.
I've also added a new test to verify the correct disassemble output.
gdb/ChangeLog:
2019-11-01 Luis Machado <luis.machado@linaro.org>
PR gdb/25124
* arm-tdep.c (arm_per_objfile): Rename to ...
(arm_per_bfd): ... this.
(arm_objfile_data_key): Rename to ...
(arm_bfd_data_key): ... this.
(arm_find_mapping_symbol): Adjust access to new bfd_key-based
data.
(arm_record_special_symbol): Likewise.
gdb/testsuite/ChangeLog:
2019-11-01 Luis Machado <luis.machado@linaro.org>
PR gdb/25124
* gdb.arch/pr25124.S: New file.
* gdb.arch/pr25124.exp: New file.
Change-Id: I22c3e6ebe9bfedad66d56fe9656994fa1761c485
When calling the language la_print_typedef method, don't include a
newline at the end, instead print the newline from the users of
la_print_typedef.
This change will be useful in a later commit when the output from
la_print_typedef will be placed into an MI output field, in which case
the trailing newline is not required.
There should be no user visible changes after this commit.
gdb/ChangeLog:
* ada-typeprint.c (ada_print_typedef): Don't print newline at the
end.
* c-typeprint.c (c_print_typedef): Likewise.
* f-typeprint.c (f_print_typedef): Likewise.
* m2-typeprint.c (m2_print_typedef): Likewise.
* p-typeprint.c (pascal_print_typedef): Likewise.
* rust-lang.c (rust_print_typedef): Likewise.
* symtab.c (print_symbol_info): Print a newline after calling
typedef_print.
Change-Id: I6e697ea1ec0eadaa31aefaea959b2055188d680d
This patch adds two new commands "info module functions" and "info
module variables". These commands list all of the functions and
variables grouped by module and then by file.
For example:
(gdb) info module functions
All functions in all modules:
Module "mod1":
File /some/path/gdb/testsuite/gdb.fortran/info-types.f90:
35: void mod1::__copy_mod1_M1t1(Type m1t1, Type m1t1);
25: void mod1::sub_m1_a(integer(kind=4));
31: integer(kind=4) mod1::sub_m1_b(void);
Module "mod2":
File /some/path/gdb/testsuite/gdb.fortran/info-types.f90:
41: void mod2::sub_m2_a(integer(kind=4), logical(kind=4));
49: logical(kind=4) mod2::sub_m2_b(real(kind=4));
The new commands take set of flags that allow the output to be
filtered, the user can filter by variable/function name, type, or
containing module.
As GDB doesn't currently track the relationship between a module and
the variables or functions within it in the symbol table, so I filter
based on the module prefix in order to find the functions or variables
in each module. What this makes clear is that a user could get this
same information using "info variables" and simply provide the prefix
themselves, for example:
(gdb) info module functions -m mod1 _a
All functions matching regular expression "_a",
in all modules matching regular expression "mod1":
Module "mod1":
File /some/path/gdb/testsuite/gdb.fortran/info-types.f90:
25: void mod1::sub_m1_a(integer(kind=4));
Is similar to:
(gdb) info functions mod1::.*_a.*
All functions matching regular expression "mod1::.*_a":
File /some/path/gdb/testsuite/gdb.fortran/info-types.f90:
25: void mod1::sub_m1_a(integer(kind=4));
The benefits I see for a separate command are that the user doesn't
have to think (or know) about the module prefix format, nor worry
about building a proper regexp. The user can also easily scan across
modules without having to build complex regexps.
The new function search_module_symbols is extern in this patch despite
only being used within symtab.c, this is because a later patch in this
series will also be using this function from outside symtab.c.
This patch is a new implementation of an idea originally worked on by
Mark O'Connor, Chris January, David Lecomber, and Xavier Oro from ARM.
gdb/ChangeLog:
* symtab.c (info_module_cmdlist): New variable.
(info_module_command): New function.
(search_module_symbols): New function.
(info_module_subcommand): New function.
(struct info_modules_var_func_options): New struct.
(info_modules_var_func_options_defs): New variable.
(make_info_modules_var_func_options_def_group): New function.
(info_module_functions_command): New function.
(info_module_variables_command): New function.
(info_module_var_func_command_completer): New function.
(_initialize_symtab): Register new 'info module functions' and
'info module variables' commands.
* symtab.h (typedef symbol_search_in_module): New typedef.
(search_module_symbols): Declare new function.
* NEWS: Mention new commands.
gdb/doc/ChangeLog:
* gdb.texinfo (Symbols): Document new 'info module variables' and
'info module functions' commands.
gdb/testsuite/ChangeLog:
* gdb.fortran/info-modules.exp: Update expected results, and add
additional tests for 'info module functinos', and 'info module
variables'.
* gdb.fortran/info-types.exp: Update expected results.
* gdb.fortran/info-types.f90: Extend testcase with additional
module variables and functions.
Change-Id: I8c2960640e2e101b77eff54027d687e21ec22e2b
Add a new command 'info modules' that lists all of the modules GDB
knows about from the debug information.
A module is a debugging entity in the DWARF defined with
DW_TAG_module, currently Fortran is known to use this tag for its
modules. I'm not aware of any other language that currently makes use
of DW_TAG_module.
The output style is similar to the 'info type' output:
(gdb) info modules
All defined modules:
File info-types.f90:
16: mod1
24: mod2
(gdb)
Where the user is told the file the module is defined in and, on the
left hand side, the line number at which the module is defined along
with the name of the module.
This patch is a new implementation of an idea originally worked on by
Mark O'Connor, Chris January, David Lecomber, and Xavier Oro from ARM.
gdb/ChangeLog:
* dwarf2read.c (dw2_symtab_iter_next): Handle MODULE_DOMAIN.
(dw2_expand_marked_cus): Handle MODULES_DOMAIN.
(dw2_debug_names_iterator::next): Handle MODULE_DOMAIN and
MODULES_DOMAIN.
(scan_partial_symbols): Only create partial module symbols for non
declarations.
* psymtab.c (recursively_search_psymtabs): Handle MODULE_DOMAIN
and MODULES_DOMAIN.
* symtab.c (search_domain_name): Likewise.
(search_symbols): Likewise.
(print_symbol_info): Likewise.
(symtab_symbol_info): Likewise.
(info_modules_command): New function.
(_initialize_symtab): Register 'info modules' command.
* symtab.h (enum search_domain): Add MODULES_DOMAIN.
* NEWS: Mention new 'info modules' command.
gdb/doc/ChangeLog:
* gdb.texinfo (Symbols): Document new 'info modules' command.
gdb/testsuite/ChangeLog:
* gdb.fortran/info-modules.exp: New file.
* gdb.fortran/info-types.exp: Build with new file.
* gdb.fortran/info-types.f90: Include and use new module.
* gdb.fortran/info-types-2.f90: New file.
Change-Id: I2b781dd5a06bcad04620ccdc45f01a0f711adfad
gdb/testsuite/ChangeLog
2019-10-31 Philippe Waroquiers <philippe.waroquiers@skynet.be>
* gdb.base/setshow.exp: Test $_gdb_setting and $_gdb_setting_str.
* gdb.base/settings.exp: Test all settings types using
$_gdb_maint_setting and $_gdb_maint_setting_str in proc_show_setting,
that now verifies that the value of "maint show" is the same as
returned by the settings functions. Test the type of the
maintenance settings.
* gdb.base/default.exp: Update show_conv_list.
The new convenience functions $_gdb_setting and $_gdb_setting_str
provide access to the GDB settings in user-defined commands.
Similarly, $_gdb_maint_setting and $_gdb_maint_setting_str
provide access to the GDB maintenance settings.
The patch was developed following a comment of Eli about the
'set may-call-functions'. Eli said that user-defined functions
should have a way to change their behavior according to this setting.
Rather than have a specialized $_may_call_functions, this patch
implements a general way to access any GDB setting.
Compared to doing such access via Python 'gdb.parameter' and/or
'gdb.execute("set somesetting tosomevalue"):
* The 'with' command is much better than the above python usage:
if the user types C-c or an error happens between the set pagination off
and the python "set pagination on", the above python
does not restore the original setting.
* Effectively, with the "gdb.parameter" python one liner, it is possible to do
simple 'if' conditions, such as set and restore pagination.
But mixing the "python if" within canned
sequence of commands is cumbersome for non trivial combinations.
E.g. if several commands have to be done for a certain condition
accessed from python, I guess something like will be needed:
python if __some_setting: gdb.execute("some command")
python if __some_setting: gdb.execute("some other command")
python if __some_setting: gdb.execute("some different command")
(without speaking about nested "if-s").
With the convenience function:
if $_gdb_setting("some_setting")
some command
some other command
some different command
end
Integer settings (for example print elements) will also be more difficult
to use.
For example, a user defined function that scans and prints a linked list
might want to use the value of "set print elements" to stop printing
the linked list.
Doing that by mixing python expression/if is likely doable, but seems
not easy with the above one liners.
So, in summary, the $_gdb_setting and $_gdb_setting_str avoids to have the
heterogeneous mix of python and GDB commands in one single script
(and of course, it works even if python is not configured, but that
must be an unusual setup I guess).
gdb/ChangeLog
2019-10-31 Philippe Waroquiers <philippe.waroquiers@skynet.be>
* cli/cli-cmds.c (setting_cmd, value_from_setting)
(gdb_setting_internal_fn, gdb_maint_setting_internal_fn)
(str_value_from_setting, gdb_setting_str_internal_fn)
(gdb_maint_setting_str_internal_fn): New functions.
(_initialize_cli_cmds): Define the new convenience functions.
* gdb/cli/cli-setshow.h (get_setshow_command_value_string): Constify.
* gdb/cli/cli-setshow.c (get_setshow_command_value_string): Constify.
I forgot to do this in b231e86ac9
Since safe_strerror is in gdbsupport, gdbserver also needs to
check for strerror_r, although it's less critical since gdbserver
does not use threads as much.
gdb/gdbserver/ChangeLog:
2019-10-31 Christian Biesinger <cbiesinger@google.com>
* config.in: Regenerate.
* configure: Regenerate.
* configure.ac: Also check for strerror_r.
Change-Id: I6a67c8543cd7a28d6dc94f5986f56abcb55727fe
This avoids unnecessary work, and becomes important with the patch in
https://sourceware.org/ml/gdb-patches/2019-10/msg01143.html
gdb/ChangeLog:
2019-10-31 Christian Biesinger <cbiesinger@google.com>
* agent.c (set_can_use_agent): When the setting is turned on,
look up agent symbols if we don't have them yet.
(agent_new_objfile): Don't look up agent symbols when the agent
setting is off.
Change-Id: I6523a5640c95d38299998050a6c620e51096e8ed
I forgot to do this in the last commit
(b231e86ac9)
gdb/ChangeLog:
2019-10-31 Christian Biesinger <cbiesinger@google.com>
* config.in: Regenerate.
Change-Id: I60946ffd853a59469c35f19ef8012ac6ea88a31c
Also stores the result in a thread-local static variable and
changes the return value to a const char*.
This is already important because Guile creates threads and
Python can create threads, but with the patch series here:
https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/176
GDB itself will create threads, too.
gdb/ChangeLog:
2019-10-31 Christian Biesinger <cbiesinger@google.com>
* configure: Regenerate.
* configure.ac: Check for strerror_r.
* gdbsupport/common-utils.h (safe_strerror): Change return value
to const char * and document that this function is now threadsafe.
* gdbsupport/posix-strerror.c (safe_strerror): Make buf
thread_local and call strerror_r, if available.
* utils.c (perror_string): Update.
(print_sys_errmsg): Update.
Change-Id: I81048fbaf148035c221c528727f7efe58ba528eb
Based on feedback from Tromey, update the use of objfile_key in gdb/arm-tdep.c
to use bfd_key instead. That way we don't have to re-create the exception
handling data all over again if it was done before for the same BFD.
gdb/ChangeLog:
2019-10-31 Luis Machado <luis.machado@linaro.org>
* arm-tdep.c (arm_exidx_data_key): Use bfd_key instead of
objfile_key.
(arm_exidx_new_objfile): Adjust to use objfile->obfd instead of
objfile to fetch per-bfd data.
(arm_find_exidx_entry): Likewise.
Change-Id: Ia7b3208ea8d788414600fa6d770ac76db0562859
Also moves an int declaration inside the for loop.
Code cleanup, no change in behavior intended.
gdb/ChangeLog:
2019-10-31 Christian Biesinger <cbiesinger@google.com>
* gdbsupport/agent.c (debug_agent): Change type to bool.
(use_agent): Likewise.
(all_agent_symbols_look_up): Likewise.
(agent_loaded_p): Change return value to bool.
(agent_look_up_symbols): Update.
(agent_capability_check): Change return value to bool.
* gdbsupport/agent.h (agent_loaded_p): Likewise.
(debug_agent): Change type to bool.
(use_agent): Likewise.
(agent_capability_check): Change return value to bool.
gdb/gdbserver/ChangeLog:
2019-10-31 Christian Biesinger <cbiesinger@google.com>
* ax.h (debug_agent): Remove duplicate declaration.
Change-Id: Icb28a65fcc8c7108bcd59287e6be66bf56f8ccb5
If the extension is not found in the context sensitive table, the legacy
tables are still checked as a fallback. This is particularly useful for
Armv8.1-M as it enables the use of '.arch_extension' with the 'mve' and
'mve.fp' extensions which are not part of the legacy table.
* config/tc-arm.c (selected_ctx_ext_table) New static variable.
(arm_parse_arch): Set context sensitive extension table based on the
chosen base architecture.
(s_arm_arch_extension): Change to lookup extensions in the new context
sensitive tables.
* gas/testsuite/gas/arm/mve-ext.s: New.
* gas/testsuite/gas/arm/mve-ext.d: New.
* gas/testsuite/gas/arm/mvefp-ext.s: New.
* gas/testsuite/gas/arm/mvefp-ext.d: New.
Proc gdb_test_multiple builds up and executes a gdb_expect expression with
pattern/action clauses. The clauses are either implicit (added by
gdb_test_multiple) or explicit (passed via the gdb_test_multiple parameter
user_code).
However, there are a few implicit clauses which are inserted before the
explicit ones, making sure those take precedence.
Add an -early pattern flag for a gdb_test_multiple user_code clause to specify
that the clause needs to be inserted before any implicit clause.
Using this pattern flag, we can f.i. setup a kfail for an assertion failure
<assert> during gdb_continue_to_breakpoint by the rewrite:
...
gdb_continue_to_breakpoint <msg> <pattern>
...
into:
...
set breakpoint_pattern "(?:Breakpoint|Temporary breakpoint) .* (at|in)"
gdb_test_multiple "continue" "continue to breakpoint: <msg>" {
-early -re "internal-error: <assert>" {
setup_kfail gdb/nnnnn "*-*-*"
exp_continue
}
-re "$breakpoint_pattern <pattern>\r\n$gdb_prompt $" {
pass $gdb_test_name
}
}
Tested on x86_64-linux.
gdb/testsuite/ChangeLog:
2019-10-30 Tom de Vries <tdevries@suse.de>
* lib/gdb.exp (gdb_test_multiple): Handle -early pattern flag.
Change-Id: I376c636b0812be52e7137634b1a4f50bf2b999b6
The array starts out initialized to zero:
minimal_symbol *msymbol_hash[MINIMAL_SYMBOL_HASH_SIZE] {};
So we only need to explicitly clear it if there were previous minsyms
added to it. This patch does that.
gdb/ChangeLog:
2019-10-30 Christian Biesinger <cbiesinger@google.com>
* minsyms.c (clear_minimal_symbol_hash_tables): New function.
(build_minimal_symbol_hash_tables): Code to clear the table moved
to clear_minimal_symbol_hash_tables.
(minimal_symbol_reader::install): Call clear_minimal_symbol_hash_tables
when needed.
Change-Id: I7da994fe6747f67714e7efe9fdbb0dbc4d6ea532
This is a shorthand for the immediate argument being 0, as described here:
https://developer.arm.com/docs/ddi0596/latest/base-instructions-alphabetic-order/ldraa-ldrab-load-register-with-pointer-authentication
This is because the instructions still have a use with an immediate
argument of 0, unlike loads without the PAC functionality. Currently,
the mnemonics are
LDRAA Xt, [Xn, #<simm10>]!
LDRAB Xt, [Xn, #<simm10>]!
After this patch they become
LDRAA Xt, [Xn {, #<simm10>}]!
LDRAB Xt, [Xn {, #<simm10>}]!
gas * config/tc-aarch64.c (parse_address_main): Accept the omission of
the immediate argument for ldraa and ldrab as a shorthand for the
immediate being 0.
* testsuite/gas/aarch64/ldraa-ldrab-no-offset.d: New test.
* testsuite/gas/aarch64/ldraa-ldrab-no-offset.s: New test.
* testsuite/gas/aarch64/illegal-ldraa.s: Modified to accept the
writeback form with no offset.
* testsuite/gas/aarch64/illegal-ldraa.s: Removed missing offset
error.
opcodes * aarch64-opc.c (print_immediate_offset_address): Don't print the
immediate for the writeback form of ldraa/ldrab if it is 0.
* aarch64-tbl.h: Updated the documentation for ADDR_SIMM10.
* aarch64-opc-2.c: Regenerated.
* elf-bfd.h (elf_backend_data) <elf_backend_core_find_build_id>:
New field.
(_bfd_elf32_core_find_build_id, _bfd_elf64_core_find_build_id):
New functions.
(elf_read_notes): Add declaration.
* elf.c (elf_read_notes): Move elf-bfd.h.
(_bfd_elf_core_find_build_id): New function.
(bfd_section_from_phdr): Scan core file PT_LOAD segments for
build-id if none is known.
(elf_parse_notes): For core files, scan for notes.
* elfcore.h (elf_core_file_matches_executable_p): If both
BFDs have identical build-ids, then they match.
(_bfd_elf_core_find_build_id): New function.
* elfxx-target.h (elf_backend_core_find_build_id): Define.
(elfNN_bed): Add elf_backend_core_find_build_id.
* ar.c (emum long option numbers): Declare. Use to provide
numerical values for long options.
(long_options): Add --output option.
(usage): Mention the --output option.
(open_output_file): New function. Create a filepath for an output
file and open it.
(extract_file): Use open_output_file().
(open_output_file):
* testsuite/binutils-all/ar.exp: Add a test of the new feature.
* doc/binutils.texi: Document the new feature.
* NEWS: Mention the new feature.
Prior to changing the logic in the assembler install tests to make sure
the present defaulting of operand sizes won't get broken. There are a
few anomalies pointed out by this:
- arithmetic insns (add, sub, etc) allow defaulting when their immediate
fits in (signed) 8 bits, but they fail to assemble with larger values,
- mov, other than arithmetic insns, doesn't allow any defaulting,
- movsx/movzx default to byte sources (in AT&T mode), and their special
casing needs to be adjusted first
- bt and friends allow defaulting, while shl and friends don't,
- ambiguous AVX and AVX512 insns don't allow defaulting.
This should ultimately all become consistent (perhaps with the exception
some of the SIMD insns); respective tests will be added to the test
cases here as the issues get addressed.
Now that the opcode table gets preprocessed, undo parts of commit
dc821c5f9a ("x86: replace Reg8, Reg16, Reg32, and Reg64"): Have the
preprocessor handle the expansion there, while making the expansions
explicit in i386-gen and the register table.
The flag is used to indicate opcodes which can be switched between byte
and word/dword/qword forms (in a "canonical" way). Obviously it's quite
odd then to see it on insns not allowing for byte operands in the first
place. As a result the opcode bytes need to be adjusted accordingly,
which includes comparisons done in optimize_encoding().
To make re-introduction of such issues less likely have i386-gen
diagnose it (in a generally non-fatal way for now).
This patch cleans up ada-lang.h:
- Some functions just don't exist anymore, remove their declaration
- Some functions are implemented in ada-lang.c and only used there, make
them static to that file.
I moved some functions higher in the file to avoid having to
forward-declare them, but the implementations are unchanged.
gdb/ChangeLog:
* ada-lang.h (GROW_VECT): Move to ada-lang.c.
(grow_vect): Remove declaration.
(ada_type_of_array): Remove declaration.
(ada_update_initial_language): Remove declaration.
(ada_fold_name): Remove declaration.
(ada_fill_in_ada_prototype): Remove declaration.
(user_select_syms): Remove declaration.
(get_selections): Remove declaration.
(ada_tag_type): Remove declaration.
(ada_value_tag): Remove declaration.
(ada_is_others_clause): Remove declaration.
(ada_in_variant): Remove declaration.
(ada_value_struct_elt): Remove declaration.
(ada_attribute_name): Remove declaration.
(ada_system_address_type): Remove declaration.
* ada-lang.c (ada_watch_location_expression): Make static.
(GROW_VECT): Move here from ada-lang.h.
(grow_vect): Make static.
(ada_update_initial_language): Make static.
(ada_fold_name): Make static.
(ada_type_of_array): Make static.
(encoded_ordered_before): Move up.
(sort_choices): Move up.
(print_signatures): Move up.
(ada_print_symbol_signature): Move up.
(get_selections): Move up and make static.
(user_select_syms): Move up and make static.
(ada_value_struct_elt): Move up and make static.
(ada_tag_type): Make static.
(ada_value_tag): Make static.
(ada_is_others_clause): Make static.
(ada_in_variant): Make static.
(ada_attribute_name): Make static.
Change-Id: If0d46ba87d6585ab674c87244068a19e84718fc9
These assertions can be done at compile time instead of at runtime.
gdb/ChangeLog:
* addrmap.c: Add static assertions of type size, moved from
_initialize_addrmap.
(_initialize_addrmap): Remove.
Change-Id: If089fc5d620a7168bdcdf967c6c4fecd6696b670
Just some code cleanup. This change has a few benefits:
- Shorter argument list in the functions
- If the caller needs to calculate the string, they no longer
need to explicitly call strlen
- It is easy to pass std::string to this (done in one place
currently)
This also updates a couple of places that were passing 0/1 to
a bool parameter.
gdb/ChangeLog:
2019-10-29 Christian Biesinger <cbiesinger@google.com>
* coffread.c (record_minimal_symbol): Update.
(process_coff_symbol): Update.
* dbxread.c (read_dbx_symtab): Update.
* dwarf2read.c (add_partial_symbol): Update.
(fixup_go_packaging): Update.
(load_partial_dies): Update.
(new_symbol): Update.
* elfread.c (record_minimal_symbol): Change signature to use
gdb::string_view instead of name+len.
(elf_symtab_read): Update.
(elf_rel_plt_read): Update.
* mdebugread.c (parse_partial_symbols): Update.
(handle_psymbol_enumerators): Update.
(new_symbol): Update.
* minsyms.c (minimal_symbol_reader::record_full): Change signature
to use gdb::string_view instead of name+len.
* minsyms.h (class minimal_symbol_reader) <record_full>: Likewise.
* psympriv.h (add_psymbol_to_list): Likewise.
* psymtab.c (add_psymbol_to_bcache): Likewise.
(add_psymbol_to_list): Likewise.
* stabsread.c (define_symbol): Update.
* symtab.c (symbol_set_names): Change signature to use gdb::string_view.
* symtab.h (SYMBOL_SET_NAMES): Likewise.
(symbol_set_names): Likewise.
* xcoffread.c (scan_xcoff_symtab): Update.
Change-Id: I2675c6865e0368f9c755a1081088a53aa54dda4c
As of 7bb4305982, we no longer need
a nullterminated linkage_name to look up the entry in the hash table.
So this patch makes it so we only make the copy if the entry was
not found.
By auditing all callers of symbol_set_names, I found out that all cases
where the string may not be nullterminated already pass true for COPY_NAME.
So here, I am documenting that as a requirement and am removing the code
that relies on undefined behavior in symbol_set_names (it accessed the string
past the provided length to check for nulltermination). Note that the Ada
case at the beginning of symbol_set_names was already relying on this.
gdb/ChangeLog:
2019-10-29 Christian Biesinger <cbiesinger@google.com>
* symtab.h (symbol_set_names): Document that copy_name must be
set to true for non-nullterminated strings.
* symtab.c (symbol_set_names): Only make a nullterminated copy of
linkage_name if the entry was not found and we need to demangle.
Change-Id: I183302e1f51483ff6dff0fd5c3b0f32f0f04a5d2
This is more type-safe and can be faster due to inlining and
avoiding overhead from calling through a function pointer.
gdb/ChangeLog:
2019-10-29 Christian Biesinger <cbiesinger@google.com>
* Makefile.in (HFILES_NO_SRCDIR): Add gdb_binary_search.h.
* dwarf2-frame.c (bsearch_fde_cmp): Update.
(dwarf2_frame_find_fde): Replace bsearch with gdb::binary_search.
* gdbsupport/gdb_binary_search.h: New file.
Change-Id: I07e0a0e333f4062b27fc68d3a3f24881ebc68fd4
Adds a configure option --with-system-gdbinit-dir to specify a directory
in which to look for gdbinit files. All files in this directory are
loaded on startup (subject to -n/-nx as usual) as long as the extension
matches a known and enabled scripting language (.gdb/.py/.scm).
This also changes get_ext_lang_of_file to support ".gdb" files, similar
to get_ext_lang_defn's handling of EXT_LANG_GDB.
gdb/ChangeLog:
2019-10-29 Christian Biesinger <cbiesinger@google.com>
* NEWS: Mention new --with-system-gdbinit-dir option.
* config.in: Regenerate.
* configure: Regenerate.
* configure.ac: Add new option --with-system-gdbinit-dir.
* extension.c (get_ext_lang_of_file): Return extension_language_gdb
for a ".gdb" suffix.
* main.c (get_init_files): Change system_gdbinit argument to
a vector and return the files in SYSTEM_GDBINIT_DIR in
addition to SYSTEM_GDBINIT.
(captured_main_1): Update.
(print_gdb_help): Update.
* top.c (print_gdb_configuration): Also print the value of
SYSTEM_GDBINIT_DIR.
gdb/doc/ChangeLog:
2019-10-29 Christian Biesinger <cbiesinger@google.com>
* Makefile.in: Also set SYSTEM_GDBINIT_DIR for the info manual
generation.
* gdb.texinfo (many sections): Document new --with-system-gdbinit-dir
option.
Change-Id: If233859ecc21bc6421d589b37cd658a3c7d030f2
* libcoff-in.h (struct pe_tdata): Add dos_message field.
* libcoff.h: Regenerate.
* peXXigen.c (_bfd_XXi_only_swap_filehdr_out): Copy the
dos_message field rather than initialising it.
(_bfd_XX_bfd_copy_private_bfd_data_common): Copy the dos_message
field.
* peicode.h (pe_mkobject): Initialise the dos_message field.
(pe_mkobject_hook): Copy the dos_message field.
(pe_bfd_object_p): Copy the dos_message field.