2019-02-19 Egeyar Bagcioglu <egeyar.bagcioglu@oracle.com>
gold/
PR gold/23870
* aarch64.cc (Target_aarch64::Scan::global): Check if a symbol with
R_AARCH64_MOVW_.ABS_* relocations requires a PLT entry.
* testsuite/Makefile.am: Add aarch64_pr23870 test case.
* testsuite/Makefile.in: Regenerate.
* testsuite/aarch64_pr23870_bar.c: New file.
* testsuite/aarch64_pr23870_foo.c: New file.
* testsuite/aarch64_pr23870_main.S: New file.
While working on the Ada task code, I noticed a few things that could
be cleaned up:
* task_list_valid_p was not set in all cases in ada_build_task_list.
This causes many needless re-fetches of the task list.
* task_list_valid_p can be bool, and various functions can also return
bool.
* Nothing checks the return value of read_known_tasks, so it can be
changed to return void.
* The call to ada_build_task_list in
ravenscar_thread_target::update_thread_list is redundant, because
this is the first thing done by iterate_over_live_ada_tasks.
Tested using the internal AdaCore test suite against a ravenscar
target.
gdb/ChangeLog
2019-02-19 Tom Tromey <tromey@adacore.com>
* ravenscar-thread.c
(ravenscar_thread_target::update_thread_list): Don't call
ada_build_task_list.
* ada-lang.h (ada_build_task_list): Don't declare.
* ada-tasks.c (struct ada_tasks_inferior_data)
<task_list_valid_p>: Now bool.
(read_known_tasks, ada_task_list_changed)
(ada_tasks_invalidate_inferior_data): Update.
(read_known_tasks_array): Return bool.
(read_known_tasks_list): Likewise.
(read_known_tasks): Return void.
(ada_build_task_list): Now static.
The code in type_align (gdbtypes.c) currently hard-codes the rules for
aligning method and member pointers. It would seem better to forward
these types through the gdbarch hook, so that an architecture could
override the alignment of these types if needed.
Only 3 architectures currently override the gdbarch alignment hook,
these are arc, i386, and nio2.
For arc and nios the alignment rules are that alignment is the minimum
of 4-bytes and the type length. As pointers are 4-bytes on these
targets, then (assuming method and members pointers are also 4-bytes)
there should be no change to the alignment after this patch.
For i386 the gdbarch alignment hook overrides for some INT and FLOAT
types only. For method and member pointers we align on the type size
still, so there should be no change to the alignment after this patch.
I tested this on x86-64 GNU Linux with no regressions.
gdb/ChangeLog:
* gdbtypes.c (type_align): Allow alignment of TYPE_CODE_METHODPTR
and TYPE_CODE_MEMBERPTR to be overridden by the gdbarch.
Valgrind reports leaks such as the below.
Fix these leaks by changing ada_tasks_pspace_data_handle
and ada_tasks_inferior_data_handle to use the 'with_cleanup' register variant.
Tested on debian/amd64 natively and under Valgrind.
==26346== 56 bytes in 1 blocks are definitely lost in loss record 631 of 3,249
==26346== at 0x4C2C4CC: operator new(unsigned long) (vg_replace_malloc.c:344)
==26346== by 0x38F911: get_ada_tasks_inferior_data(inferior*) (ada-tasks.c:281)
==26346== by 0x38FA3F: ada_tasks_invalidate_inferior_data (ada-tasks.c:1362)
==26346== by 0x38FA3F: ada_tasks_new_objfile_observer(objfile*) (ada-tasks.c:1411)
==26346== by 0x60CBC5: operator() (functional:2127)
==26346== by 0x60CBC5: notify (observable.h:106)
==26346== by 0x60CBC5: clear_symtab_users(enum_flags<symfile_add_flag>) (symfile.c:2903)
...
==26346== 104 bytes in 1 blocks are definitely lost in loss record 984 of 3,249
==26346== at 0x4C2E0BC: calloc (vg_replace_malloc.c:762)
==26346== by 0x4056F0: xcalloc (common-utils.c:84)
==26346== by 0x38F8AE: xcnew<ada_tasks_pspace_data> (poison.h:122)
==26346== by 0x38F8AE: get_ada_tasks_pspace_data(program_space*) (ada-tasks.c:253)
==26346== by 0x38FA77: ada_tasks_invalidate_pspace_data (ada-tasks.c:1354)
==26346== by 0x38FA77: ada_tasks_new_objfile_observer(objfile*) (ada-tasks.c:1394)
==26346== by 0x60CBC5: operator() (functional:2127)
==26346== by 0x60CBC5: notify (observable.h:106)
...
gdb/ChangeLog
2019-02-18 Philippe Waroquiers <philippe.waroquiers@skynet.be>
* ada-task.c (_initialize_tasks): Use 'with_cleanup' register
variant for ada_tasks_pspace_data_handle and
ada_tasks_inferior_data_handle.
(ada_tasks_pspace_data_cleanup): New function.
(ada_tasks_inferior_data_cleanup): New function.
While working on the previous patch, I noticed that if
macro_source_fullname returned a std::string, then the callers would
be simplified. This patch implements this idea.
gdb/ChangeLog
2019-02-17 Tom Tromey <tom@tromey.com>
* macrotab.h (macro_source_fullname): Return a std::string.
* macrotab.c (macro_include, check_for_redefinition)
(macro_undef, macro_lookup_definition, foreach_macro)
(foreach_macro_in_scope): Update.
(macro_source_fullname): Return a std::string.
* macrocmd.c (show_pp_source_pos): Update.
This adds filename styling to "info macro".
gdb/ChangeLog
2019-02-17 Tom Tromey <tom@tromey.com>
* macrocmd.c (show_pp_source_pos): Style the file names.
gdb/testsuite/ChangeLog
2019-02-17 Tom Tromey <tom@tromey.com>
* gdb.base/style.exp: Use -g3 to compile when possible. Add test
for macro styling.
* gdb.base/style.c (SOME_MACRO): New macro.
The styling series introduced some new errors in the TUI -- the series
changed how source lines are allocated, without updating
tui_set_source_content_nil.
There are several failures but a typical one looks like:
==6274== Use of uninitialised value of size 8
==6274== at 0x4E4A095: wclrtoeol (in /usr/lib64/libncursesw.so.6.1)
==6274== by 0x4E47617: waddch (in /usr/lib64/libncursesw.so.6.1)
==6274== by 0x8325CB: tui_puts_internal(_win_st*, char const*, int*) (tui-io.c:393)
==6274== by 0x82E89D: tui_file::puts(char const*) (tui-file.c:39)
==6274== by 0x84BF5F: vfprintf_unfiltered(ui_file*, char const*, __va_list_tag*) (utils.c:2026)
This patch rewrites tui_set_source_content_nil, fixing the bug.
This was also reported as PR tui/24197.
Verified by running valgrind before and after on x86-64 Fedora 29.
gdb/ChangeLog
2019-02-17 Tom Tromey <tom@tromey.com>
PR tui/24197:
* tui/tui-source.c (tui_set_source_content_nil): Rewrite.
I believe this fixes all the pager output problems with styling that
Philippe pointed out, plus at least one more. The patch is somewhat
hard to reason about, so you may wish to give it a try. Even writing
the tests was hard.
This removes the style caching, because it was difficult to keep the
style cache correct in all cases. Since this would cause more style
escapes to be emitted, instead it changes fputs_styled to try to avoid
unnecessary changes.
Another bug was that the wrap buffer was not flushed in the case where
wrap_column==0. In the old (pre-patch series) code, characters were
directly emitted in this case; so flushing the wrap buffer here
restores this behavior.
On error the wrap buffer must be emptied. Otherwise, interrupting
output can leave characters in the buffer that will be emitted later.
As discussed on gdb-patches, this fixes the ada-lang.c problem where
filtered and unfiltered printing were mixed. Now user_select_syms
uses filtered printing, which is what its callees were already doing.
Finally, it was possible for source line highlighting to be garbled
(and invalid escape sequences emitted) if the pager was invoked at the
wrong spot. To fix this, the patch arranges for source line escapes
to always be emitted as a unit.
gdb/ChangeLog
2019-02-17 Tom Tromey <tom@tromey.com>
* ada-lang.c (user_select_syms): Use filtered printing.
* utils.c (wrap_style): New global.
(desired_style): Remove.
(emit_style_escape): Add stream parameter.
(set_output_style, reset_terminal_style, prompt_for_continue):
Update.
(flush_wrap_buffer): Only flush gdb_stdout.
(wrap_here): Set wrap_style.
(fputs_maybe_filtered): Clear the wrap buffer on exception. Don't
treat escape sequences as a character. Change when wrap buffer is
flushed.
(fputs_styled): Do not set the output style when the default is
requested.
* ui-style.h (struct ui_file_style) <is_default>: New method.
* source.c (print_source_lines_base): Emit escape sequences in one
piece.
gdb/testsuite/ChangeLog
2019-02-17 Tom Tromey <tom@tromey.com>
* gdb.base/style.exp: Add line-wrapping tests.
* gdb.base/page.exp: Add test for quitting during pagination.
This commit enhances type_align to handle TYPE_CODE_RANGE types
the same as integers and enums, rather than returning zero,
which means for this function that it could not determine its
alignment.
gdb/ChangeLog:
* gdbtypes.c (type_align): Handle TYPE_CODE_RANGE the same as
integers and enumeration types.
Tested on x86_64-linux. Also tested on a variety of platforms
(with CPUs being ARM, AArch64, Leon3 (SPARC-like), PowerPC,
PowerPC64, RV64, Visium, x86, x86_64).
Trying to print a packed array sometimes leads to a crash (see
attached testcase for an example of when this happens):
| (gdb) p bad
| [1] 65571 segmentation fault gdb -q foo
Variable "bad" is declared in the debug information as an array where
the array's type name has an XPnnn suffix:
| .uleb128 0xc # (DIE (0x566) DW_TAG_typedef)
| .long .LASF200 # DW_AT_name: "pck__t___XP1"
| [loc info attributes snipped]
| .long 0x550 # DW_AT_type
| .byte 0x1 # DW_AT_alignment
The signals to GDB that the debugging information follows a GNAT encoding
used for packed arrays, and an in order to decode it, we need to find
the type whose name is the same minus the "___XPnnn" suffix: "pck__t".
For that, we make a call to ada-lang.c::standard_lookup, which is
a simple function which essentially does:
| /* Return the result of a standard (literal, C-like) lookup of NAME in
| given DOMAIN, visible from lexical block BLOCK. */
|
| [...]
| sym = lookup_symbol_in_language (name, block, domain, language_c, 0);
Unfortunately for us, while the intent of this call was to perform
an exact-match lookup, in our case, it returns ... type pck__t___XP1
instead! In other words, it finds itself back. The reason why it finds
this type is a confluence of two factors:
(1) Forcing the lookup into language_c currently does not affect
how symbol matching is done anymore, because we look at the symbol's
language to determine which kind of matching should be done;
(2) The lookup searches the local context (via block) first, beforei
doing a more general lookup. And looking at the debug info for
the main subprogram, we see that type "pck__t" is not declared
there, only in the debug info for pck.ads. In other words,
there is no way that we accidently find "pck__t" by random chance.
I believe Pedro added a new function called ada_lookup_encoded_symbol
for that specific purpose, so I started by replacing the lookup
by language above by this. Unfortunately, still no joy.
This was because, even though ada_lookup_encoded_symbol puts angle-
brackets around the search name to signal that we want a verbatim
search, we end up losing that information in the function called
to compare a symbol with the search name:
| static bool
| do_full_match (const char *symbol_search_name,
| const lookup_name_info &lookup_name,
| completion_match_result *comp_match_res)
| {
| return full_match (symbol_search_name, ada_lookup_name (lookup_name));
^^^^^^^^^^^^^^^
|
<=> lookup_name.m_ada.m_encoded_name
(no angle brackets)
The way I fixed this was by introducing a new function called
do_exact_match, and then adjust ada_get_symbol_name_matcher to
return that function when seeing that we have a verbatim non-wild-match
search.
As it happens, this fixes an incorrect test in gdb.ada/homony.exp,
where we were inserting a breakpoint on a symbol using the angle-brackets
notation, and got 2 locations for that breakpoint...
(gdb) b <homonym__get_value>
Breakpoint 1 at 0x4029fc: <homonym__get_value>. (2 locations)
... each location being in a different function:
(gdb) info break
Num Type Disp Enb Address What
1 breakpoint keep y <MULTIPLE>
1.1 y 0x00000000004029fc in homonym.get_value
at /[...]/homonym.adb:32
1.2 y 0x0000000000402a3a in homonym.get_value
at /[...]/homonym.adb:50
(gdb) x /i 0x00000000004029fc
0x4029fc <homonym__get_value+8>: movl $0x1d,-0x4(%rbp)
(gdb) x /i 0x0000000000402a3a
0x402a3a <homonym__get_value__2+8>: movl $0x11,-0x4(%rbp)
Since we used angle-brackets, we shouldn't be matching the second one,
something this patch fixes.
gdb/ChangeLog:
* ada-lang.c (standard_lookup): Use ada_lookup_encoded_symbol
instead of lookup_symbol_in_language
(do_exact_match): New function.
(ada_get_symbol_name_matcher): Return do_exact_match when
doing a verbatim match.
gdb/testsuite/ChangeLog:
* gdb.ada/big_packed_array: New testcase.
* gdb.ada/homonym.exp: Fix incorrect expected output for
"break <homonym__get_value>" test.
Tested on x86_64-linux.
ravenscar-thread.c intercepts resume and wait target requests and
replaces the requested ptid with the ptid of the underlying CPU.
However, this is incorrect when a request is made with a wildcard
ptid.
This patch adds a special case to ravenscar-thread.c for
minus_one_ptid. I don't believe a special case for process wildcards
is necessary, so I have not added that.
Joel's description explains the bug well:
At the user level, we noticed the issue because we had a test were
we insert a breakpoint one some code which is only run from, say,
CPU #2, whereas we unfortunately resumed the execution after having
stopped somewhere in CPU #1. As a result, we sent an order to resume
CPU #1, which starves CPU #2 forever, because the code in CPU #1
waits for some of the Ada tasks allocated to CPU #2 (and we never
reach our breakpoint either).
gdb/ChangeLog
2019-02-15 Tom Tromey <tromey@adacore.com>
* ravenscar-thread.c (ravenscar_thread_target::resume)
(ravenscar_thread_target::wait): Special case wildcard requests.
This changes ravenscar-thread.c to make it ready for multi-target.
This is done by moving globals into the target, and then arranging to
allocate the target with "new" and delete the target in its "close"
method.
gdb/ChangeLog
2019-02-15 Tom Tromey <tromey@adacore.com>
* ravenscar-thread.c (base_ptid): Remove.
(struct ravenscar_thread_target) <close>: New method.
<m_base_ptid>: New member.
<update_inferior_ptid, active_task, task_is_currently_active,
runtime_initialized>: Declare methods.
<ravenscar_thread_target>: Add constructor.
(ravenscar_thread_target::task_is_currently_active)
(ravenscar_thread_target::update_inferior_ptid)
(ravenscar_runtime_initialized): Rename. Now methods.
(ravenscar_thread_target::resume, ravenscar_thread_target::wait)
(ravenscar_thread_target::update_thread_list): Update.
(ravenscar_thread_target::active_task): Now method.
(ravenscar_thread_target::store_registers)
(ravenscar_thread_target::prepare_to_store)
(ravenscar_thread_target::prepare_to_store)
(ravenscar_thread_target::mourn_inferior): Update.
(ravenscar_inferior_created): Use "new" to create target.
(ravenscar_thread_target::get_ada_task_ptid): Update.
(_initialize_ravenscar): Don't initialize base_ptid.
(ravenscar_ops): Remove global.
This adds a push_target overload that takes a "target_ops_up &&".
This removes some calls to release a target_ops_up, and makes the
intent here clearer.
gdb/ChangeLog
2019-02-15 Tom Tromey <tromey@adacore.com>
* target.h (push_target): Declare new overload.
* target.c (push_target): New overload, taking an rvalue reference.
* remote.c (remote_target::open_1): Use push_target overload.
* corelow.c (core_target_open): Use push_target overload.
This changes some functions in ravenscar-thread.c to return "bool"
rather than int, where appropriate, and also changes "(void)" to "()".
gdb/ChangeLog
2019-02-15 Tom Tromey <tromey@adacore.com>
* ravenscar-thread.c (is_ravenscar_task)
(ravenscar_task_is_currently_active): Return bool.
(ravenscar_update_inferior_ptid, get_running_thread_msymbol)
(_initialize_ravenscar): Remove "(void)".
(has_ravenscar_runtime, ravenscar_runtime_initialized): Likewise.
Return bool.
This fixes some incorrect formatting in ravenscar-thread.c.
gdb/ChangeLog
2019-02-15 Tom Tromey <tromey@adacore.com>
* ravenscar-thread.c (ravenscar_runtime_initializer)
(has_ravenscar_runtime, get_running_thread_id)
(ravenscar_thread_target::resume): Fix indentation.
This turns ravenscar_arch_ops into an abstract base class and updates
all the places where it is used. This is an improvement because it
avoids any possibility of forgetting to set one of the function
pointers. It also makes clear that these functions aren't intended to
be changed dynamically.
This version of the patch removes the prepare_to_store method, as it
is unused, and it is easy enough to add if it is ever needed.
gdb/ChangeLog
2019-02-15 Tom Tromey <tromey@adacore.com>
* sparc-ravenscar-thread.c (struct sparc_ravenscar_ops): Derive
from ravenscar_arch_ops.
(sparc_ravenscar_ops::fetch_registers)
(sparc_ravenscar_ops::store_registers): Now methods.
(sparc_ravenscar_prepare_to_store): Remove.
(sparc_ravenscar_ops): Redefine.
* ravenscar-thread.h (struct ravenscar_arch_ops): Add virtual
methods and destructor. Remove members.
* ravenscar-thread.c (ravenscar_thread_target::fetch_registers)
(ravenscar_thread_target::store_registers)
(ravenscar_thread_target::prepare_to_store): Update.
* ppc-ravenscar-thread.c (ppc_ravenscar_generic_prepare_to_store):
Remove.
(struct ppc_ravenscar_powerpc_ops): Derive from
ravenscar_arch_ops.
(ppc_ravenscar_powerpc_ops::fetch_registers)
(ppc_ravenscar_powerpc_ops::store_registers): Now methods.
(ppc_ravenscar_powerpc_ops): Redefine.
(struct ppc_ravenscar_e500_ops): Derive from ravenscar_arch_ops.
(ppc_ravenscar_e500_ops::fetch_registers)
(ppc_ravenscar_e500_ops::store_registers): Now methods.
(ppc_ravenscar_e500_ops): Redefine.
* aarch64-ravenscar-thread.c
(aarch64_ravenscar_generic_prepare_to_store): Remove.
(struct aarch64_ravenscar_ops): Derive from ravenscar_arch_ops.
(aarch64_ravenscar_fetch_registers)
(aarch64_ravenscar_store_registers): Now methods.
(aarch64_ravenscar_ops): Redefine.
This changes some code in ravenscar-thread.c to use scoped_restore. I
am not sure if it matters in practice, but this makes these methods
exception-safe in case the methods lower in the target stack can
throw.
gdb/ChangeLog
2019-02-15 Tom Tromey <tromey@adacore.com>
* ravenscar-thread.c (ravenscar_thread_target::stopped_by_sw_breakpoint)
(ravenscar_thread_target::stopped_by_hw_breakpoint)
(ravenscar_thread_target::stopped_by_watchpoint)
(ravenscar_thread_target::stopped_data_address)
(ravenscar_thread_target::core_of_thread): Use scoped_restore.
Phillipe noticed that create_ada_exception_catchpoint was not freeing
the "addr_string" memory:
==14141== 114 bytes in 4 blocks are definitely lost in loss record 1,054 of 3,424
==14141== at 0x4C2BE6D: malloc (vg_replace_malloc.c:309)
==14141== by 0x405107: xmalloc (common-utils.c:44)
==14141== by 0x7563F9: xstrdup (xstrdup.c:34)
==14141== by 0x381B21: ada_exception_sal (ada-lang.c:13217)
==14141== by 0x381B21: create_ada_exception_catchpoint(gdbarch*, ada_exception_catchpoint_kind, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int, int, int) (ada-lang.c:13251)
==14141== by 0x3820A8: catch_ada_exception_command(char const*, int, cmd_list_element*) (ada-lang.c:13285)
==14141== by 0x3F4828: cmd_func(cmd_list_element*, char const*, int) (cli-decode.c:1892)
This patch fixes the problem by changing ada_exception_sal to return a
std::string via its out parameter.
gdb/ChangeLog
2019-02-15 Philippe Waroquiers <philippe.waroquiers@skynet.be>
Tom Tromey <tromey@adacore.com>
* ada-lang.c (ada_exception_sal): Change addr_string to a
std::string.
(create_ada_exception_catchpoint): Update.
Philippe noticed a memory leak coming from ada_catchpoint_location --
it was not freeing the "function_name" member from its base class:
==14141== 114 bytes in 4 blocks are definitely lost in loss record 1,055 of 3,424
==14141== at 0x4C2BE6D: malloc (vg_replace_malloc.c:309)
==14141== by 0x405107: xmalloc (common-utils.c:44)
==14141== by 0x7563F9: xstrdup (xstrdup.c:34)
==14141== by 0x3B82B3: set_breakpoint_location_function(bp_location*, int) (breakpoint.c:7156)
==14141== by 0x3C112B: add_location_to_breakpoint(breakpoint*, symtab_and_line const*) (breakpoint.c:8609)
==14141== by 0x3C127A: init_raw_breakpoint(breakpoint*, gdbarch*, symtab_and_line, bptype, breakpoint_ops const*) (breakpoint.c:7187)
==14141== by 0x3C1B52: init_ada_exception_breakpoint(breakpoint*, gdbarch*, symtab_and_line, char const*, breakpoint_ops const*, int, int, int) (breakpoint.c:11262)
==14141== by 0x381C2E: create_ada_exception_catchpoint(gdbarch*, ada_exception_catchpoint_kind, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int, int, int) (ada-lang.c:13255)
This patch fixes the problem by further C++-ifying bp_location. In
particular, bp_location_ops is now removed, and the "dtor" function
pointer is replaced with an ordinary destructor.
gdb/ChangeLog
2019-02-15 Philippe Waroquiers <philippe.waroquiers@skynet.be>
Tom Tromey <tromey@adacore.com>
* breakpoint.c (~bp_location): Rename from bp_location_dtor.
(bp_location_ops): Remove.
(base_breakpoint_allocate_location): Update.
(free_bp_location): Update.
* ada-lang.c (class ada_catchpoint_location)
<ada_catchpoint_location>: Remove ops parameter.
(ada_catchpoint_location_dtor): Remove.
(ada_catchpoint_location_ops): Remove.
(allocate_location_exception): Update.
* breakpoint.h (struct bp_location_ops): Remove.
(class bp_location) <bp_location>: Remove bp_location_ops
parameter.
<~bp_location>: Add destructor.
<ops>: Remove.
... as a follow-up to commit d981640286 "Run more
ld tests when not native", which replaced by a proper solution the following
mess before present in 'ld/configure.host':
-*-*-gnu*)
- # When creating static executables, we ought to use crt0.o instead of crt1.o,
- # <http://www.gnu.org/software/hurd/open_issues/binutils.html#static>,
- # but the testing infrastructure is not prepared for that. This is not
- # relevant for most tests, and the few remaining ones have been XFAILed.
- HOSTING_CRT0='[...]'
- HOSTING_LIBS='[...]'
ld/
* testsuite/ld-elf/elf.exp: Remove Hurd XFAILs.
..., which is not defined in GNU/Hurd systems, and so commit
94585166df "Extended-remote follow-exec" caused:
[...]/gdb/remote.c: In member function 'void remote_target::remote_parse_stop_reply(const char*, stop_reply*)':
[...]/gdb/remote.c:7343:22: error: 'PATH_MAX' was not declared in this scope
char pathname[PATH_MAX];
^~~~~~~~
gdb/
* remote.c (remote_target::remote_parse_stop_reply): Avoid using
'PATH_MAX'.
Hurd's commit baf7e5c8ce176aead15c2559952d8bdf0da41ffd "hurd: Use polymorphic
port types to return some rights" causes in the GDB build:
/usr/bin/ld: process_reply_S.o: in function `_Xproc_pid2proc_reply':
[...]/gdb/process_reply_S.c:754: undefined reference to `S_proc_pid2proc_reply'
/usr/bin/ld: [...]/gdb/process_reply_S.c:730: undefined reference to `S_proc_pid2proc_reply'
/usr/bin/ld: process_reply_S.o: in function `_Xproc_task2proc_reply':
[...]/gdb/process_reply_S.c:589: undefined reference to `S_proc_task2proc_reply'
/usr/bin/ld: [...]/gdb/process_reply_S.c:565: undefined reference to `S_proc_task2proc_reply'
/usr/bin/ld: process_reply_S.o: in function `_Xproc_getmsgport_reply':
[...]/gdb/process_reply_S.c:204: undefined reference to `S_proc_getmsgport_reply'
/usr/bin/ld: [...]/gdb/process_reply_S.c:180: undefined reference to `S_proc_getmsgport_reply'
collect2: error: ld returned 1 exit status
gdb/
* gnu-nat.c (S_proc_getmsgport_reply, S_proc_task2proc_reply)
(S_proc_pid2proc_reply): Adjust to Hurd "proc" interface changes.
... that appeared with 9bf2a70066
"-Wwrite-strings: Remove -Wno-write-strings".
gdb/
* gnu-nat.c (gnu_write_inferior, parse_int_arg, _parse_bool_arg)
(check_empty): Use "const char *".
..., that is commit 00431a78b2 causing:
[...]/gdb/gnu-nat.c: In member function 'virtual void gnu_nat_target::detach(inferior*, int)':
[...]/gdb/gnu-nat.c:2284:23: error: invalid conversion from 'int' to 'inferior*' [-fpermissive]
detach_inferior (pid);
^
In file included from [...]/gdb/gnu-nat.c:61:0:
[...]/gdb/inferior.h:523:13: note: initializing argument 1 of 'void detach_inferior(inferior*)'
extern void detach_inferior (inferior *inf);
^~~~~~~~~~~~~~~
Fixed by inlining the removed code.
gdb/
* gnu-nat.c (gnu_nat_target::detach): Instead of
'detach_inferior (pid)' call
'detach_inferior (find_inferior_pid (pid))'.
..., that is commit f6ac5f3d63 causing:
In file included from [...]/gdb/gnu-nat.c:24:0:
[...]/gdb/gnu-nat.h:123:1: error: expected class-name before '{' token
{
^
[...]/gdb/gnu-nat.h:128:16: error: 'inferior' has not been declared
void detach (inferior *, int) override;
^~~~~~~~
[...]/gdb/gnu-nat.h:132:8: error: use of enum 'target_xfer_status' without previous declaration
enum target_xfer_status xfer_partial (enum target_object object,
^~~~~~~~~~~~~~~~~~
[...]/gdb/gnu-nat.h:132:46: error: use of enum 'target_object' without previous declaration
enum target_xfer_status xfer_partial (enum target_object object,
^~~~~~~~~~~~~
[...]/gdb/gnu-nat.h:124:8: error: 'void gnu_nat_target::attach(const char*, int)' marked 'override', but does not override
void attach (const char *, int) override;
^~~~~~
[...]
[...]/gdb/gnu-nat.c: In member function 'virtual void gnu_nat_target::detach(inferior*, int)':
[...]/gdb/gnu-nat.c:2286:34: error: 'ops' was not declared in this scope
inf_child_maybe_unpush_target (ops);
^~~
[...]/gdb/gnu-nat.c:2286:34: note: suggested alternative: 'open'
inf_child_maybe_unpush_target (ops);
^~~
open
[...]/gdb/gnu-nat.c:2286:3: error: 'inf_child_maybe_unpush_target' was not declared in this scope
inf_child_maybe_unpush_target (ops);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[...]/gdb/gnu-nat.c:2286:3: note: suggested alternative: 'maybe_unpush_target'
inf_child_maybe_unpush_target (ops);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
maybe_unpush_target
[...]/gdb/i386-gnu-nat.c:200:1: warning: 'void gnu_store_registers(target_ops*, regcache*, int)' defined but not used [-Wunused-function]
gnu_store_registers (struct target_ops *ops,
^~~~~~~~~~~~~~~~~~~
[...]/gdb/i386-gnu-nat.c:109:1: warning: 'void gnu_fetch_registers(target_ops*, regcache*, int)' defined but not used [-Wunused-function]
gnu_fetch_registers (struct target_ops *ops,
^~~~~~~~~~~~~~~~~~~
[...]
/usr/bin/ld: i386-gnu-nat.o:(.data.rel+0x0): undefined reference to `vtable for i386_gnu_nat_target'
collect2: error: ld returned 1 exit status
gdb/
* gnu-nat.c (gnu_nat_target::detach): Instead of
'inf_child_maybe_unpush_target (ops)' call 'maybe_unpush_target'.
* gnu-nat.h: #include "inf-child.h".
* i386-gnu-nat.c (gnu_fetch_registers): Rename/move to
'i386_gnu_nat_target::fetch_registers'.
(gnu_store_registers): Rename/move to
'i386_gnu_nat_target::store_registers'.
In file included from ./nm.h:25:0,
from [...]/gdb/defs.h:423,
from [...]/gdb/gdb.c:19:
[...]/gdb/regcache.h:35:46: warning: 'get_thread_regcache' initialized and declared 'extern'
extern struct regcache *get_thread_regcache (thread_info *thread);
^~~~~~~~~~~
[...]/gdb/regcache.h:35:46: error: 'regcache* get_thread_regcache' redeclared as different kind of symbol
[...]
[...]/gdb/gdbarch.h:1203:69: error: 'thread_info' is not a type
extern LONGEST gdbarch_get_syscall_number (struct gdbarch *gdbarch, thread_info *thread);
^~~~~~~~~~~
Fixed with a different (self-contained, more maintainable?) approach compared
to what has been done in commit 7aabaf9d4a
"Create private_thread_info hierarchy", and commit
75cbc781e3 "gdb: For macOS, s/thread_info/struct
thread_info/". We don't want to change all the GDB code to everywhere use
'class thread_info' or 'struct thread_info' instead of plain 'thread_info'.
gdb/
* config/i386/nm-i386gnu.h: Don't "#include" any files.
* gnu-nat.h (mach_thread_info): New function.
* gnu-nat.c (thread_takeover_sc_cmd): Use it.
Using the gdb.ada/call_pn.exp testcase, and running it by hand on
riscv64-elf, we get the following error:
(gdb) call pn(55)
Could not compute alignment of type
The problem occurs because the parameter's type is a TYPE_CODE_RANGE,
and that type code is not handled by riscv_type_alignment. So this patch
fixes the issue by handling TYPE_CODE_RANGE the same way we handle other
integral types.
gdb/ChangeLog:
* riscv-rdep.c (riscv_type_alignment): Handle TYPE_CODE_RANGE.
Tested on riscv64-elf using AdaCore's testsuite.
This is a followup on a recent patch which, among other things
introduced the exit notification of the main thread in order
to be symetrical with the fact that a thread notification was
emitted before signaling its creation.
This patch takes the opposite approach of removing both creation
and exit notifications for that main thread, which is consistent
with what is done on other platforms such as GNU/Linux for instance.
gdb/ChangeLog
* windows-nat.c (windows_add_thread): Add new parameter
"main_thread_p" with default value set to false. Update
function documentation as well as all callers.
(windows_delete_thread): Likewise.
(fake_create_process): Update call to windows_add_thread.
(get_windows_debug_event) <CREATE_THREAD_DEBUG_EVENT>
<CREATE_PROCESS_DEBUG_EVENT>: Likewise.
<EXIT_THREAD_DEBUG_EVENT, EXIT_PROCESS_DEBUG_EVENT>: Update
call to windows_delete_thread.
Tested on x86-windows (MinGW) using AdaCore's testsuite.
gdb/testsuite/ChangeLog
2019-02-12 Weimin Pan <weimin.pan@oracle.com>
PR breakpoints/21870
* gdb.arch/aarch64-dbreg-contents.exp: New file.
* gdb.arch/aarch64-dbreg-contents.c: New file.
Object file paths passed to find_separate_debug_file are always
canonical paths with symbolic links resolved. If a sysroot path
traverses a symbolic link, it will not match the object file paths.
Generate a canonical version of the sysroot directory. If it is
valid, use it instead of gdb_sysroot with child_path to determine if
an object file is under a system root.
gdb/ChangeLog:
* symfile.c (find_separate_debug_file): Use canonical path of
sysroot with child_path instead of gdb_sysroot if it is valid.
This fixes the case where the sysroot happens to end in a trailing
'/'. Note that the path returned from child_path always skips over
the directory separator at the start of the base path, so a separator
must always be explicitly added before the base path.
gdb/ChangeLog:
* symfile.c (find_separate_debug_file): Use child_path to
determine if an object file is under a sysroot.
child_path returns a pointer to the first component in a child path
that comes after a parent path. This does not depend on trying to
stat() the paths since they may describe remote paths but instead
relies on filename parsing. The function requires that the child path
describe a filename that contains at least one component below the
parent path and returns a pointer to the first component.
gdb/ChangeLog:
* Makefile.in (SUBDIR_UNITTESTS_SRCS): Add
unittests/child-path-selftests.c.
* common/pathstuff.c (child_path): New function.
* common/pathstuff.h (child_path): New prototype.
* unittests/child-path-selftests.c: New file.
When an object file is present in a system root, GDB currently looks
for separate debug files under the global debugfile directories. For
example, if the sysroot is set to "/myroot" and hte global debugfile
directory is set to "/usr/lib/debug", GDB will look for a separate
debug file for "/myroot/lib/libc.so.7" in the following paths:
/myroot/lib/libc.so.7.debug
/myroot/lib/.debug/libc.so.7.debug
/usr/lib/debug//myroot/lib/libc.so.7.debug
/usr/lib/debug/lib/libc.so.7.debug
However, some system roots include a full system installation
including a nested global debugfile directory under the sysroot. This
patch adds an additional check to support such systems. In the
example above the additional path searched is:
/myroot/usr/lib/debug/lib/libc.so.7.debug
To try to preserve existing behavior as much as possible, this new
path is searched last for each global debugfile directory.
gdb/ChangeLog:
* symfile.c (find_separate_debug_file): Look for separate debug
files in debug directories under the sysroot.