Lancelot SIX [Mon, 7 Jun 2021 22:14:55 +0000 (23:14 +0100)]
Use is/is not to check for None in python code.
While reviewing a patch sent to the mailing list, I noticed there are few
places where python code checks if a variable is 'None' or not by using the
comparison operators '==' and '!='. PEP8[1], which is used as coding standard
in GDBÂ coding standards, recommends using 'is' / 'is not' when comparing to a
singleton such as 'None'.
This patch proposes to change the instances of '== None' by 'is None' and
'!= None' by 'is not None'.
[1] https://www.python.org/dev/peps/pep-0008/
gdb/doc/ChangeLog:
* python.texi (Writing a Pretty-Printer): Use 'is None' instead of
'== None'.
gdb/ChangeLog:
* python/lib/gdb/FrameDecorator.py (FrameDecorator): Use 'is None' instead of
'== None'.
(FrameVars): Use 'is not None' instead of '!= None'.
* python/lib/gdb/command/frame_filters.py (SetFrameFilterPriority): Use 'is None'
instead of '== None' and 'is not None' instead of '!= None'.
gdb/testsuite/ChangeLog:
* gdb.base/premature-dummy-frame-removal.py (TestUnwinder): Use
'is None' instead of '== None' and 'is not None' instead of
'!= None'.
* gdb.python/py-frame-args.py (lookup_function): Same.
* gdb.python/py-framefilter-invalidarg.py (Reverse_Function): Same.
* gdb.python/py-framefilter.py (Reverse_Function): Same.
* gdb.python/py-nested-maps.py (lookup_function): Same.
* gdb.python/py-objfile-script-gdb.py (lookup_function): Same.
* gdb.python/py-prettyprint.py (lookup_function): Same.
* gdb.python/py-section-script.py (lookup_function): Same.
* gdb.python/py-unwind-inline.py (dummy_unwinder): Same.
* gdb.python/python.exp: Same.
* gdb.rust/pp.py (lookup_function): Same.
Simon Marchi [Tue, 8 Jun 2021 20:50:53 +0000 (16:50 -0400)]
gdb: try to load libthread_db only after reading all shared libraries when attaching / handling a fork child
When trying to attach to a pthread process on a Linux system with glibc 2.33,
we get:
$ ./gdb -q -nx --data-directory=data-directory -p
1472010
Attaching to process
1472010
[New LWP
1472013]
[New LWP
1472014]
[New LWP
1472015]
Error while reading shared library symbols for /usr/lib/libpthread.so.0:
Cannot find user-level thread for LWP
1472015: generic error
0x00007ffff6d3637f in poll () from /usr/lib/libc.so.6
(gdb)
When attaching to a process (or handling a fork child, an operation very
similar to attaching), GDB reads the shared library list from the
process. For each shared library (if "set auto-solib-add" is on), it
reads its symbols and calls the "new_objfile" observable.
The libthread-db code monitors this observable, and if it sees an
objfile named somewhat like "libpthread.so" go by, it tries to load
libthread_db.so in the GDB process itself. libthread_db knows how to
navigate libpthread's data structures to get information about the
existing threads.
To locate these data structures, libthread_db calls ps_pglobal_lookup
(implemented in proc-service.c), passing in a symbol name and expecting
an address in return.
Before glibc 2.33, libthread_db always asked for symbols found in
libpthread. There was no ordering problem: since we were always trying
to load libthread_db in reaction to processing libpthread (and reading
in its symbols) and libthread_db only asked symbols from libpthread, the
requested symbols could always be found. Starting with glibc 2.33,
libthread_db now asks for a symbol name that can be found in
/lib/ld-linux-x86-64.so.2 (_rtld_global). And the ordering in which GDB
reads the shared libraries from the inferior when attaching is
unfortunate, in that libpthread is processed before ld-linux. So when
loading libthread_db in reaction to processing libpthread, and
libthread_db requests the symbol that is from ld-linux, GDB is not yet
able to supply it.
That problematic symbol lookup happens in the thread_from_lwp function,
when we call td_ta_map_lwp2thr_p, and an exception is thrown at this
point:
#0 0x00007ffff6681012 in __cxxabiv1::__cxa_throw (obj=0x60e000006100, tinfo=0x555560033b50 <typeinfo for gdb_exception_error>, dest=0x55555d9404bc <gdb_exception_error::~gdb_exception_error()>) at /build/gcc/src/gcc/libstdc++-v3/libsupc++/eh_throw.cc:78
#1 0x000055555e5d3734 in throw_it(return_reason, errors, const char *, typedef __va_list_tag __va_list_tag *) (reason=RETURN_ERROR, error=GENERIC_ERROR, fmt=0x55555f0c5360 "Cannot find user-level thread for LWP %ld: %s", ap=0x7fffffffaae0) at /home/simark/src/binutils-gdb/gdbsupport/common-exceptions.cc:200
#2 0x000055555e5d37d4 in throw_verror (error=GENERIC_ERROR, fmt=0x55555f0c5360 "Cannot find user-level thread for LWP %ld: %s", ap=0x7fffffffaae0) at /home/simark/src/binutils-gdb/gdbsupport/common-exceptions.cc:208
#3 0x000055555e0b0ed2 in verror (string=0x55555f0c5360 "Cannot find user-level thread for LWP %ld: %s", args=0x7fffffffaae0) at /home/simark/src/binutils-gdb/gdb/utils.c:171
#4 0x000055555e5e898a in error (fmt=0x55555f0c5360 "Cannot find user-level thread for LWP %ld: %s") at /home/simark/src/binutils-gdb/gdbsupport/errors.cc:43
#5 0x000055555d06b4bc in thread_from_lwp (stopped=0x617000035d80, ptid=...) at /home/simark/src/binutils-gdb/gdb/linux-thread-db.c:418
#6 0x000055555d07040d in try_thread_db_load_1 (info=0x60c000011140) at /home/simark/src/binutils-gdb/gdb/linux-thread-db.c:912
#7 0x000055555d071103 in try_thread_db_load (library=0x55555f0c62a0 "libthread_db.so.1", check_auto_load_safe=false) at /home/simark/src/binutils-gdb/gdb/linux-thread-db.c:1014
#8 0x000055555d072168 in try_thread_db_load_from_sdir () at /home/simark/src/binutils-gdb/gdb/linux-thread-db.c:1091
#9 0x000055555d072d1c in thread_db_load_search () at /home/simark/src/binutils-gdb/gdb/linux-thread-db.c:1146
#10 0x000055555d07365c in thread_db_load () at /home/simark/src/binutils-gdb/gdb/linux-thread-db.c:1203
#11 0x000055555d07373e in check_for_thread_db () at /home/simark/src/binutils-gdb/gdb/linux-thread-db.c:1246
#12 0x000055555d0738ab in thread_db_new_objfile (objfile=0x61300000c0c0) at /home/simark/src/binutils-gdb/gdb/linux-thread-db.c:1275
#13 0x000055555bd10740 in std::__invoke_impl<void, void (*&)(objfile*), objfile*> (__f=@0x616000068d88: 0x55555d073745 <thread_db_new_objfile(objfile*)>) at /usr/include/c++/10.2.0/bits/invoke.h:60
#14 0x000055555bd02096 in std::__invoke_r<void, void (*&)(objfile*), objfile*> (__fn=@0x616000068d88: 0x55555d073745 <thread_db_new_objfile(objfile*)>) at /usr/include/c++/10.2.0/bits/invoke.h:153
#15 0x000055555bce0392 in std::_Function_handler<void (objfile*), void (*)(objfile*)>::_M_invoke(std::_Any_data const&, objfile*&&) (__functor=..., __args#0=@0x7fffffffb4a0: 0x61300000c0c0) at /usr/include/c++/10.2.0/bits/std_function.h:291
#16 0x000055555d3595c0 in std::function<void (objfile*)>::operator()(objfile*) const (this=0x616000068d88, __args#0=0x61300000c0c0) at /usr/include/c++/10.2.0/bits/std_function.h:622
#17 0x000055555d356b7f in gdb::observers::observable<objfile*>::notify (this=0x555566727020 <gdb::observers::new_objfile>, args#0=0x61300000c0c0) at /home/simark/src/binutils-gdb/gdb/../gdbsupport/observable.h:106
#18 0x000055555da3f228 in symbol_file_add_with_addrs (abfd=0x61200001ccc0, name=0x6190000d9090 "/usr/lib/libpthread.so.0", add_flags=..., addrs=0x7fffffffbc10, flags=..., parent=0x0) at /home/simark/src/binutils-gdb/gdb/symfile.c:1131
#19 0x000055555da3f763 in symbol_file_add_from_bfd (abfd=0x61200001ccc0, name=0x6190000d9090 "/usr/lib/libpthread.so.0", add_flags=<error reading variable: Cannot access memory at address 0xffffffffffffffb0>, addrs=0x7fffffffbc10, flags=<error reading variable: Cannot access memory at address 0xffffffffffffffc0>, parent=0x0) at /home/simark/src/binutils-gdb/gdb/symfile.c:1167
#20 0x000055555d95f9fa in solib_read_symbols (so=0x6190000d8e80, flags=...) at /home/simark/src/binutils-gdb/gdb/solib.c:681
#21 0x000055555d96233d in solib_add (pattern=0x0, from_tty=0, readsyms=1) at /home/simark/src/binutils-gdb/gdb/solib.c:987
#22 0x000055555d93646e in enable_break (info=0x608000008f20, from_tty=0) at /home/simark/src/binutils-gdb/gdb/solib-svr4.c:2238
#23 0x000055555d93cfc0 in svr4_solib_create_inferior_hook (from_tty=0) at /home/simark/src/binutils-gdb/gdb/solib-svr4.c:3049
#24 0x000055555d96610d in solib_create_inferior_hook (from_tty=0) at /home/simark/src/binutils-gdb/gdb/solib.c:1195
#25 0x000055555cdee318 in post_create_inferior (from_tty=0) at /home/simark/src/binutils-gdb/gdb/infcmd.c:318
#26 0x000055555ce00e6e in setup_inferior (from_tty=0) at /home/simark/src/binutils-gdb/gdb/infcmd.c:2439
#27 0x000055555ce59c34 in handle_one (event=...) at /home/simark/src/binutils-gdb/gdb/infrun.c:4887
#28 0x000055555ce5cd00 in stop_all_threads () at /home/simark/src/binutils-gdb/gdb/infrun.c:5064
#29 0x000055555ce7f0da in stop_waiting (ecs=0x7fffffffd170) at /home/simark/src/binutils-gdb/gdb/infrun.c:8006
#30 0x000055555ce67f5c in handle_signal_stop (ecs=0x7fffffffd170) at /home/simark/src/binutils-gdb/gdb/infrun.c:6062
#31 0x000055555ce63653 in handle_inferior_event (ecs=0x7fffffffd170) at /home/simark/src/binutils-gdb/gdb/infrun.c:5727
#32 0x000055555ce4f297 in fetch_inferior_event () at /home/simark/src/binutils-gdb/gdb/infrun.c:4105
#33 0x000055555cdbe3bf in inferior_event_handler (event_type=INF_REG_EVENT) at /home/simark/src/binutils-gdb/gdb/inf-loop.c:42
#34 0x000055555d018047 in handle_target_event (error=0, client_data=0x0) at /home/simark/src/binutils-gdb/gdb/linux-nat.c:4060
#35 0x000055555e5ea77e in handle_file_event (file_ptr=0x60600008b1c0, ready_mask=1) at /home/simark/src/binutils-gdb/gdbsupport/event-loop.cc:575
#36 0x000055555e5eb09c in gdb_wait_for_event (block=0) at /home/simark/src/binutils-gdb/gdbsupport/event-loop.cc:701
#37 0x000055555e5e8d19 in gdb_do_one_event () at /home/simark/src/binutils-gdb/gdbsupport/event-loop.cc:212
#38 0x000055555dd6e0d4 in wait_sync_command_done () at /home/simark/src/binutils-gdb/gdb/top.c:528
#39 0x000055555dd6e372 in maybe_wait_sync_command_done (was_sync=0) at /home/simark/src/binutils-gdb/gdb/top.c:545
#40 0x000055555d0ec7c8 in catch_command_errors (command=0x55555ce01bb8 <attach_command(char const*, int)>, arg=0x7fffffffe28d "
1472010", from_tty=1, do_bp_actions=false) at /home/simark/src/binutils-gdb/gdb/main.c:452
#41 0x000055555d0f03ad in captured_main_1 (context=0x7fffffffdd10) at /home/simark/src/binutils-gdb/gdb/main.c:1149
#42 0x000055555d0f1239 in captured_main (data=0x7fffffffdd10) at /home/simark/src/binutils-gdb/gdb/main.c:1232
#43 0x000055555d0f1315 in gdb_main (args=0x7fffffffdd10) at /home/simark/src/binutils-gdb/gdb/main.c:1257
#44 0x000055555bb70cf9 in main (argc=7, argv=0x7fffffffde88) at /home/simark/src/binutils-gdb/gdb/gdb.c:32
The exception is caught here:
#0 __cxxabiv1::__cxa_begin_catch (exc_obj_in=0x60e0000060e0) at /build/gcc/src/gcc/libstdc++-v3/libsupc++/eh_catch.cc:84
#1 0x000055555d95fded in solib_read_symbols (so=0x6190000d8e80, flags=...) at /home/simark/src/binutils-gdb/gdb/solib.c:689
#2 0x000055555d96233d in solib_add (pattern=0x0, from_tty=0, readsyms=1) at /home/simark/src/binutils-gdb/gdb/solib.c:987
#3 0x000055555d93646e in enable_break (info=0x608000008f20, from_tty=0) at /home/simark/src/binutils-gdb/gdb/solib-svr4.c:2238
#4 0x000055555d93cfc0 in svr4_solib_create_inferior_hook (from_tty=0) at /home/simark/src/binutils-gdb/gdb/solib-svr4.c:3049
#5 0x000055555d96610d in solib_create_inferior_hook (from_tty=0) at /home/simark/src/binutils-gdb/gdb/solib.c:1195
#6 0x000055555cdee318 in post_create_inferior (from_tty=0) at /home/simark/src/binutils-gdb/gdb/infcmd.c:318
#7 0x000055555ce00e6e in setup_inferior (from_tty=0) at /home/simark/src/binutils-gdb/gdb/infcmd.c:2439
#8 0x000055555ce59c34 in handle_one (event=...) at /home/simark/src/binutils-gdb/gdb/infrun.c:4887
#9 0x000055555ce5cd00 in stop_all_threads () at /home/simark/src/binutils-gdb/gdb/infrun.c:5064
#10 0x000055555ce7f0da in stop_waiting (ecs=0x7fffffffd170) at /home/simark/src/binutils-gdb/gdb/infrun.c:8006
#11 0x000055555ce67f5c in handle_signal_stop (ecs=0x7fffffffd170) at /home/simark/src/binutils-gdb/gdb/infrun.c:6062
#12 0x000055555ce63653 in handle_inferior_event (ecs=0x7fffffffd170) at /home/simark/src/binutils-gdb/gdb/infrun.c:5727
#13 0x000055555ce4f297 in fetch_inferior_event () at /home/simark/src/binutils-gdb/gdb/infrun.c:4105
#14 0x000055555cdbe3bf in inferior_event_handler (event_type=INF_REG_EVENT) at /home/simark/src/binutils-gdb/gdb/inf-loop.c:42
#15 0x000055555d018047 in handle_target_event (error=0, client_data=0x0) at /home/simark/src/binutils-gdb/gdb/linux-nat.c:4060
#16 0x000055555e5ea77e in handle_file_event (file_ptr=0x60600008b1c0, ready_mask=1) at /home/simark/src/binutils-gdb/gdbsupport/event-loop.cc:575
#17 0x000055555e5eb09c in gdb_wait_for_event (block=0) at /home/simark/src/binutils-gdb/gdbsupport/event-loop.cc:701
#18 0x000055555e5e8d19 in gdb_do_one_event () at /home/simark/src/binutils-gdb/gdbsupport/event-loop.cc:212
#19 0x000055555dd6e0d4 in wait_sync_command_done () at /home/simark/src/binutils-gdb/gdb/top.c:528
#20 0x000055555dd6e372 in maybe_wait_sync_command_done (was_sync=0) at /home/simark/src/binutils-gdb/gdb/top.c:545
#21 0x000055555d0ec7c8 in catch_command_errors (command=0x55555ce01bb8 <attach_command(char const*, int)>, arg=0x7fffffffe28d "
1472010", from_tty=1, do_bp_actions=false) at /home/simark/src/binutils-gdb/gdb/main.c:452
#22 0x000055555d0f03ad in captured_main_1 (context=0x7fffffffdd10) at /home/simark/src/binutils-gdb/gdb/main.c:1149
#23 0x000055555d0f1239 in captured_main (data=0x7fffffffdd10) at /home/simark/src/binutils-gdb/gdb/main.c:1232
#24 0x000055555d0f1315 in gdb_main (args=0x7fffffffdd10) at /home/simark/src/binutils-gdb/gdb/main.c:1257
#25 0x000055555bb70cf9 in main (argc=7, argv=0x7fffffffde88) at /home/simark/src/binutils-gdb/gdb/gdb.c:32
Catching the exception at this point means that the thread_db_info
object for this inferior will be left in place, despite the failure to
load libthread_db. This means that there won't be further attempts at
loading libthread_db, because thread_db_load will think that
libthread_db is already loaded for this inferior and will always exit
early. To fix this, add a try/catch around calling try_thread_db_load_1
in try_thread_db_load, such that if some exception is thrown while
trying to load libthread_db, we reset / delete the thread_db_info for
that inferior. That alone makes attach work fine again, because
check_for_thread_db is called again in the thread_db_inferior_created
observer (that happens after we learned about all shared libraries and
their symbols), and libthread_db is successfully loaded then.
When attaching, I think that the inferior_created observer is a good
place to try to load libthread_db: it is called once everything has
stabilized, when we learned about all shared libraries.
The only problem then is that when we first try (and fail) to load
libthread_db, in reaction to learning about libpthread, we show this
warning:
warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available.
This is misleading, because we do succeed in loading it later. So when
attaching, I think we shouldn't try to load libthread_db in reaction to
the new_objfile events, we should wait until we have learned about all
shared libraries (using the inferior_created observable). To do so, add
an `in_initial_library_scan` flag to struct inferior. This flag is used
to postpone loading libthread_db if we are attaching or handling a fork
child.
When debugging remotely with GDBserver, the same problem happens, except
that the qSymbol mechanism (allowing the remote side to ask GDB for
symbols values) is involved. The fix there is the same idea, we make
GDB wait until all shared libraries and their symbols are known before
sending out a qSymbol packet. This way, we never present the remote
side a state where libpthread.so's symbols are known but ld-linux's
symbols aren't.
gdb/ChangeLog:
* inferior.h (class inferior) <in_initial_library_scan>: New.
* infcmd.c (post_create_inferior): Set in_initial_library_scan.
* infrun.c (follow_fork_inferior): Likewise.
* linux-thread-db.c (try_thread_db_load): Catch exception thrown
by try_thread_db_load_1
(thread_db_load): Return early if in_initial_library_scan is
set.
* remote.c (remote_new_objfile): Return early if
in_initial_library_scan is set.
Change-Id: I7a279836cfbb2b362b4fde11b196b4aab82f5efb
Michael Matz [Tue, 8 Jun 2021 15:39:02 +0000 (17:39 +0200)]
bfd/elf: Don't read non-existing secondary relocs
I forgot the ChangeLog commit :-/
Tom de Vries [Tue, 8 Jun 2021 15:39:05 +0000 (17:39 +0200)]
[gdb/testsuite] Disallow single argument in multi_line
It's a common mistake of mine to do:
...
set l [list "foo" "bar"]
set re [multi_line $l]
...
and to get "foo bar" while I was expecting "foo\r\nbar", which I get after
doing instead:
...
set re [multi_line {*}$l]
...
Detect this type of mistake by erroring out in multi_line when only one
argument is passed.
Tested on x86_64-linux.
gdb/testsuite/ChangeLog:
2021-06-08 Tom de Vries <tdevries@suse.de>
* lib/gdb.exp (multi_line): Require more than one argument.
* gdb.base/gdbinit-history.exp: Update multi_line call.
* gdb.base/jit-reader.exp: Remove multi_line call.
* gdb.fortran/dynamic-ptype-whatis.exp: Same.
Michael Matz [Mon, 7 Jun 2021 13:52:31 +0000 (15:52 +0200)]
bfd/elf: Don't read non-existing secondary relocs
Without this we unconditionally try to slurp in secondary
relocs for each input section, leading to quadratic behaviour
even for strip(1). On write-out we already used a flag to avoid
this.
So track existence of secondary relocs on read-in as well and
only slurp in when needed. This still doesn't implement a proper
list of secondary reloc sections, and still would exhibit quadratic
behaviour if most input sections have a secondary reloc section.
But at least on normal input this avoids any slowdown from trying
to handle secondary relocation sections.
bfd/
* elf.c (bfd_section_from_shdr): Set has_secondary_relocs flag.
(_bfd_elf_slurp_secondary_reloc_section): Use it for early-out.
Tom de Vries [Tue, 8 Jun 2021 13:36:46 +0000 (15:36 +0200)]
[gdb/testsuite] Fix gdb.base/info-macros.exp with check-read1
With check-read1 we run into:
...
FAIL: gdb.base/info-macros.exp: info macros info-macros.c:42 (timeout)
...
Fix this by using gdb_test_lines from gdb.base/info-types.exp.tcl.
Tested on x86_64-linux.
gdb/testsuite/ChangeLog:
2021-06-08 Tom de Vries <tdevries@suse.de>
* gdb.base/info-types.exp.tcl (match_line, gdb_test_lines): Move ...
* lib/gdb.exp: ... here.
* gdb.base/info-macros.exp: Use gdb_test_lines.
Tom de Vries [Tue, 8 Jun 2021 13:36:46 +0000 (15:36 +0200)]
[gdb/testsuite] Simplify gdb.base/info-types.exp.tcl further
After adding support for --any in match_line, we can simplify
gdb.base/info-types.exp.tcl further: we can add the "All defined types:"
regexp in the output_lines list:
...
set output_lines \
[list \
+ "All defined types:" \
+ "--any" \
$file_re \
...
Consequently, we can simplify the state machine to track a variable "found"
with values:
- 0 (unmatched)
- 1 (matched)
- -1 (mismatch).
This makes the code generic enough to factor out into a new proc
gdb_test_lines.
Tested on x86_64-linux.
gdb/testsuite/ChangeLog:
2021-06-08 Tom de Vries <tdevries@suse.de>
* gdb.base/info-types.exp.tcl (match_line): Handle --any.
(gdb_test_lines): Factor out of ...
(run_test): ... here.
Jan Beulich [Tue, 8 Jun 2021 12:57:50 +0000 (14:57 +0200)]
x86: cover a.out in recently added tests
Follow the pattern found elsewhere when relocations are involved. For
wrap32-data also drop a mistakenly left "ELF" from the test name. (Note
that Darwin, for which the wrap32 tests are also failing, is left as-is,
for there being numerous other failures already anyway, and it hence
being questionable whether that target is actually properly maintained.)
Jan Beulich [Tue, 8 Jun 2021 12:57:18 +0000 (14:57 +0200)]
x86: minor improvements to optimize_imm() (part II)
Don't kind-of-open-code fits_in_unsigned_{word,long}().
Jan Beulich [Tue, 8 Jun 2021 12:56:39 +0000 (14:56 +0200)]
x86: minor improvements to optimize_disp() (part II)
- Don't kind-of-open-code fits_in_unsigned_{word,long}().
- Fold two if()s both using fits_in_unsigned_long().
Jan Beulich [Tue, 8 Jun 2021 12:55:56 +0000 (14:55 +0200)]
x86-64: avoid bogus warnings with 32-bit addressing
With optimize_disp() adjusting i.types[].bitfield.disp after adjusting
the value to be used as displacement, it better also stores the updated
value, to avoid subsequent "... shortened to ..." warnings. Note how
optimize_imm() already does so.
The -0xffffffff tests being added expose a separate issue: The encoding
chosen should be 1 for ModR/M.mod, not 2. This will want to be taken
care of, but not right here.
This at the same time addresses a similar warning and demonstrates a
similar encoding issue with 16-bit addressing. Since it was omitted
when introducing the lea16-optimize test, add a plain lea16 one to also
cover this.
Jan Beulich [Tue, 8 Jun 2021 12:54:48 +0000 (14:54 +0200)]
x86: minor improvements to optimize_disp() (part I)
- Do the zero checking first - there's no point in doing anything else
in this case.
- Drop two pointless & where just before it was checked that the
respective bits are clear already anyway.
Tom de Vries [Tue, 8 Jun 2021 12:50:45 +0000 (14:50 +0200)]
[gdb/testsuite] Fix gdb.base/batch-preserve-term-settings.exp with check-read1
With check-read1, I run into:
...
FAIL: gdb.base/batch-preserve-term-settings.exp: batch run: \
terminal settings preserved
...
This is caused by spawn_shell matching too little output, after which
things start to go out of sync.
More specifically, the regexp:
...
-re "PS1=\[^\r\n\]*\r\n.*$shell_prompt_re$" {
...
matches the first and part of the second line of this output:
...
PS1="gdb-subshell$ "^M
sh-4.4$ PS1="gdb-subshell$ "^M
gdb-subshell$
...
while it's supposed to match the entire output.
Fix this by splitting up the regexp into a part that skips the lines with PS1,
and one that reads the shell prompt.
Tested on x86_64-linux.
gdb/testsuite/ChangeLog:
2021-06-08 Tom de Vries <tdevries@suse.de>
* gdb.base/batch-preserve-term-settings.exp (spawn_shell): Fix
matching of initial prompt.
Tom de Vries [Tue, 8 Jun 2021 08:04:44 +0000 (10:04 +0200)]
[gdb/testsuite] Fix gdb.threads/multi-create-ns-info-thr.exp
With a testsuite setup modified to make expect wait a little bit longer for
gdb output (see PR27957), I reliably run into:
...
PASS: gdb.threads/multi-create-ns-info-thr.exp: continue to breakpoint 1
FAIL: gdb.threads/multi-create-ns-info-thr.exp: continue to breakpoint 2 \
(timeout)
...
This is due to this regexp:
...
-re "Breakpoint $decimal,.*$srcfile:$bp_location1" {
...
consuming several lines using the ".*" part, while it's intended to match one
line looking like this:
...
Thread 1 "multi-create-ns" hit Breakpoint 2, create_function () \
at multi-create.c:45^M
...
Fix this by limiting the regexp to one line.
Tested on x86_64-linux.
gdb/testsuite/ChangeLog:
2021-06-08 Tom de Vries <tdevries@suse.de>
* gdb.threads/multi-create-ns-info-thr.exp: Limit breakpoint regexp to
one line.
Tom de Vries [Tue, 8 Jun 2021 08:04:44 +0000 (10:04 +0200)]
[gdb/testsuite] Simplify gdb.base/sect-cmd.exp
While looking at gdb.base/sect-cmd.exp, I noticed a few things that can be
simplified:
- use gdb_test instead of gdb_test_multiple
- use -wrap "" as regexp
Also, I noticed this:
...
fail "$gdb_test_name, saw not found marker"
...
while our usual test naming scheme uses parentheses, like so:
...
fail "$gdb_test_name (saw not found marker)"
...
Fix the test-name and do the simplifications.
Tested on x86_64-linux.
gdb/testsuite/ChangeLog:
2021-06-08 Tom de Vries <tdevries@suse.de>
* gdb.base/sect-cmd.exp: Use gdb_test. Use -wrap "". Fix
test name.
Tom de Vries [Tue, 8 Jun 2021 08:04:44 +0000 (10:04 +0200)]
[gdb/testsuite] Fix gdb.base/sect-cmd.exp
With a testsuite setup modified to make expect wait a little bit longer for
gdb output (see PR27957), I reliably run into:
...
(gdb) FAIL: gdb.base/sect-cmd.exp: set section .text to original \
address (timeout)
...
The problem is a too greedy regexp:
...
-re ".*$address1 \- $address2 is $section_name.*" {
...
which ends up consuming the gdb prompt with the terminating ".*".
Fix this by limiting the regexp to a single line.
Tested on x86_64-linux.
gdb/testsuite/ChangeLog:
2021-06-08 Tom de Vries <tdevries@suse.de>
* gdb.base/sect-cmd.exp: Fix saw_section_address_line regexp.
Mike Frysinger [Sat, 29 May 2021 17:34:38 +0000 (13:34 -0400)]
sim: igen: harmonize tool variables
Separate the name of the igen program from the options used to run it.
This allows us to avoid duplicating ../igen/igen in Makefiles and reuse
the existing setting in the common Makefile. This also allows us to
easily harmonize the use of EXEEXT between igen/local.mk and the common
makefiles when cross-compiling for e.g. Windows.
Mike Frysinger [Sat, 29 May 2021 16:55:39 +0000 (12:55 -0400)]
gnulib: import select
A few sims use this to emulate the syscall & provide network
functionality.
Mike Frysinger [Sat, 29 May 2021 16:48:49 +0000 (12:48 -0400)]
gnulib: import netdb
A few sims use this to provide network functionality.
Mike Frysinger [Sat, 29 May 2021 16:47:59 +0000 (12:47 -0400)]
sim: v850: assume chown is available
Now that gnulib provides a wrapper, assume it always exists.
Mike Frysinger [Sat, 29 May 2021 16:10:38 +0000 (12:10 -0400)]
gnulib: import chown
A few sims use this to emulate chown syscalls.
GDB Administrator [Tue, 8 Jun 2021 00:00:41 +0000 (00:00 +0000)]
Automatic date update in version.in
Pedro Alves [Mon, 7 Jun 2021 22:59:17 +0000 (23:59 +0100)]
Fix a couple -Wdeprecated-copy issues
Building GDB with current git (future 13) Clang runs into these two
issues:
#1:
src/gdb/symtab.h:1139:3: error: definition of implicit copy assignment operator for 'symbol' is deprecated because it has a user-declared copy constructor [-Werror,-Wdeprecated-copy]
symbol (const symbol &) = default;
^
#2:
src/gdb/dwarf2/read.c:834:23: error: definition of implicit copy constructor for 'partial_die_info' is deprecated because it has a user-declared copy assignment operator [-Werror,-Wdeprecated-copy]
partial_die_info& operator=(const partial_die_info& rhs) = delete;
^
Fix them by adding the explicit defaulted versions of copy ctor and
copy-assign op appropriately.
gdb/ChangeLog:
yyyy-mm-dd Pedro Alves <pedro@palves.net>
* dwarf2/read.c (struct partial_die_info): Add defaulted copy
ctor.
* symtab.h (struct symbol): Add defaulted copy assignment
operator.
Pedro Alves [Mon, 7 Jun 2021 22:36:05 +0000 (23:36 +0100)]
gdb_rl_find_completion_word: Remove 'found_quote' local
Compiling GDB with current git Clang (future 13) runs into this:
src/gdb/completer.c:287:18: error: variable 'found_quote' set but not used [-Werror,-Wunused-but-set-variable]
int scan, end, found_quote, delimiter, pass_next, isbrk;
^
gdb_rl_find_completion_word came to life as a modified (stripped down)
version of readline's internal _rl_find_completion_word function.
When I added it, I don't remember whether I realized that
'found_quote' wasn't really necessary. Maybe I kept it thinking of
keeping the source code in sync with readline? I don't recall
anymore. Since the function is already stripped down compared to the
original, stripping it down some more doesn't hurt.
So fix the issue by removing the unnecessary code.
gdb/ChangeLog:
yyyy-mm-dd Pedro Alves <pedro@palves.net>
* completer.c (RL_QF_SINGLE_QUOTE, RL_QF_DOUBLE_QUOTE)
(RL_QF_BACKSLASH, RL_QF_OTHER_QUOTE): Delete.
(gdb_rl_find_completion_word): Remove write-only 'found_quote'
local.
Pedro Alves [Fri, 4 Jun 2021 13:50:15 +0000 (14:50 +0100)]
nat/amd64-linux-siginfo.c: Remove typedefs
Since GDB is written in C++ now, we don't need struct/union typedefs
any more. Remove them from nat/amd64-linux-siginfo.c.
gdb/ChangeLog:
yyyy-mm-dd Pedro Alves <pedro@palves.net>
* nat/amd64-linux-siginfo.c (union nat_sigval): Rename to ...
(nat_sigval_t): ... this and remove typedef of same name.
(struct nat_siginfo): Rename to ...
(nat_siginfo_t): ... this and remove typedef of same name.
(struct compat_sigval): Rename to ...
(compat_sigval_t): ... this and remove typedef of same name.
(struct compat_siginfo): Rename to ...
(compat_siginfo_t): ... this and remove typedef of same name.
(struct compat_x32_siginfo): Rename to ...
(compat_x32_siginfo_t): ... this and remove typedef of same name.
(amd64_linux_siginfo_fixup_common): Adjust.
Pedro Alves [Fri, 4 Jun 2021 20:44:36 +0000 (21:44 +0100)]
nat/amd64-linux-siginfo.c: Move align attribute from typedef to struct
Compiling GDB with current git Clang (future 13) fails with (among
other problems), this issue:
$ make nat/amd64-linux-siginfo.o
CXX nat/amd64-linux-siginfo.o
src/gdb/nat/amd64-linux-siginfo.c:590:35: warning: passing 4-byte aligned argument to 8-byte aligned parameter 1 of 'compat_x32_siginfo_from_siginfo' may result in an unaligned pointer access [-Walign-mismatch]
compat_x32_siginfo_from_siginfo ((struct compat_x32_siginfo *) inf,
^
1 warning generated.
The problem is that:
- The flagged code is casting to "struct compat_x32_siginfo" pointer
directly instead of to a pointer to the compat_x32_siginfo_t
typedef. The called function is declared with a
compat_x32_siginfo_t typedef pointer parameter.
- Only the typedef has the __aligned__ attribute.
Fix this by moving the attribute to the struct, so both struct and
typedef have the same alignment.
The next patch removes the typedefs.
gdb/ChangeLog:
yyyy-mm-dd Pedro Alves <pedro@palves.net>
* nat/amd64-linux-siginfo.c (compat_x32_siginfo_t): Move
__attribute__ __aligned__ from the typedef to the struct.
Simon Marchi [Mon, 7 Jun 2021 16:51:34 +0000 (12:51 -0400)]
gdb/testsuite: gdb.base/continue-all-already-running.exp: add fail if can't run to main
While doing some changes, I managed to break this test in a way that
running to main didn't work. However, it didn't produce any FAIL. I
noticed because I diff'ed the results and saw some PASSes unexpectedly
disappear, but that's a bit fragile. Add a fail in case this test fails
to run to main. Ideally, I think that runto_main should by default
produce a FAIL when it fails (the opposite of the existing logic), but
that's a project of its own, so just fix this test for the moment.
gdb/testsuite/ChangeLog:
* gdb.base/continue-all-already-running.exp: Call fail if can't
run to main.
Change-Id: I84b816a126c92ac579ed5ebbe39b017bd5cb7096
Andrew Burgess [Wed, 12 May 2021 12:44:06 +0000 (13:44 +0100)]
gdb: handle case where type alignment is unknown
It was spotted that if type_align returned 0 then it was possible to
trigger a divide by zero exception within GDB. It turns out this will
only happen in an edge case where GDB is unable to figure out the
alignment of a field within a structure.
The attached test generates some non-standard, probably broken, DWARF,
that triggers this condition, and then fixes this issue by throwing an
exception when this case occurs.
gdb/ChangeLog:
PR gdb/27847
* amd64-tdep.c (amd64_has_unaligned_fields): Move call to
type_align, and spot case where the alignment is unknown.
gdb/testsuite/ChangeLog:
PR gdb/27847
* gdb.dwarf2/dw2-weird-type-len.c: New file.
* gdb.dwarf2/dw2-weird-type-len.exp: New file.
Carl Love [Thu, 29 Apr 2021 22:19:13 +0000 (17:19 -0500)]
Add Power 10 PLT instruction patterns
gdb/ChangeLog:
2021-06-07 Carl Love <cel@us.ibm.com>
* ppc-tdep.h (ppc_insn_prefix_dform): Declare.
* ppc64-tdep.c(insn_md, insn_x, insn_xo): New macros.
(ppc64_plt_pcrel_entry_point, ppc64_pcrel_linkage1_target,
ppc64_pcrel_linkage2_target): New functions.
(ppc64_standard_linkage9, ppc64_standard_linkage10,
ppc64_standard_linkage11, ppc64_standard_linkage12): New ppc
instruction patterns.
(ppc64_standard_linkage9, ppc64_standard_linkage10,
ppc64_standard_linkage11, ppc64_standard_linkage12): New variables
in define MAX expression.
(ppc64_skip_trampoline_code_1): Handle ppc64_standard_linkage9,
ppc64_standard_linkage10, ppc64_standard_linkage11,
ppc64_standard_linkage12.
* (ppc_insn_prefix_dform): New function.
Simon Marchi [Mon, 7 Jun 2021 15:18:35 +0000 (11:18 -0400)]
gdb/testsuite: use proc_with_prefix in gdb.base/attach.exp
Use proc_with_prefix for test_command_line_attach_run, as we do for
other procs.
gdb/testsuite/ChangeLog:
* gdb.base/attach.exp (test_command_line_attach_run): Use
proc_with_prefix.
Change-Id: I47b61bb91b6ac0570ad7556a824f874ea50c7cda
Simon Marchi [Mon, 7 Jun 2021 15:03:04 +0000 (11:03 -0400)]
gdb: set only inferior_ptid in sparc_{fetch,store}_inferior_registers
The past commit
d1e93af64a6b ("gdb: set current thread in
sparc_{fetch,collect}_inferior_registers (PR gdb/27147)") changed
sparc_fetch_inferior_registers and sparc_store_inferior_registers to
look up the thread corresponding to the regcache's ptid and make it the
current thread. The reason being that down the call chain, some
functions (like sparc_supply_rwindow) can do some memory reads or write,
through target_read_memory/target_write_memory, and those rely on the
current global context.
There is one small problem with this approach: when debugging a
multi-threaded program, the regcache for a new thread is created just
before the corresponding thread_info is created. In fact, the regcache
is created somewhere during the call to thread_from_lwp, which is
responsible for creating the thread_info:
#8 0x0000010000ab9968 in internal_error (file=0x10000bfca20 "/home/simark/src/binutils-gdb/gdb/thread.c", line=1346, fmt=0x10000bfc918 "%s: Assertion `%s' failed.") at /home/simark/src/binutils-gdb/gdbsupport/errors.cc:55
#9 0x0000010000827f3c in switch_to_thread (thr=0x0) at /home/simark/src/binutils-gdb/gdb/thread.c:1346
#10 0x0000010000753444 in sparc_fetch_inferior_registers (proc_target=0x10000fa8cb0 <the_sparc64_linux_nat_target>, regcache=0x10000ff03c0, regnum=-1) at /home/simark/src/binutils-gdb/gdb/sparc-nat.c:175
#11 0x000001000075b908 in sparc64_linux_nat_target::fetch_registers (this=0x10000fa8cb0 <the_sparc64_linux_nat_target>, regcache=0x10000ff03c0, regnum=-1) at /home/simark/src/binutils-gdb/gdb/sparc64-linux-nat.c:38
#12 0x00000100007fe6f4 in target_ops::fetch_registers (this=0x10000f7feb0 <the_thread_db_target>, arg0=0x10000ff03c0, arg1=-1) at /home/simark/src/binutils-gdb/gdb/target-delegates.c:496
#13 0x00000100008162a0 in target_fetch_registers (regcache=0x10000ff03c0, regno=-1) at /home/simark/src/binutils-gdb/gdb/target.c:3287
#14 0x000001000060a4bc in ps_lgetregs (ph=0x10001264368, lwpid=458727, gregset=0x7feff97d388) at /home/simark/src/binutils-gdb/gdb/proc-service.c:158
#15 0xffff800103e32420 in __td_ta_lookup_th_unique (ta_arg=0x100012d7080, lwpid=<optimized out>, th=0x7feff97d7c8) at td_ta_map_lwp2thr.c:119
#16 0xffff800103e32604 in td_ta_map_lwp2thr (ta_arg=0x100012d7080, lwpid=<optimized out>, th=0x7feff97d7c8) at td_ta_map_lwp2thr.c:207
#17 0x000001000051fee8 in thread_from_lwp (stopped=0x100011a3650, ptid=...) at /home/simark/src/binutils-gdb/gdb/linux-thread-db.c:415
#18 0x0000010000520150 in thread_db_notice_clone (parent=..., child=...) at /home/simark/src/binutils-gdb/gdb/linux-thread-db.c:446
#19 0x00000100005068a8 in linux_handle_extended_wait (lp=0x10001230700, status=4479) at /home/simark/src/binutils-gdb/gdb/linux-nat.c:1978
#20 0x000001000050a278 in linux_nat_filter_event (lwpid=458724, status=198015) at /home/simark/src/binutils-gdb/gdb/linux-nat.c:2913
#21 0x000001000050b818 in linux_nat_wait_1 (ptid=..., ourstatus=0x7feff97e8d0, target_options=...) at /home/simark/src/binutils-gdb/gdb/linux-nat.c:3194
#22 0x000001000050ca4c in linux_nat_target::wait (this=0x10000fa8cb0 <the_sparc64_linux_nat_target>, ptid=..., ourstatus=0x7feff97e8d0, target_options=...) at /home/simark/src/binutils-gdb/gdb/linux-nat.c:3432
#23 0x00000100005237ec in thread_db_target::wait (this=0x10000f7feb0 <the_thread_db_target>, ptid=..., ourstatus=0x7feff97e8d0, options=...) at /home/simark/src/binutils-gdb/gdb/linux-thread-db.c:1379
#24 0x00000100007fa668 in target_wait (ptid=..., status=0x7feff97e8d0, options=...) at /home/simark/src/binutils-gdb/gdb/target.c:2000
#25 0x00000100004adb0c in do_target_wait_1 (inf=0x10001173170, ptid=..., status=0x7feff97e8d0, options=...) at /home/simark/src/binutils-gdb/gdb/infrun.c:3464
#26 0x00000100004add48 in operator() (__closure=0x7feff97e658, inf=0x10001173170) at /home/simark/src/binutils-gdb/gdb/infrun.c:3527
#27 0x00000100004ae15c in do_target_wait (wait_ptid=..., ecs=0x7feff97e8a8, options=...) at /home/simark/src/binutils-gdb/gdb/infrun.c:3540
#28 0x00000100004af254 in fetch_inferior_event () at /home/simark/src/binutils-gdb/gdb/infrun.c:3880
#29 0x0000010000486ef8 in inferior_event_handler (event_type=INF_REG_EVENT) at /home/simark/src/binutils-gdb/gdb/inf-loop.c:42
The problem is that while sparc_fetch_inferior_registers runs and is
asked to read the registers of a given ptid, there isn't a thread_info
with that ptid yet. So, find_thread_ptid returns nullptr, and
switch_to_thread gives an internal error.
Fix this by only setting inferior_ptid, instead of the whole global
context, as switch_to_thread does. This is sufficient for
target_read_memory / target_write_memory to work down the line.
Ideally, it would be nice to be able to pass the ptid down the whole
call chain and to target_read_memory / target_write_memory, so that this
setting of inferior_ptid would not be necessary. But this is not going
to happen soon.
This fixes running a multi-threaded program, which would hit the
internal error show in the call stack above.
gdb/ChangeLog:
PR gdb/27899
* sparc-nat.c (sparc_fetch_inferior_registers): Set
inferior_ptid instead of using switch_to_thread.
(sparc_store_inferior_registers): Likewise.
Change-Id: I0b6ddb3af9b11f67b10ee46a734fb82ecc6462d5
Tom de Vries [Mon, 7 Jun 2021 13:46:34 +0000 (15:46 +0200)]
[gdb/testsuite] Fix gdb.base/run-attach-while-running.exp
With a testsuite setup modified to make expect wait a little bit longer for
gdb output (see PR27957), I reliably run into:
...
27 return SYSCALL_CANCEL (nanosleep, requested_time, remaining);^M
(gdb) ^M
Thread 2 "run-attach-whil" stopped.^M
0x00007f13c85a74c0 in __GI___nanosleep () at nanosleep.c:27^M
27 return SYSCALL_CANCEL (nanosleep, requested_time, remaining);^M
FAIL: gdb.base/run-attach-while-running.exp: threaded=1: \
run-or-attach=attach: non-stop=on: test: attach to process (timeout)
...
The problem is that we're trying to match the gdb_prompt using gdb_test which
uses '$gdb_prompt $'. The terminating '$' prevents the match.
Fix this by rewriting the gdb_test into a gdb_test_multiple and dropping the
'$'.
Tested on x86_64-linux.
gdb/testsuite/ChangeLog:
2021-06-07 Tom de Vries <tdevries@suse.de>
PR testsuite/27908
* gdb.base/run-attach-while-running.exp (test): Don't match prompt
after attach using '$gdb_prompt $'.
Tom de Vries [Mon, 7 Jun 2021 12:33:51 +0000 (14:33 +0200)]
[gdb/testsuite] Simplify gdb.base/info-types.exp.tcl
The regexp matching state machine in gdb.base/info-types.exp.tcl handles
"File .*:" lines individually. Now that we do line-by-line matching, that's
no longer necessary.
Simplify accordingly.
Tested on x86_64-linux.
gdb/testsuite/ChangeLog:
2021-06-07 Tom de Vries <tdevries@suse.de>
* gdb.base/info-types.exp.tcl: Remove "File .*" matching from regexp
matching state machine.
Tom de Vries [Mon, 7 Jun 2021 12:33:50 +0000 (14:33 +0200)]
[gdb/testsuite] Fix gdb.base/new-ui-pending-input.exp timeout
With a testsuite setup modified to make expect wait a little bit longer for
gdb output (see PR27957), I run into:
...
PASS: gdb.base/new-ui-pending-input.exp: spawn gdb
print 1^M
print 2^M
print 3^M
(gdb) $1 = 1^M
(gdb) $2 = 2^M
(gdb) $3 = 3^M
(gdb) PASS: gdb.base/new-ui-pending-input.exp: initial prompt on extra console
^M
Breakpoint 1, main () at new-ui-pending-input.c:25^M
25 return 0; /* set breakpoint here */^M
FAIL: gdb.base/new-ui-pending-input.exp: print 1 on extra console (timeout)
...
Usually, I get a pass instead. In the passing case, the "initial prompt"
PASS is after the first prompt:
...
PASS: gdb.base/new-ui-pending-input.exp: spawn gdb
print 1^M
print 2^M
print 3^M
(gdb) PASS: gdb.base/new-ui-pending-input.exp: initial prompt on extra console
...
while in the failing case, that PASS is after the fourth prompt.
The regexp doesn't match the first prompt because it terminates with a '$':
...
-re "$gdb_prompt $" {
...
Fix this by removing the terminating '$' and prefixing the regex with
something unique to the first prompt: "print 3".
Tested on x86_64-linux.
gdb/testsuite/ChangeLog:
2021-06-07 Tom de Vries <tdevries@suse.de>
* gdb.base/new-ui-pending-input.exp
(test_command_line_new_ui_pending_input): Fix regexp for "initial
prompt on extra console".
Tom de Vries [Mon, 7 Jun 2021 12:33:50 +0000 (14:33 +0200)]
[gdb/testsuite] Fix info-types-c.exp
Recently, I've rewritten gdb.base/info-types.exp.tcl to do processing
line-by-line (commit
2129a942553).
When building gdb with -O0, this test passes for me, but with -O2 I sometimes
run into:
...
FAIL: gdb.base/info-types-c.exp: info types (state == 1)
...
The output the failing gdb_test_multiple is trying to parse is:
...
(gdb) info types^M
All defined types:^M
^M
File src/gdb/testsuite/gdb.base/info-types.c:^M
52: typedef enum {...} anon_enum_t;^M
...
(gdb)
...
and the FAIL with state == 1 means that:
- the regexp for "All defined types:" did trigger, and that
- the regexp for "File .*info-types.c" didn't trigger.
This is due to the fact that the empty line inbetween is supposed to be
matched by the "random line" regexp "^\r\n(\[^\r\n\]*)(?=\r\n)", which doesn't
happen because instead the earlier regexp consuming the gdb prompt matches.
Fix this by moving the "random line" regexp up. [ Note that that regexp does
not consume the gdb prompt, because it requires (but doesn't consume) a
terminating "\r\n".
Tested on x86_64-linux.
gdb/testsuite/ChangeLog:
2021-06-07 Tom de Vries <tdevries@suse.de>
* gdb.base/info-types.exp.tcl (run_test): Move "random line" regexp
up.
Jan Beulich [Mon, 7 Jun 2021 10:05:35 +0000 (12:05 +0200)]
x86: honor quoted figure braces in i386_att_operand()
When AVX512 support was added, symbol quotation was not paid attention
to. Just like the (base,index,scale) specifier gets parsed from the end
of the expression, the {...} also wants parsing from the end; in no case
is the first { found a guarantee of a masking or broadcasting specifier.
Jan Beulich [Mon, 7 Jun 2021 10:05:02 +0000 (12:05 +0200)]
x86: better respect quotes in parse_operands()
When
d02603dc201f ("Allow symbol and label names to be enclosed in
double quotes") added the check for a double quote to the loop body
there, it didn't go quite far enough: Parentheses inside quotes
shouldn't be counted, and character restrictions also shouldn't apply
inside quoted regions.
In i386_att_operand(), which needs adjustment to remain in sync, besides
respecting double quotes now, also change the logic such that we don't
count parentheses anymore: Finding any opening or closing parenthesis or
any double quote means we're done, because the subsequent parsing code
wouldn't accept (extra) instances of these anyway.
Note that in parse_operands() this mimics get_symbol_name()'s
questionable behavior of treating \ specially only when ahead of ". (The
behavior is suspicious because the meaning of \\ then is ambiguous. It
is in particular impossible to have a (quoted) symbol name end in a
single \.) I would have used get_symbol_name() here, if that didn't
require fiddling with input_line_pointer.
Jan Beulich [Mon, 7 Jun 2021 10:04:24 +0000 (12:04 +0200)]
x86: allow unary operators to start a memory operand
So far only - was permitted, but +, !, and ~ ought to be treated the
same.
Rather than adding them to digit_chars[], which was at least odd to have
held - so far, drop this array and its wrapper macro for being used just
once.
While adjusting this logic, also include [ in the characters which may
start a displacement expression - gas generally treats [] as equivalent
to ().
Jan Beulich [Mon, 7 Jun 2021 10:03:32 +0000 (12:03 +0200)]
x86: make symbol quotation check consistent in i386_att_operand()
When
d02603dc201f ("Allow symbol and label names to be enclosed in
double quotes") added the check for a leading double quote to
i386_att_operand(), it missed a second similar check after having found
a segment override. To avoid the two checks going out of sync again,
introduce an inline helper.
Jan Beulich [Mon, 7 Jun 2021 10:02:15 +0000 (12:02 +0200)]
x86: correct absolute branch check with segment override
This needs to happen before checking of what may legitimately start a
memory operand (like is done when there's no segment override). Plus a
second '*' shouldn't be permitted when one was already found before the
segment override.
Jan Beulich [Mon, 7 Jun 2021 10:01:45 +0000 (12:01 +0200)]
x86/Intel: drop unnecessary bracket matching from parse_operands()
While subsequent processing in AT&T mode relies on this simplistic early
checking, Intel mode hasn't been for quite a long time (or perhaps never
really did).
Jan Beulich [Mon, 7 Jun 2021 10:01:14 +0000 (12:01 +0200)]
x86: remove pointless 2nd parameter from check_VecOperations()
In the one case where non-NULL gets passed, passing NULL has the same
effect. Hence the parameter is not needed at all.
Jan Beulich [Mon, 7 Jun 2021 10:00:38 +0000 (12:00 +0200)]
x86: immediate operands don't allow for vector operations
Neither masking nor broadcast are possible here, and RC/SAE get dealt
with elsewhere.
This also fixes gas crashes (i.e. "Fatal error: unable to continue with
assembly"), since the return path being removed failed to restore
input_line_pointer from save_input_line_pointer.
Jan Beulich [Mon, 7 Jun 2021 06:49:33 +0000 (08:49 +0200)]
ix86: wrap constants
Non-64-bit code should get handled the same with or without BFD64. This
wasn't the case though in a number of situations (and quite likely there
are more that I haven't spotted yet).
It's not very nice to tie the check in md_apply_fix() to object_64bit,
but afaict at that time we have no record anymore of the mode an insn
was assembled in (it might also have been data). This doesn't look to be
the first inconsistency of this kind, though. In x86_cons() it's even
less clear what the right approach would be: flag_code shouldn't matter
for data emission, but instead we'd need to know from which mode(s) the
data actually gets accessed. On this basis, signed_cons() also gets
adjusted.
Jan Beulich [Mon, 7 Jun 2021 06:37:42 +0000 (08:37 +0200)]
fix Dwarf2 build with certain gcc versions
Older gcc reports:
.../bfd/dwarf2.c: In function 'read_ranges':
.../bfd/dwarf2.c:3107: error: comparison between signed and unsigned
.../bfd/dwarf2.c: In function 'read_rnglists':
.../bfd/dwarf2.c:3189: error: comparison between signed and unsigned
Similarly for binutils/dwarf.c. Arrange for the left sides of the > to
also be unsigned quantities.
GDB Administrator [Mon, 7 Jun 2021 00:00:46 +0000 (00:00 +0000)]
Automatic date update in version.in
Simon Marchi [Sun, 6 Jun 2021 13:53:42 +0000 (09:53 -0400)]
gdb/testsuite: set sysroot in gdb.server/stop-reply-no-thread-multi.exp
I get some random timeouts in this test due to big debug info taking a
lot of time to read through gdbserver. When host and target are on the
same machine, clear the sysroot parameter so that GDB reads the files
from the local file system, as we already do in many tests.
I agree with what Pedro says here:
https://sourceware.org/pipermail/gdb-patches/2019-March/156568.html
that if this is bad for us, it's also bad for users, so we should be
fixing the slowness instead. But so far nobody seems to be working on
it, and the testsuite timeouts are getting in the way, so I think this
"set sysroot" is a net positive for now.
Without this patch, the test takes over 2 minutes to run (most of it
"downloading" libc debug info), with it it takes 10 seconds.
gdb/testsuite/ChangeLog:
* gdb.server/stop-reply-no-thread-multi.exp: Clear sysroot when
host and target are local.
Change-Id: Ieb6304f0e56b4575af450913de4210c667c6bf7b
GDB Administrator [Sun, 6 Jun 2021 00:00:44 +0000 (00:00 +0000)]
Automatic date update in version.in
Bernd Edlinger [Wed, 2 Jun 2021 17:21:15 +0000 (19:21 +0200)]
Fix gdb crash due to SIGPIPE when the compile command fails
Due to the SIGPIPE the gdb process is killed here, which is
not helpful.
2021-06-05 Bernd Edlinger <bernd.edlinger@hotmail.de>
* compile/compile.c (scoped_ignore_sigpipe): New helper class.
(compile_to_object): Ignore SIGPIPE before calling the plugin.
Tom Tromey [Sat, 5 Jun 2021 15:26:25 +0000 (09:26 -0600)]
Really fix data-directory/Makefile rebuilding
Oops, I botched the last patch to fix data-directory/Makefile
rebuilding, by copying the config.status line and forgetting to update
the directory name. This one fixes the problem for real.
gdb/ChangeLog
2021-06-05 Tom Tromey <tom@tromey.com>
* data-directory/Makefile.in (Makefile): Use correct directory
name.
Tom Tromey [Sat, 5 Jun 2021 15:04:51 +0000 (09:04 -0600)]
Fix gdb/data-directory Makefile-regeneration rule
My recent changes to the gdb build removed a special case for
data-directory/Makefile, but neglected to update the rule in that
Makefile. This patch fixes the error by rewriting this rule.
gdb/ChangeLog
2021-06-05 Tom Tromey <tom@tromey.com>
* data-directory/Makefile.in (Makefile): Rewrite.
Tom Tromey [Fri, 4 Jun 2021 20:23:42 +0000 (14:23 -0600)]
Use ACX_NONCANONICAL_TARGET in gdb/configure
Shahab Vahedi pointed out that the patch to remove
gdb/testsuite/configure regressed the site.exp creation a bit -- it
left an unresolved configure substitution. Andrew Burgess pointed out
that the patch removed the call to ACX_NONCANONICAL_TARGET, which
caused this problem.
This patch adds ACX_NONCANONICAL_TARGET to gdb's configure, and fixes
the bug.
gdb/ChangeLog
2021-06-05 Tom Tromey <tromey@adacore.com>
* configure: Rebuild.
* configure.ac: Add ACX_NONCANONICAL_TARGET.
Mike Frysinger [Fri, 14 May 2021 08:39:39 +0000 (04:39 -0400)]
sim: common: start dedicated local.mk
This provides a space to generate things that we only need to build
once per-arch. Some day that will be all of common/, but for now,
we move the version.c management in.
Hannes Domani [Sat, 5 Jun 2021 12:37:53 +0000 (14:37 +0200)]
Fix symbol constants tests for Python 3
gdb/testsuite/ChangeLog:
2021-06-05 Hannes Domani <ssbssa@yahoo.de>
* gdb.python/py-symbol.exp: Fix tests for Python 3.
Shahab Vahedi [Wed, 5 May 2021 21:07:38 +0000 (23:07 +0200)]
arc: Add 'set disassembler-options' support
Implement ARC target support for passing options to the disassembler
through the command interface. e.g.:
gdb> set disassembler-options cpu=hs38_linux ...
gdb/ChangeLog:
* NEWS: Document 'set disassembler-options' support for the ARC
target.
* arc-tdep.c (arc_gdbarch_init): Set
'gdbarch_valid_disassembler_options'.
gdb/doc/ChangeLog:
* gdb.texinfo (Source and Machine Code): Document 'set
disassembler-options' support for the ARC target.
gdb/testsuite/ChangeLog:
* gdb.arch/arc-disassembler-options.exp: New test.
* gdb.arch/arc-disassembler-options.s: New test source.
GDB Administrator [Sat, 5 Jun 2021 00:00:55 +0000 (00:00 +0000)]
Automatic date update in version.in
Tom Tromey [Fri, 4 Jun 2021 19:51:23 +0000 (13:51 -0600)]
Add PROP_VARIABLE_NAME
With -fgnat-encodings=minimal, an internal version (these patches will
be upstreamed in the near future) of the Ada compiler can emit DWARF
for an array where the bound comes from a variable, like:
<1><12a7>: Abbrev Number: 7 (DW_TAG_array_type)
<12a8> DW_AT_name : (indirect string, offset: 0x1ae9): pck__my_array
[...]
<2><12b4>: Abbrev Number: 8 (DW_TAG_subrange_type)
<12b5> DW_AT_type : <0x1294>
<12b9> DW_AT_upper_bound : <0x1277>
With the upper bound DIE being:
<1><1277>: Abbrev Number: 2 (DW_TAG_variable)
<1278> DW_AT_name : (indirect string, offset: 0x1a4d): pck__my_length___U
<127c> DW_AT_type : <0x128f>
<1280> DW_AT_external : 1
<1280> DW_AT_artificial : 1
<1280> DW_AT_declaration : 1
Note that the variable is just a declaration -- in this situation, the
variable comes from another compilation unit, and must be found when
trying to compute the array bound.
This patch adds a new PROP_VARIABLE_NAME kind, to enable this search.
This same scenario can occur with DW_OP_GNU_variable_value, so this
patch adds support for that as well.
gdb/ChangeLog
2021-06-04 Tom Tromey <tromey@adacore.com>
* dwarf2/read.h (dwarf2_fetch_die_type_sect_off): Add 'var_name'
parameter.
* dwarf2/loc.c (dwarf2_evaluate_property) <case
PROP_VARIABLE_NAME>: New case.
(compute_var_value): New function.
(sect_variable_value): Use compute_var_value.
* dwarf2/read.c (attr_to_dynamic_prop): Handle DW_TAG_variable.
(var_decl_name): New function.
(dwarf2_fetch_die_type_sect_off): Add 'var_name' parameter.
* gdbtypes.h (enum dynamic_prop_kind) <PROP_VARIABLE_NAME>: New
constant.
(union dynamic_prop_data) <variable_name>: New member.
(struct dynamic_prop) <variable_name, set_variable_name>: New
methods.
gdb/testsuite/ChangeLog
2021-06-04 Tom Tromey <tromey@adacore.com>
* gdb.ada/array_of_symbolic_length.exp: New file.
* gdb.ada/array_of_symbolic_length/foo.adb: New file.
* gdb.ada/array_of_symbolic_length/gl.adb: New file.
* gdb.ada/array_of_symbolic_length/gl.ads: New file.
* gdb.ada/array_of_symbolic_length/pck.adb: New file.
* gdb.ada/array_of_symbolic_length/pck.ads: New file.
Andrew Burgess [Fri, 4 Jun 2021 13:31:33 +0000 (14:31 +0100)]
gdb: add some additional debug output in remote.c
I needed more debug output from:
remote_target::select_thread_for_ambiguous_stop_reply
I thought this would be useful for others too.
gdb/ChangeLog:
* remote.c (remote_target)
<select_thread_for_ambiguous_stop_reply>: Add additional debug
output.
Hannes Domani [Sun, 20 Dec 2020 16:25:09 +0000 (17:25 +0100)]
Forward mouse click to python TUI window
If the TUI window object implements the click method, it is called for each
mouse click event in this window.
gdb/ChangeLog:
2021-06-04 Hannes Domani <ssbssa@yahoo.de>
* python/py-tui.c (class tui_py_window): Add click function.
(tui_py_window::click): Likewise.
gdb/doc/ChangeLog:
2021-06-04 Hannes Domani <ssbssa@yahoo.de>
* python.texi (TUI Windows In Python): Document Window.click.
Hannes Domani [Sun, 20 Dec 2020 15:45:57 +0000 (16:45 +0100)]
Initial TUI mouse support
Implements an overridable tui_win_info::click method whose arguments
are the mouse coordinates inside the specific window, and the mouse
button clicked.
And if the curses implementation supports 5 buttons, the 4th and 5th
buttons are used for scrolling.
gdb/ChangeLog:
2021-06-04 Hannes Domani <ssbssa@yahoo.de>
* ser-mingw.c (console_select_thread): Handle MOUSE_EVENT.
* tui/tui-data.h (struct tui_win_info): Add click function.
* tui/tui-io.c (tui_prep_terminal): Enable mouse events.
(tui_deprep_terminal): Disable mouse events.
(tui_dispatch_ctrl_char): Handle KEY_MOUSE.
* tui/tui.c (tui_disable): Disable mouse events.
GDB Administrator [Fri, 4 Jun 2021 00:00:51 +0000 (00:00 +0000)]
Automatic date update in version.in
Magne Hov [Thu, 3 Jun 2021 20:20:30 +0000 (21:20 +0100)]
gdb: fix eval.c assert during inferior exit event
Evaluating expressions from within an inferior exit event handler can
cause a crash:
echo "int main() { return 0; }" > repro.c
gcc -g repro.c -o repro
./gdb -q --ex "set language c++" --ex "python gdb.events.exited.connect(lambda _: gdb.execute('set \$_a=0'))" --ex "run" repro
Reading symbols from repro...
Starting program: /home/mhov/repos/binutils-gdb-master/install-bad/bin/repro
[Inferior 1 (process
1974779) exited normally]
../../gdb/thread.c:72: internal-error: thread_info* inferior_thread(): Assertion `current_thread_ != nullptr' failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.
Quit this debugging session? (y or n) [answered Y; input not from terminal]
This is a bug, please report it. For instructions, see:
<https://www.gnu.org/software/gdb/bugs/>.
Backtrace
0 in internal_error of ../../gdbsupport/errors.cc:51
1 in inferior_thread of ../../gdb/thread.c:72
2 in expression::evaluate of ../../gdb/eval.c:98
3 in evaluate_expression of ../../gdb/eval.c:115
4 in set_command of ../../gdb/printcmd.c:1502
5 in do_const_cfunc of ../../gdb/cli/cli-decode.c:101
6 in cmd_func of ../../gdb/cli/cli-decode.c:2181
7 in execute_command of ../../gdb/top.c:670
...
22 in python_inferior_exit of ../../gdb/python/py-inferior.c:182
In `expression::evaluate (...)' there is a call to `inferior_thread
()' that is guarded by `target_has_execution ()':
struct value *
expression::evaluate (struct type *expect_type, enum noside noside)
{
gdb::optional<enable_thread_stack_temporaries> stack_temporaries;
if (target_has_execution ()
&& language_defn->la_language == language_cplus
&& !thread_stack_temporaries_enabled_p (inferior_thread ()))
stack_temporaries.emplace (inferior_thread ());
The `target_has_execution ()' guard maps onto `inf->pid' and the
`inferior_thread ()' call assumes that `current_thread_' is set to
something meaningful:
struct thread_info*
inferior_thread (void)
{
gdb_assert (current_thread_ != nullptr);
return current_thread_;
}
In other words, it is assumed that if `inf->pid' is set then
`current_thread_' must also be set. This does not hold at the point
where inferior exit observers are notified:
- `generic_mourn_inferior (...)'
- `switch_to_no_thread ()'
- `current_thread_ = nullptr;'
- `exit_inferior (...)'
- `gdb::observers::inferior_exit.notify (...)'
- `inf->pid = 0'
The inferior exit notification means that a Python handler can get a
chance to run while `current_thread' has been cleared and the
`inf->pid' has not been cleared. Since the Python handler can call any
GDB command with `gdb.execute(...)' (in my case `gdb.execute("set
$_a=0")' we can end up evaluating expressions and asserting in
`evaluate_subexp (...)'.
This patch adds a test in `evaluate_subexp (...)' to check the global
`inferior_ptid' which is reset at the same time as `current_thread_'.
Checking `inferior_ptid' at the same time as `target_has_execution ()'
seems to be a common pattern:
$ git grep -n -e inferior_ptid --and -e target_has_execution
gdb/breakpoint.c:2998: && (inferior_ptid == null_ptid || !target_has_execution ()))
gdb/breakpoint.c:3054: && (inferior_ptid == null_ptid || !target_has_execution ()))
gdb/breakpoint.c:4587: if (inferior_ptid == null_ptid || !target_has_execution ())
gdb/infcmd.c:360: if (inferior_ptid != null_ptid && target_has_execution ())
gdb/infcmd.c:2380: /* FIXME: This should not really be inferior_ptid (or target_has_execution).
gdb/infrun.c:3438: if (!target_has_execution () || inferior_ptid == null_ptid)
gdb/remote.c:11961: if (!target_has_execution () || inferior_ptid == null_ptid)
gdb/solib.c:725: if (target_has_execution () && inferior_ptid != null_ptid)
The testsuite has been run on 5.4.0-59-generic x86_64 GNU/Linux:
- Ubuntu 20.04.1 LTS
- gcc (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0
- DejaGnu version 1.6.2
- Expect version 5.45.4
- Tcl version 8.6
- Native configuration: x86_64-pc-linux-gnu
- Target: unix
Results show a few XFAIL in
gdb.threads/attach-many-short-lived-threads.exp. The existing
py-events.exp tests are skipped for native-gdbserver and fail for
native-extended-gdbserver, but the new tests pass with
native-extended-gdbserver when run without the existing tests.
gdb/ChangeLog:
2021-06-03 Magne Hov <mhov@undo.io>
PR python/27841
* eval.c (expression::evaluate): Check inferior_ptid.
gdb/testsuite/ChangeLog:
2021-06-03 Magne Hov <mhov@undo.io>
PR python/27841
* gdb.python/py-events.exp: Extend inferior exit tests.
* gdb.python/py-events.py: Print inferior exit PID.
Pedro Alves [Thu, 3 Jun 2021 18:50:10 +0000 (19:50 +0100)]
Update my email address in MAINTAINERS
gdb/ChangeLog:
yyyy-mm-dd Pedro Alves <pedro@palves.net>
* MAINTAINERS (The Official FSF-appointed GDB Maintainers): Remove
affiliation.
(Global Maintainers): Update my address.
(Write After Approval): Remove stale entry.
Change-Id: I3266fedeebfa6800faa2217baf6c032408e84902
John Baldwin [Thu, 3 Jun 2021 17:32:04 +0000 (10:32 -0700)]
Report additional details for signals received on FreeBSD.
Provide a description for si_code values as a sigcode-meaning field.
For signals raised by a system call, provide the pid and user ID of
the sending process. For signals raised by a POSIX timer exparation,
provide the id of the timer. For signals raised by a POSIX message
queue, provide the id of the message queue. For SIGCHLD provide the
pid and user ID of the child process along with the exit status or
relevant signal number.
Sample output for SIGUSR1 raised by kill():
before:
Program received signal SIGUSR1, User defined signal 1.
kill () at kill.S:4
4 RSYSCALL(kill)
after:
Program received signal SIGUSR1, User defined signal 1.
Sent by kill() from pid 30529 and user 1001.
kill () at kill.S:4
4 RSYSCALL(kill)
SIGCHLD for exited process:
before:
Program received signal SIGCHLD, Child status changed.
after:
Program received signal SIGCHLD, Child status changed.
Child has exited: pid 31929, uid 1001, exit status 0.
SIGALRM raised by a POSIX timer (timer_create):
before:
Program received signal SIGALRM, Alarm clock.
after:
Program received signal SIGALRM, Alarm clock.
Timer expired: timerid 3.
gdb/ChangeLog:
* fbsd-tdep.c (FBSD_SI_USER, FBSD_SI_QUEUE, FBSD_SI_TIMER)
(FBSD_SI_ASYNCIO, FBSD_SI_MESGQ, FBSD_SI_KERNEL, FBSD_SI_LWP)
(FBSD_ILL_ILLOPC, FBSD_ILL_ILLOPN, FBSD_ILL_ILLADR)
(FBSD_ILL_ILLTRP, FBSD_ILL_PRVOPC, FBSD_ILL_PRVREG)
(FBSD_ILL_COPROC, FBSD_ILL_BADSTK, FBSD_BUS_ADRALN)
(FBSD_BUS_ADRERR, FBSD_BUS_OBJERR, FBSD_BUS_OOMERR)
(FBSD_SEGV_MAPERR, FBSD_SEGV_ACCERR, FBSD_SEGV_PKUERR)
(FBSD_FPE_INTOVF, FBSD_FPE_INTDIV, FBSD_FPE_FLTDIV)
(FBSD_FPE_FLTOVF, FBSD_FPE_FLTUND, FBSD_FPE_FLTRES)
(FBSD_FPE_FLTINV, FBSD_FPE_FLTSUB, FBSD_TRAP_BRKPT)
(FBSD_TRAP_TRACE, FBSD_TRAP_DTRACE, FBSD_TRAP_CAP)
(FBSD_CLD_EXITED, FBSD_CLD_KILLED, FBSD_CLD_DUMPED)
(FBSD_CLD_TRAPPED, FBSD_CLD_STOPPED, FBSD_CLD_CONTINUED)
(FBSD_POLL_IN, FBSD_POLL_OUT, FBSD_POLL_MSG, FBSD_POLL_ERR)
(FBSD_POLL_PRI, FBSD_POLL_HUP, fbsd_signal_cause)
(fbsd_report_signal_info): New.
(fbsd_init_abi): Use fbsd_report_signal_info as gdbarch
report_signal_info method.
Magne Hov [Thu, 3 Jun 2021 16:58:16 +0000 (17:58 +0100)]
Add ChangeLog entry for previous commit
Magne Hov [Thu, 3 Jun 2021 16:27:44 +0000 (17:27 +0100)]
Add myself to gdb/MAINTAINERS
gdb/ChangeLog:
2021-06-03 Magne Hov <mhov@undo.io>
* MAINTAINERS (Write After Approval): Add Magne Hov.
Hannes Domani [Tue, 25 May 2021 15:18:55 +0000 (17:18 +0200)]
Restore gdb.SYMBOL_LABEL_DOMAIN constant
It was removed (probably by mistake) in
51e78fc5fa21870d415c52f90b93e3c6ad57be46.
gdb/ChangeLog:
2021-06-03 Hannes Domani <ssbssa@yahoo.de>
* python/py-symbol.c (gdbpy_initialize_symbols): Restore
gdb.SYMBOL_LABEL_DOMAIN constant.
gdb/testsuite/ChangeLog:
2021-06-03 Hannes Domani <ssbssa@yahoo.de>
* gdb.python/py-symbol.exp: Test symbol constants.
Ben Asselstine [Thu, 3 Jun 2021 11:55:15 +0000 (21:25 +0930)]
PR4283, update gprof manual with note about GMON_OUT_PREFIX
PR 4283
* gprof.texi (Executing): Note GMON_OUT_PREFIX environment variable.
Alan Modra [Thu, 3 Jun 2021 09:02:30 +0000 (18:32 +0930)]
PR2589, ld vs. ld.so
PR 2589
* ld.texi (link-time runtime library search path): Mention
plugin library path. Correct order of search.
Alan Modra [Thu, 3 Jun 2021 02:33:09 +0000 (12:03 +0930)]
PR1202, mcore disassembler: wrong address loopt
Fixes a 16 year old bug report, which even came with a patch.
opcodes/
PR 1202
* mcore-dis.c (print_insn_mcore): Correct loopt disassembly.
Use unsigned int for inst.
gas/
PR 1202
* testsuite/gas/mcore/allinsn.d: Correct loopt expected output.
GDB Administrator [Thu, 3 Jun 2021 00:00:44 +0000 (00:00 +0000)]
Automatic date update in version.in
Bernd Edlinger [Wed, 2 Jun 2021 17:18:04 +0000 (19:18 +0200)]
Fix temp-dir leakage in per-bfd-sharing.exp
Whan using clang as compiler this compile step fails due to the
unknown option "-Wl,--build-id". This leaks the already created
temp-dir.
Fixed by compiling first, and creating the temp-dir only when the
compile succeeded.
2021-06-02 Bernd Edlinger <bernd.edlinger@hotmail.de>
* gdb.dwarf2/per-bfd-sharing.exp: Fix temp-dir leakage.
John Baldwin [Wed, 2 Jun 2021 15:48:09 +0000 (08:48 -0700)]
sim m32c: Include defs.h in m32c.opc and r8c.opc.
gnulib can override stdio.h and/or stdlib.h in which case the gnulib
headers require config.h to be included first.
gdb/sim/m32c/ChangeLog:
* m32c.opc: Include defs.h.
* r8c.opc: Likewise.
Carl Love [Fri, 21 May 2021 16:29:26 +0000 (11:29 -0500)]
Fix threadapply test
The current test case leaves detached processes running at the end of
the test. This patch changes the test to use a barrier wait to ensure all
processes exit cleanly at the end of the tests.
gdb/testsuite/ChangeLog:
2021-06-02 Carl Love <cel@us.ibm.com>
* gdb.threads/threadapply.c: Add global mybarrier.
(main): Add pthread_barrier_init.
(thread_function): Replace while loop with myp increment and
pthread_barrier_wait.
Shahab Vahedi [Wed, 2 Jun 2021 12:30:16 +0000 (15:30 +0300)]
arc: Construct disassembler options dynamically
The idea of this change is simple: Populate a data structure, namely
"disasm_option_and_arg_t" from "include/dis-asm.h", to encompass the
disassembly options and their possible arguments.
This will make it easier to manage or extend those options by adapting
entries in a data structure, "arc_options". There will be lesser need
to hard-code the options in the code itself. Moreover, ARC GDB will
use this population function, "disassembler_options_arc ()", to enable
the "set disassembler-option" for ARC targets. The gdb change will be
in a separate patch though.
The changes in this patch can be divided into:
1) Introduction of "disassembler_options_arc ()" that will return a
"disasm_option_and_arg_t" structure representing the disassembly
options and their likely arguments.
2) New data type "arc_options_arg_t" and new data "arc_options".
These are the internals for keeping track of options and arguments
entries that can easily be extended.
3) To print the options, the "print_arc_disassembler_options ()" has
been adjusted to use this dynamically built structure instead of having
them hard-coded inside.
To see this in effect, one can look into the output of:
$ ./binutils/objdump --help
...
The following ARC specific disassembler options are...
...
include/ChangeLog:
* dis-asm.h (disassembler_options_arc): New prototype.
opcodes/ChangeLog:
* arc-dis.c (arc_option_arg_t): New enumeration.
(arc_options): New variable.
(disassembler_options_arc): New function.
(print_arc_disassembler_options): Reimplement in terms of
"disassembler_options_arc".
Andrew Burgess [Wed, 2 Jun 2021 08:50:29 +0000 (09:50 +0100)]
gdb/testsuite: only add -J option when compiling with gfortran
We currently make use of the -J option to gfortran in order that
compiled modules should be placed in the correct output directory.
Obviously different compilers, e.g. flang, will have different options
to achieve the same result.
This commit makes it so we only add the -J flag when using a gcc
based (i.e. gfortran) compiler.
I had a look through the flang help page and tried a few likely
looking options, but couldn't find anything that seemed to do the same
thing, so, for now, I'm only adding an extra option when compiling
with gfortran.
This does mean that any compiler other than gfortran might run into
problems if running the testsuite in parallel due to modules of the
same name all being written to the same directory, and so possibly
overwriting each other.
gdb/testsuite/ChangeLog:
* lib/gdb.exp (gdb_compile): Only add the -J option when using a
gcc based Fortran compiler, for example, flang does not support
this option.
Andrew Burgess [Wed, 2 Jun 2021 08:47:23 +0000 (09:47 +0100)]
gdb/testsuite: escape '*' character in pattern used by flang
One of the integer type patterns used by flang included a '*'
character which was not escaped.
gdb/testsuite/ChangeLog:
* lib/fortran.exp (fortran_int8): Escape '*' in pattern.
Alan Modra [Wed, 2 Jun 2021 05:17:17 +0000 (14:47 +0930)]
asan: heap buffer overflow in _bfd_elf_parse_attributes
* elf-attrs.c (_bfd_elf_parse_attributes): Break out of loop if
subsection length is too small to cover tag and length field.
GDB Administrator [Wed, 2 Jun 2021 00:00:48 +0000 (00:00 +0000)]
Automatic date update in version.in
John Baldwin [Tue, 1 Jun 2021 21:22:20 +0000 (14:22 -0700)]
Conditionally restore displaced stepping state after fork.
There is no default method for
gdbarch_displaced_step_restore_all_in_ptid, so calling it
unconditionally for fork events triggered an assertion failure on
platforms that do not support displaced stepping. To fix, only invoke
the method if the gdbarch supports displaced stepping.
Note that not all gdbarches support both displaced stepping and fork
events, so gdbarch validation does not require
gdbarch_displaced_step_restore_all_in_ptid for any gdbarch supporting
displaced stepping. However, the internal assertion in
gdbarch_displaced_step_restore_all_in_ptid should catch any gdbarches
which do support both but fail to provide this method.
gdb/ChangeLog:
* infrun.c (handle_inferior_event): Only call
gdbarch_displaced_step_restore_all_in_ptid if
gdbarch_supports_displaced_stepping is true.
Tom Tromey [Tue, 1 Jun 2021 14:11:30 +0000 (08:11 -0600)]
Remove some gdb/data-directory special cases
I found an odd special case for data-directory in gdb's Makefile. I
don't see a reason to have this, so this removes it in favor of having
this code work in the most ordinary way for a subdirectory build.
gdb/ChangeLog
2021-06-01 Tom Tromey <tromey@adacore.com>
* Makefile.in (all-data-directory): Remove.
(data-directory/Makefile): Remove.
Tom Tromey [Tue, 1 Jun 2021 14:11:30 +0000 (08:11 -0600)]
Clean up gdb's --enable-shared
The old testsuite configure did not use AS_HELP_STRING, and it had a
typo in the help for --enable-shared. This patch fixes these
problems.
gdb/ChangeLog
2021-06-01 Tom Tromey <tromey@adacore.com>
* configure: Rebuild.
* configure.ac: Use AS_HELP_STRING for enable-shared. Fix typo.
Tom Tromey [Tue, 1 Jun 2021 14:11:30 +0000 (08:11 -0600)]
Apply silent Makefile rules to gdb/testsuite
This applies the silent-rules.mk treatment to gdb/testsuite/Makefile.
gdb/ChangeLog
2021-06-01 Tom Tromey <tromey@adacore.com>
* silent-rules.mk (ECHO_CC): New variable.
gdb/testsuite/ChangeLog
2021-06-01 Tom Tromey <tromey@adacore.com>
* Makefile.in (all): Don't print anything.
($(abs_builddir)/site.exp site.exp): Use $(ECHO_GEN).
(expect-read1): Likewise.
(read1.so): Use $(ECHO_CC).
Include silent-rules.mk.
Tom Tromey [Tue, 1 Jun 2021 14:11:30 +0000 (08:11 -0600)]
Always build 'all' in gdb/testsuite
gdb's Makefile currently excludes testsuite from the subdirectories to
build. I don't think there's a good reason for this, so this patch
adds testsuite to the SUBDIRS list and removes a special case from
'all'.
gdb/ChangeLog
2021-06-01 Tom Tromey <tromey@adacore.com>
* Makefile.in (SUBDIRS): Add testsuite.
(all): Don't exclude testsuite.
Tom Tromey [Tue, 1 Jun 2021 14:11:30 +0000 (08:11 -0600)]
Remove gdb/testsuite/configure
I didn't see a strong reason to have a separate configure script in
gdb/testsuite, so this patch removes it. The few relevant configury
bits are moved into gdb's configure script. Some of the old
testsuite/configure script (e.g., the header check) is dead code.
This also adds a Makefile rule to rebuild lib/pdtrace. This was
missing from the old code.
'read1' is now a dependency of check-read1, rather than extra code at
configure time.
Finally, the old "ENABLE_LIBCTF" subst in gdb/configure was not used;
nor was the variable defined, so this was always empty. However, the
lower-case variant was used by the testsuite, so this patch renames
the subst.
gdb/ChangeLog
2021-06-01 Tom Tromey <tromey@adacore.com>
* configure.ac: Copy some code from testsuite/configure.ac.
(enable_libctf): Subst this, not ENABLE_LIBCTF.
* configure: Rebuild.
gdb/testsuite/ChangeLog
2021-06-01 Tom Tromey <tromey@adacore.com>
* aclocal.m4, configure.ac, configure: Remove.
* Makefile.in (EXTRA_RULES): Remove.
($(abs_builddir)/site.exp site.exp): Don't depend on
config.status.
(distclean maintainer-clean realclean, Makefile): Update.
(config.status): Remove target.
(lib/pdtrace): New target.
(all): Don't depend on EXTRA_RULES.
(check-read1): Depend on read1.so, expect-read1.
Tom de Vries [Tue, 1 Jun 2021 13:25:51 +0000 (15:25 +0200)]
[gdb/symtab] Ignore cold clones
Consider the test-case contained in this patch, compiled for c using gcc-10:
...
$ gcc-10 -x c src/gdb/testsuite/gdb.cp/cold-clone.cc -O2 -g -Wall -Wextra
...
When setting a breakpoint on foo, we get one breakpoint location:
...
$ gdb -q -batch a.out -ex "b foo"
Breakpoint 1 at 0x400560: file cold-clone.cc, line 28.
...
However, when we compile for c++ instead, we get two breakpoint locations:
...
$ gdb -q -batch a.out -ex "b foo" -ex "info break"
Breakpoint 1 at 0x400430: foo. (2 locations)
Num Type Disp Enb Address What
1 breakpoint keep y <MULTIPLE>
1.1 y 0x0000000000400430 in foo() at cold-clone.cc:30
1.2 y 0x0000000000400560 in foo() at cold-clone.cc:28
...
The additional breakpoint location at 0x400430 corresponds to the cold clone:
...
$ nm a.out | grep foo
0000000000400560 t _ZL3foov
0000000000400430 t _ZL3foov.cold
...
which demangled looks like this:
...
$ nm -C a.out | grep foo
0000000000400560 t foo()
0000000000400430 t foo() [clone .cold]
...
[ Or, in the case of the cc1 mentioned in PR23710:
...
$ nm cc1 | grep do_rpo_vn.*cold
000000000058659d t \
_ZL9do_rpo_vnP8functionP8edge_defP11bitmap_headbb.cold.138
$ nm -C cc1 | grep do_rpo_vn.*cold
000000000058659d t \
do_rpo_vn(function*, edge_def*, bitmap_head*, bool, bool) [clone .cold.138]
... ]
The cold clone is a part of the function that is split off from the rest of
the function because it's considered cold (not frequently executed). So while
the symbol points to code that is part of a function, it doesn't point to a
function entry, so the desirable behaviour for "break foo" is to ignore this
symbol.
When compiling for c, the symbol "foo.cold" is entered as minimal symbol
with the search name "foo.cold", and the lookup using "foo" fails to find that
symbol.
But when compiling for c++, the symbol "foo.cold" is entered as minimal symbol
with both the mangled and demangled name, and for the demangled name
"foo() [clone .cold]" we get the search name "foo" (because
cp_search_name_hash stops hashing at '('), and the lookup using "foo" succeeds.
Fix this by recognizing the cold clone suffix and returning false for such a
minimal symbol in msymbol_is_function.
Tested on x86_64-linux.
gdb/ChangeLog:
2021-06-01 Tom de Vries <tdevries@suse.de>
PR symtab/26096
* minsyms.c (msymbol_is_cold_clone): New function.
(msymbol_is_function): Use msymbol_is_cold_clone.
gdb/testsuite/ChangeLog:
2021-06-01 Tom de Vries <tdevries@suse.de>
PR symtab/26096
* gdb.cp/cold-clone.cc: New test.
* gdb.cp/cold-clone.exp: New file.
Andrew Burgess [Thu, 20 May 2021 13:09:22 +0000 (14:09 +0100)]
gdb: run 'maint selftest' with an executable loaded
I spotted that 'maint selftest' with an executable loaded into GDB,
would (when GDB was compiled for all targets) crash GDB. I fixed this
with a commit to bfd:
commit
427e4066afd13d1bf52c849849475f536e285d66
Date: Thu May 20 09:16:41 2021 +0100
gdb/bfd: avoid crash when architecture is forced to csky or riscv
However, this issue was not spotted as we currently only run 'maint
selftest' without an executable loaded.
This commit extends the testsuite to run 'maint selftest' both with
and without an executable loaded into GDB.
Currently, when no executable is loaded into GDB all of the selftest
pass (i.e. the fail count is 0), however, when running with an
executable loaded, I am seeing 1 failure (on an x86-64 GNU/Linux
host).
This failure is from the ARM disassembler tests, it appears that the
disassembler somehow gets itself into a state where it thinks it is in
thumb mode; when running the same test without an executable loaded
this doesn't happen.
This commit doesn't fix the ARM disassembler issue, but I thought it
was worth adding this anyway, as this will spot if GDB again starts to
crash when 'maint selftest' is run.
gdb/testsuite/ChangeLog:
* gdb.gdb/unittest.c: New file.
* gdb.gdb/unittest.exp: Run with and without a binary file loaded
into GDB.
Andrew Burgess [Wed, 20 Jan 2021 15:13:16 +0000 (15:13 +0000)]
gdb/arm: add support for bare-metal core dumps
This commit adds support for bare metal core dumps on the ARM target,
and is based off of this patch submitted to the mailing list:
https://sourceware.org/pipermail/gdb-patches/2020-October/172845.html
Compared to the version linked above this version is updated to take
account of recent changes to the core dump infrastructure in GDB,
there is now more shared infrastructure for core dumping within GDB,
and also some common bare metal core dumping infrastructure. As a
result this patch is smaller than the original proposed patch.
Further, the original patch included some unrelated changes to the
simulator that have been removed from this version.
I have written a ChangeLog entry as the original patch was missing
one.
I have done absolutely no testing of this patch. It is based on the
original submitted patch, which I assume was tested, but after my
modifications things might have been broken, however, the original
patch author has tested this version and reported it as being good:
https://sourceware.org/pipermail/gdb-patches/2021-May/178900.html
The core dump format is based around generating an ELF containing
sections for the writable regions of memory that a user could be
using. Which regions are dumped rely on GDB's existing common core
dumping code, GDB will attempt to figure out the stack and heap as
well as copying out writable data sections as identified by the
original ELF.
Register information is added to the core dump using notes, just as it
is for Linux of FreeBSD core dumps. The note types used consist of
the 2 basic types you would expect in a OS based core dump,
NT_PRPSINFO, NT_PRSTATUS, along with the architecture specific
NT_ARM_VFP note.
The data layouts for each note type are described below, in all cases,
all padding fields should be set to zero.
Note NT_PRPSINFO is optional. Its data layout is:
struct prpsinfo_t
{
uint8_t padding[28];
char fname[16];
char psargs[80];
}
Field 'fname' - null terminated string consisting of the basename of
(up to the fist 15 characters of) the executable. Any additional
space should be set to zero. If there's no executable name then
this field can be set to all zero.
Field 'psargs' - a null terminated string up to 80 characters in
length. Any additional space should be filled with zero. This
field contains the full executable path and any arguments passed
to the executable. If there's nothing sensible to write in this
field then fill it with zero.
Note NT_PRSTATUS is required, its data layout is:
struct prstatus_t
{
uint8_t padding_1[12];
uint16_t sig;
uint8_t padding_2[10];
uint32_t thread_id;
uint8_t padding_3[44];
uint32_t gregs[18];
}
Field 'sig' - the signal that stopped this thread. It's implementation
defined what this field actually means. Within GDB this will be
the signal number that the remote target reports as the stop
reason for this thread.
Field 'thread_is' - the thread id for this thread. It's implementation
defined what this field actually means. Within GDB this will be
thread thread-id that is assigned to each remote thread.
Field 'gregs' - holds the general purpose registers $a1 through to $pc
at indices 0 to 15. At index 16 the program status register.
Index 17 should be set to zero.
Note NT_ARM_VFP is optional, its data layout is:
armvfp_t
{
uint64_t regs[32];
uint32_t fpscr;
}
Field 'regs' - holds the 32 d-registers 0 to 31 in order.
Field 'fpscr' - holds the fpscr register.
The rules for ordering the notes is the same as for Linux. The
NT_PRSTATUS note must come before any other notes about additional
register sets. And for multi-threaded targets all registers for a
single thread should be grouped together. This is because only
NT_PRSTATUS includes a thread-id, all additional register notes after
a NT_PRSTATUS are assumed to belong to the same thread until a
different NT_PRSTATUS is seen.
gdb/ChangeLog:
PR gdb/14383
* Makefile.in (ALL_TARGET_OBS): Add arm-none-tdep.o.
(ALLDEPFILES): Add arm-none-tdep.c
* arm-none-tdep.c: New file.
* configure.tgt (arm*-*-*): Add arm-none-tdep.o to cpu_obs.
Andrew Burgess [Thu, 29 Aug 2019 11:37:00 +0000 (12:37 +0100)]
gdb: avoid premature dummy frame garbage collection
Consider the following chain of events:
* GDB is performing an inferior call, and
* the inferior calls longjmp, and
* GDB detects that the longjmp has completed, stops, and enters
check_longjmp_breakpoint_for_call_dummy (in breakpoint.c), and
* GDB tries to unwind the stack in order to check that the dummy
frame (setup for the inferior call) is still on the stack, but
* The unwind fails, possibly due to missing debug information, so
* GDB incorrectly concludes that the inferior has longjmp'd past the
dummy frame, and so deletes the dummy frame, including the dummy
frame breakpoint, but then
* The inferior continues, and eventually returns to the dummy frame,
which is usually (always?) on the stack, the inferior starts
trying to execute the random contents of the stack, this results
in undefined behaviour.
This situation is already warned about in the comment on the function
check_longjmp_breakpoint_for_call_dummy where we say:
You should call this function only at places where it is safe to currently
unwind the whole stack. Failed stack unwind would discard live dummy
frames.
The warning here is fine, the problem is that, even though we call the
function from a location within GDB where we hope to be able to
unwind, sometime the state of the inferior means that the unwind will
not succeed.
This commit tries to improve the situation by adding the following
additional check; when GDB fails to find the dummy frame on the stack,
instead of just assuming that the dummy frame can be garbage
collected, first find the stop_reason for the last frame on the stack.
If this stop_reason indicates that the stack unwinding may have failed
then we assume that the dummy frame is still in use. However, if the
last frame's stop_reason indicates that the stack unwind completed
successfully then we can be confident that the dummy frame is no
longer in use, and we garbage collect it.
Tested on x86-64 GNU/Linux.
gdb/ChangeLog:
* breakpoint.c (check_longjmp_breakpoint_for_call_dummy): Add
check for why the backtrace stopped.
gdb/testsuite/ChangeLog:
* gdb.base/premature-dummy-frame-removal.c: New file.
* gdb.base/premature-dummy-frame-removal.exp: New file.
* gdb.base/premature-dummy-frame-removal.py: New file.
Change-Id: I8f330cfe0f3f33beb3a52a36994094c4abada07e
GDB Administrator [Tue, 1 Jun 2021 00:00:49 +0000 (00:00 +0000)]
Automatic date update in version.in
Simon Marchi [Mon, 31 May 2021 16:33:32 +0000 (12:33 -0400)]
gdb: pass signature to allocate_signatured_type and signatured_type constructor
All signatured_type constucted (even those used only for lookups in hash
maps) need a signature. Enforce that by passing the signature all the
way to the signatured_type constructor.
gdb/ChangeLog:
* dwarf2/read.h (struct structured_type) <signatured_type>: New.
Update all callers.
(struct dwarf2_per_bfd) <allocate_signatured_type>: Add
signature parameter, update all callers.
* dwar2/read.c (dwarf2_per_bfd::allocate_signatured_type): Add
signature parameter.
Change-Id: I99bc1f88f54127666aa133ddbbabb7f7668fa14a
Simon Marchi [Mon, 31 May 2021 16:33:32 +0000 (12:33 -0400)]
gdb: add and use signatured_type_up
Add an alias for std::unique_ptr<signatured_type> and use it where
possible.
gdb/ChangeLog:
* dwarf2/read.h (signatured_type_up): New, use where possible.
Change-Id: I5a41e8345551434c8beeb9f269b03bdcf27989be
Simon Marchi [Mon, 31 May 2021 16:33:31 +0000 (12:33 -0400)]
gdb: move dwarf2_per_cu_data and signatured_type up
Move them up before dwarf2_per_bfd, this will allow adding and using
signatured_type_up in the next patch.
gdb/ChangeLog:
* dwarf2/read.h (signatured_type, dwarf2_per_cu_data): Move up.
Change-Id: I85acad4476c8236930b6f9e53ddb8bbbad009e5e
Nelson Chu [Wed, 12 May 2021 15:26:33 +0000 (08:26 -0700)]
RISC-V: PR27566, Do not relax when data segment phase is exp_seg_relro_adjust.
2021-05-31 Nelson Chu <nelson.chu@sifive.com>
Lifang Xia <lifang_xia@c-sky.com>
The data segment phase exp_seg_relro_adjust means we are still adjusting the
relro segments, so we will get the symbol values which havn't consider the
relro. It is dangerous and we shouldn't do the relaxations at this stage.
Otherwise, we may get the truncated fails when the relax range crossing the
data segment.
One of the solution is that, we use a pointer to monitor the data segment
phase while relaxing, to know whether the relro has been handled or not.
Once we check the phase is exp_seg_relro_adjust, we should skip this round
of relaxations, since the incorrect symbol values will affect the correctness
of relaxations. I think we probably need to record more information about
data segment or alignments in the future, to make sure it is safe to doing
relaxations.
For the two new testcases, relro-relax-lui and relro-relax-pcrel, we get
the following truncated errors when using toolchains, which enable relro:
(.text+0x0): relocation truncated to fit: R_RISCV_GPREL_I against symbol `SymbolRodata' defined in .rodata section in test1.o
After applying this patch, the truncated errors should be resolved.
However, only linux toolchains support -z relro, so we only test these
two testcases when supporting shared library.
bfd/
PR 27566
* elfnn-riscv.c (struct riscv_elf_link_hash_table): New integer pointer
to monitor the data segment phase.
(bfd_elfNN_riscv_set_data_segment_info): New function called by
after_allocation, to set the data_segment_phase from expld.dataseg.
(_bfd_riscv_relax_section): Don't relax when data_segment_phase is
exp_seg_relro_adjust (0x4).
* elfxx-riscv.h (bfd_elf32_riscv_set_data_segment_info): New extern.
(bfd_elf64_riscv_set_data_segment_info): Likewise.
ld/
PR 27566
* emultempl/riscvelf.em (after_allocation): Call
riscv_set_data_segment_info to set data segment phase before relaxing.
* testsuite/ld-riscv-elf/ld-riscv-elf.exp: Updated.
* testsuite/ld-riscv-elf/relro-relax-lui.d: New testcase.
* testsuite/ld-riscv-elf/relro-relax-lui.s: Likewise.
* testsuite/ld-riscv-elf/relro-relax-pcrel.d: Likewise.
* testsuite/ld-riscv-elf/relro-relax-pcrel.s: Likewise.
Tom Tromey [Sun, 30 May 2021 14:50:57 +0000 (08:50 -0600)]
Set is_debug_types in allocate_signatured_type
All callers of allocate_signatured_type set the is_debug_types flag on
the result -- in fact, they are required to, because this is the sign
that downcasting the object to signatured_type is safe. This patch
moves this assignment into the allocation function.
2021-05-30 Tom Tromey <tom@tromey.com>
* dwarf2/read.c (dwarf2_per_bfd::allocate_signatured_type): Set
is_debug_types.
(create_signatured_type_table_from_index)
(create_signatured_type_table_from_debug_names, add_type_unit)
(read_comp_units_from_section): Update.
Tom Tromey [Sat, 29 May 2021 21:35:07 +0000 (15:35 -0600)]
Remove dwarf2_per_bfd::m_num_psymtabs
Now that CUs and TUs are stored together in all_comp_units, the
m_num_psymtabs member is no longer needed -- it is always identical to
the length of the vector. This patch removes it.
2021-05-30 Tom Tromey <tom@tromey.com>
* dwarf2/read.h (struct dwarf2_per_bfd) <num_psymtabs,
m_num_psymtabs>: Remove.
(resize_symtabs): Update.
* dwarf2/read.c (dwarf2_per_bfd::allocate_per_cu)
(dwarf2_per_bfd::allocate_signatured_type): Update.
GDB Administrator [Mon, 31 May 2021 00:00:51 +0000 (00:00 +0000)]
Automatic date update in version.in
GDB Administrator [Sun, 30 May 2021 00:00:46 +0000 (00:00 +0000)]
Automatic date update in version.in
Mike Frysinger [Sat, 29 May 2021 22:02:02 +0000 (18:02 -0400)]
sim: ppc: enable -Wno-format for mingw targets
This mirrors what we do for other builds already.
Mike Frysinger [Sat, 29 May 2021 21:57:55 +0000 (17:57 -0400)]
sim: ppc: avoid shadowing errno
If the OS headers define the "errno" symbol, it breaks some of these
funcs that were using "int errno" itself. Rename local vars to "err"
to avoid that, and delete the old "extern int errno".
This page took 0.053866 seconds and 4 git commands to generate.