Commit Graph

2363 Commits

Author SHA1 Message Date
martin
95f08802a7 Initialize namelen 2020-12-14 12:34:07 +00:00
rin
c85c1127ef Add some precautions for platforms without PT_STEP support.
"nat/gdb_ptrace.h" defines PT_STEP as 9, if it is not defined. nat-ptrace.c
depends on this; inf_ptrace_target::resume() uses PT_STEP unconditionally
when its ``step'' argument is non-zero. Therefore,

- Add comment that nbsd-nat.c should include <sys/ptrace.h> directly,
  instead of "nat/gdb_ptrace.h".

- Add gdb_assert(step == 0) in nbsd_nat_target::resume() ifndef PT_STEP,
  before calling inf_ptrace_target::resume().
2020-12-14 02:05:07 +00:00
rin
9b9416d880 Revert previous as per request from kamil; now, arm/ptrace.h does not
expose unimplemented PT_STEP.
2020-12-14 02:01:03 +00:00
christos
ae9ebf6f0f Improve previous: generated names end with .[[:digits:]] so look for that
instead.
2020-12-13 16:50:47 +00:00
christos
cf7777a2e0 PR/55851: Martin Husemann: recognize <symbol>.part.<n> names
This is gross; perhaps we should hide them completely (not print them
in stack traces etc.)
2020-12-11 18:25:45 +00:00
christos
d8dceee84f fix aarch64 crossgdb 2020-12-11 18:23:25 +00:00
christos
22c0a8465b regen 2020-12-11 18:22:11 +00:00
martin
52d85f7124 Avoid an unused variable (breaking the build) 2020-12-10 16:07:26 +00:00
rin
93b94eb346 Fix armeb; CORE_ADDR is uint64_t but 2nd argument of raw_supply() is
expected to be the same size as PC. Therefore, PC was always read as
zero for big-endian.
2020-12-10 07:27:37 +00:00
rin
9e80800bb0 Fix arm, for which PT_STEP is defined but unimplemented.
XXX
Stop exposing PT_STEP to userland for arm?
2020-12-10 07:14:58 +00:00
christos
9d73d70e90 include gdbarch.h 2020-12-08 13:56:38 +00:00
christos
16f88d4a62 make function static (fixes crossgdb build, reported by martin@) 2020-12-07 20:28:53 +00:00
rin
393045b225 mknative for aarch64eb. 2020-12-07 08:31:05 +00:00
rin
db812a1d3b Add elf32-aarch64.c to DPSRCS and CLEANFILES. 2020-12-07 08:24:09 +00:00
christos
85d1299109 Don't descend to gdbserver for now 2020-12-06 15:00:25 +00:00
christos
2d450a0b24 fix powerpc 2020-12-06 14:26:40 +00:00
christos
9fd8799cb5 regen more mips and aarch64 2020-12-06 05:23:03 +00:00
christos
e5d758f832 fix sh3, regen some more 2020-12-06 04:08:51 +00:00
christos
20c7f62303 fix m68k, ppc, sparc, vax 2020-12-06 03:29:03 +00:00
christos
13f1e6e199 need -lpthread for sun2 2020-12-06 03:28:25 +00:00
christos
d52bc7250a fix hppa 2020-12-05 23:02:25 +00:00
christos
3909f68e34 fix arm build 2020-12-05 22:24:26 +00:00
christos
5275d28a1c fix alpha build. 2020-12-05 22:14:44 +00:00
christos
992125b748 fix and rege aarch64 2020-12-05 21:27:06 +00:00
christos
417fcb580b add aarch64 bits 2020-12-05 21:26:43 +00:00
rin
a3e196b030 gcc.old: Switch earmv6{,hf}eb to BE8, ported from gcc. 2020-12-01 02:39:48 +00:00
rin
8f72a86eed Switch earmv6{,hf}eb from BE32 (deprecated) to BE8 (new), which enables
- binary compatibility with earmv7{,hf}eb and later, as well as
  COMPAT_NETBSD32 on aarch64eb
- unaligned memory access

whereas compatibility with earmv5{,hf}eb and prior is lost.

As we have never released kernel and userland for earmv6{,hf}eb yet,
this does not causes any compatibility problems.

Discussed on port-arm and tech-toolchain.
2020-12-01 02:39:08 +00:00
rin
a8c74629f6 Support aarch64eb in */config.guess.
Cherry-picked from upstream:
https://git.savannah.gnu.org/gitweb/?p=config.git;a=commit;h=1c4398015583eb77bc043234f5734be055e64bea

Everything except external/apache2/llvm/dist/llvm/cmake/config.guess
is patched, which is under vendor tag and cannot be modified. I expect
that this file is not actually used as we use hand-crafted version of
configure script instead of cmake for building LLVM.

Note that external/apache2/llvm/autoconf/autoconf/config.guess has
already been committed on Oct. 20, but commit message disappeared as
cvs aborted due to "permission denied" when trying to modify the file
mentioned above. Sorry for confusing you.

Also note that GMP uses its own config.guess Patch for
external/lgpl3/gmp/dist/config.guess is provided by ryo@. Thanks!
2020-11-17 10:35:10 +00:00
christos
a7b28dcb09 PR/55802: Andreas Gustafsson: Unbreak reproducible builds.
For reproducible builds to work we need to have a consistent command
line (because the command line gets recorded in dwarf). So we can't
do:

    -ffile-prefix-map=/joe/random/src=/usr/src

because then /joe/random/src gets recorded. We do instead:

    -ffile-prefix-map=\$NETBSDSRCDIR=/usr/src

The patch restores the environment variable parsing that got lost
in the last 2 gcc upgrades.
2020-11-14 21:24:03 +00:00
christos
82c4abc314 Now that we are adding the thread in the bsd_kvm_ops target namespace,
make sure that the inferior's top namespace is that too.
2020-10-24 23:06:15 +00:00
kamil
fe62285e60 Install the NetBSD XML syscall definitions 2020-10-24 05:01:57 +00:00
rin
9f4a23d06a Fix assembling "isb sy" for aarch64{,eb} on LP64BE architectures.
Cherry-picked from upstream:

https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff;h=05cfb0d8cc9b7f8676f5ae55a93642f091d5405f;hp=0ec992e6647c00fc234cdf4c11732b6711b024af

Now, working kernel can be self-built on aarch64eb.

Thanks to ryo@ for fixing and upstreaming this!
2020-10-19 12:47:53 +00:00
maya
2256753ef0 Remove unused local diff. Pointed out by htodd. 2020-10-19 07:44:52 +00:00
kamil
375c406271 Limit the switch_to_thread() calls in startup_inferior()
Do not jump over the threads during the startup unless we encounter
TARGET_WAITKIND_STOPPED with SIGTRAP or TARGET_WAITKIND_EXECD.

Otherwise whenever a startup-with-shell processes signals on the
startup stage, it might indicate to switch to a non-existing
thread or a special-thread number (target lwp=0 on NetBSD means
that a signal was directed to all threads within a process).

This caused a crash with tcsh on NetBSD, where the tcsh shell
runs startup detection of the hostname. This action involves
spwaning a new process through fork.

GDB crashes this way:
$ SHELL=tcsh /usr/bin/gdb echo
(gdb) r
Starting program: /bin/echo
/usr/src/external/gpl3/gdb/lib/libgdb/../../dist/gdb/thread.c:1309:
internal-error: void switch_to_thread(thread_info*):
Assertion `thr != NULL' failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.

This patch has been submitted upstream for review:

https://sourceware.org/pipermail/gdb-patches/2020-October/172558.html
2020-10-14 14:02:43 +00:00
rin
5919239d7d Reduce diff with upstream a bit.
No functional changes.
2020-10-13 07:12:00 +00:00
rin
271d6b3e72 Adjust for aarch64eb; it needs elf32-aarch64.c. 2020-10-09 23:55:48 +00:00
rin
11eeaade86 mknative-gdb.old for aarch64eb 2020-10-09 23:54:12 +00:00
rin
c4b815a64a Apply hack for GDB 8.3 on arm to GDB 11.
XXX
Not tested as GDB 11 does not build for arm at the moment.

Note that dist/gdb/dwarf2foo.c was renamed to dist/gdb/dwarf2/foo.c.
2020-10-08 08:32:57 +00:00
rin
75fa0b3cd9 GCC 9.3 miscompiles dwarf2{expr,loc}.c with -O2 for earmv5hf{,eb}
(-O1 is fine). This is a new regression introduced in GCC9.

For everyone's safety, extend -O0 hack to dwarf2{expr,loc}.c for
all arm variants with GCC >= 8.
2020-10-08 08:31:37 +00:00
kamil
933fb81256 Replace local patches adding NetBSD/aarch64 support with the upstream one
Cherry-pick:

From c0b313441717b65569edb01bf9984d2066d899de Mon Sep 17 00:00:00 2001
From: Nick Clifton <nickc@redhat.com>
Date: Mon, 5 Oct 2020 14:56:42 +0100
Subject: [PATCH] Add NetBSD AArch64 Little Endian and Big Endian BFD support.

bfd      * config.bfd (aarch64-*-netbsd*, aarch64_be-*-netbsd*): Add target.
2020-10-06 23:28:13 +00:00
kamil
c19751a211 Undo local patches
They are no longer needed (and are wrong).
2020-10-06 23:14:47 +00:00
kamil
6a134d1bf9 Remove NFC local delta 2020-10-06 22:17:42 +00:00
kamil
33673ac57c Fix typo
Remove delta with upstream.
2020-10-06 22:14:41 +00:00
kamil
cc2fb38879 Replace local patch with fix from upstream
Cherry-pick:

From e2a2a24a8e78427ff8667d625f5befbe88c328bb Mon Sep 17 00:00:00 2001
From: Kamil Rytarowski <n54@gmx.com>
Date: Wed, 23 Sep 2020 04:20:05 +0200
Subject: [PATCH] Preinitialize the sockaddr_un variable to zero

Don't pass random sun_len for the BSD's,
zero the whole structure as recommended for portability.

Reported by Coverity.

gdbsupport/ChangeLog:

	* agent.cc (gdb_connect_sync_socket): Preinitialize addr with zeros.
2020-10-06 22:04:09 +00:00
kamil
95bfe6ceb7 Undo local NFC patch 2020-10-06 21:54:01 +00:00
kamil
543accdbd7 Undo local patch having no impact
/tmp is picked from P_tmpdir earlier.
2020-10-06 21:49:22 +00:00
kamil
fef5fe3a2a Undo local NFC patch 2020-10-06 21:39:53 +00:00
christos
67dafae820 Apply by hand a patch to fix http://r6.ca/blog/20200929T023701Z.html
aka "the memcmp bug", from a patch for gcc-10 in
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95189
Tested on x86_64 by running a full build, install and running it.
Testing that the problem has been fixed with one of the unit tests provided.
2020-10-04 14:44:47 +00:00
kamil
4d7b5ca9b5 Do not assume that _lwp_getprivate() returns unbiased private pointer
Cherry-pick and adapt:

From 2a9ce60de98e53198047daaeeec3cf09ece4e693 Mon Sep 17 00:00:00 2001
From: Kamil Rytarowski <n54@gmx.com>
Date: Fri, 2 Oct 2020 16:13:09 +0200
Subject: [PATCH] [compiler-rt] [netbsd] Improve the portability of
 ThreadSelfTlsTcb

Use __lwp_gettcb_fast() and __lwp_getprivate_fast(), as _lwp_getprivate()
can be a biased pointer and invalid for use in this function on all CPUs.
2020-10-02 14:36:54 +00:00
christos
5093c1f669 Add the generated version file 2020-09-24 14:54:03 +00:00