gdb-netbsd: Sync with 2019-02-02

This commit is contained in:
Kamil Rytarowski 2019-09-02 22:07:53 +02:00
parent 30596151d5
commit 4bdef9a128
121 changed files with 6045 additions and 81 deletions

View File

@ -4,18 +4,130 @@ SHA1 (gdb-8.2.1-7e24fb63e7db33d3627623629b0e99fe322e26f9.tar.gz) = a8ae54700e1f2
RMD160 (gdb-8.2.1-7e24fb63e7db33d3627623629b0e99fe322e26f9.tar.gz) = 96040eb8f7eccd8c7dd157473b781144701754a0
SHA512 (gdb-8.2.1-7e24fb63e7db33d3627623629b0e99fe322e26f9.tar.gz) = d7a8692ee1b27aecac64bf4176e5fa3e44e315e88da079c24107f3e5318e0e335f35b38426e72c118bd044d547fdd94650781fb1dd1297d33dd5a54c77e78988
Size (gdb-8.2.1-7e24fb63e7db33d3627623629b0e99fe322e26f9.tar.gz) = 59113538 bytes
SHA1 (patch-Makefile.in) = 48f65798f96fdda2a35eb8b18a7cc2993023bcc7
SHA1 (patch-gdb_configure.tgt) = 06a6cb8fc9453a0a56e3e3c7ba9c3012653b4f5c
SHA1 (patch-bfd_config.bfd) = 0fd42301a1577e353381a0bf677a7bcb5d32c3d8
SHA1 (patch-bfd_configure) = 2345b0527e83debbfffd574eee74d10feecf2a00
SHA1 (patch-bfd_doc_Makefile.in) = 63a289d492cbf51b3ce39969b67dfebf86096715
SHA1 (patch-bfd_elf.c) = c62b91aeb3c607648fb379865e7ad22f0aa4a115
SHA1 (patch-bfd_merge.c) = dcb36bfd014e0b5bec17d6b6d475bf988021daee
SHA1 (patch-bfd_netbsd-core.c) = 0aa8039b5734575b89e33a9ece4ab3f76b326eba
SHA1 (patch-config_acinclude.m4) = da39a3ee5e6b4b0d3255bfef95601890afd80709
SHA1 (patch-cpu_epiphany.opc) = da39a3ee5e6b4b0d3255bfef95601890afd80709
SHA1 (patch-gdb_Makefile.in) = dc465eda202863a23ce660ae5f8065a74e5c8fb4
SHA1 (patch-gdb_aarch64-nbsd-nat.c) = 04ffc8ed696cb2349a67d302c2f8fa596484a9e6
SHA1 (patch-gdb_aarch64-nbsd-tdep.c) = 7720b954f12031b60e1fa0a48ce668b104e09d41
SHA1 (patch-gdb_aarch64-nbsd-tdep.h) = 814627b2b2ce5dc0dc095451183fbe03789f1513
SHA1 (patch-gdb_alpha-bsd-nat.c) = 4d74177d2255c81fb91c293daaebfc29c4cb8398
SHA1 (patch-gdb_alpha-nbsd-tdep.c) = 8fe9d1f08baa252b61b49c2672391c3349768444
SHA1 (patch-gdb_alpha-tdep.c) = 9030c31dcef6660f58fc27e7979f0dae26e4f970
SHA1 (patch-gdb_amd64-bsd-nat.c) = dea0bd38155f2a39f89f4f62dcbaf3e54ccd654f
SHA1 (patch-gdb_amd64-nbsd-nat.c) = 26ad634a79441949c076cee07e4e5baaaa1402f1
SHA1 (patch-gdb_amd64-nbsd-tdep.c) = 99328cdd390281ff298c08010907195738a85489
SHA1 (patch-gdb_arm-nbsd-nat.c) = 09a21d2eed39dc4e74a1f442c6ee59dfbf9c6f54
SHA1 (patch-gdb_arm-nbsd-tdep.c) = 63009d506e2f92e681529d96150b1c4d04a7afbe
SHA1 (patch-gdb_auxv.c) = b238b9bc4b598a96feed4a64e7c2f5120e2d3367
SHA1 (patch-gdb_bsd-kvm.c) = d04c44fb4c779dd3ecd12c3179ad8a63351e5239
SHA1 (patch-gdb_config_aarch64_nbsd.mh) = 6d7793009bda1568717ed897c02e77137e47b83b
SHA1 (patch-gdb_config_ia64_netbsd.mh) = ed89b31ad808e15e1823af1a022ce37194e6f78e
SHA1 (patch-gdb_config_powerpc_ppc64-nbsd.mh) = bef62de0ebc162aeac12939d4f4fb220be99efe2
SHA1 (patch-gdb_configure) = 681e095fdd15432dbc094bf70e5a5b7c67637ad7
SHA1 (patch-gdb_configure.host) = 427f6dbc2f4373e7e9bede77ccb7a3cd28c74d14
SHA1 (patch-gdb_configure.nat) = ba5ad6fe4c31b5f5e81bd69c81feb70c36b0f7df
SHA1 (patch-gdb_configure.tgt) = 6e32066a87234a90c905a0ab17a32ef84a903d0a
SHA1 (patch-gdb_contrib_ari_gdb__ari.sh) = da39a3ee5e6b4b0d3255bfef95601890afd80709
SHA1 (patch-gdb_contrib_expect-read1.sh) = da39a3ee5e6b4b0d3255bfef95601890afd80709
SHA1 (patch-gdb_doc_stabs.texinfo) = 42e4864a3e5725b139aaabcadd4b982e39826f8a
SHA1 (patch-gdb_features_feature__to__c.sh) = da39a3ee5e6b4b0d3255bfef95601890afd80709
SHA1 (patch-gdb_gdbserver_Makefile.in) = c14e0e580515b849b1ddac65d50b2f757645cea6
SHA1 (patch-gdb_gdbserver_configure.srv) = d492edda5a6f7e70a2279ebe7409e557672b92aa
SHA1 (patch-gdb_gdbserver_debug.c) = 8226f32fd7df152b7aa6109621c9b162639ed657
SHA1 (patch-gdb_gdbserver_netbsd-low.c) = cf86c64eb64bcde237677844c3e79cbea8e72b57
SHA1 (patch-gdb_gdbserver_netbsd-low.h) = c2d11d0e6c0a1b3317eb8313436de0e202233e1a
SHA1 (patch-gdb_gdbserver_netbsd-x86__64-low.c) = 4d328f54051bfbc7c6678e0360a175ac3d004022
SHA1 (patch-gdb_gdbserver_netbsd-low.c) = 6b79896787cfde6b1c7029e4ad7cd62e274dd23d
SHA1 (patch-gdb_gdbserver_netbsd-low.h) = 4f4fe50c18f9d10ac842927860ab6418600881f3
SHA1 (patch-gdb_gdbserver_netbsd-x86__64-low.c) = 487374f6ef2d8943b4b413b86f613411a3811f40
SHA1 (patch-gdb_gdbserver_regcache.c) = 4967ab4c63b057d9b26c52be6e25d90e57a9fa06
SHA1 (patch-gdb_gdbserver_tdesc.c) = 9682dafab7a4ff6870afb93d5979cc48a3512b88
SHA1 (patch-gdb_gdbserver_tdesc.h) = dc701c237ec1102910ecd0dde47d23057a0d8f19
SHA1 (patch-gdb_gdbsupport_agent.c) = d2ce6030a8c7d4fe84c74f3a44dc5c49f970547e
SHA1 (patch-gdb_gdbsupport_common-defs.h) = 940d3489c2fac85defff29a0886f1c6d54bee020
SHA1 (patch-gdb_gdbsupport_pathstuff.h) = 1eef4a97e827bc06fd4c11824435de0ccce076f8
SHA1 (patch-gdb_hppa-nbsd-nat.c) = eb5fb4b69f0ba69a4a7e8152bc97762a5b2cf1ba
SHA1 (patch-gdb_hppa-nbsd-tdep.c) = 2b0552b3a8cb820daaf1fa3960cbbf6a31ad1c79
SHA1 (patch-gdb_hppa-tdep.c) = 57e3a1cc1718aee0f70797804e8859af6c3c7840
SHA1 (patch-gdb_hppa-tdep.h) = 6cda8a222cd10340ae54878998543e66f4455fd6
SHA1 (patch-gdb_i386-bsd-nat.c) = b07545ddfd92b1ff479a42d28d21f2713748fa69
SHA1 (patch-gdb_i386-bsd-nat.h) = f6688e75d80058832bbe12356399eec723f30328
SHA1 (patch-gdb_i386-nbsd-nat.c) = 12583799f643f31849063acf10cb0dc36c68101f
SHA1 (patch-gdb_i386-nbsd-tdep.c) = 002ece7989025a4bed1ce1eece9d225faf02c538
SHA1 (patch-gdb_ia64-nbsd-tdep.c) = 4d1795b806b1b957f7959d57cdab7090c9510fe5
SHA1 (patch-gdb_inf-ptrace.c) = caef41fb10c585b7b403a3dc6e82a924cc90becb
SHA1 (patch-gdb_m68k-bsd-nat.c) = 5740879c53ea6db0ac9c54dd2426014493e03014
SHA1 (patch-gdb_mips-nbsd-nat.c) = 1f71cb0d0c8792bfc80a456d294dad6d75b526b5
SHA1 (patch-gdb_mips-tdep.h) = 24b3cf83513716492297645b2d5c4281ab12b493
SHA1 (patch-gdb_nat_fork-inferior.c) = c15d3964c448e010958d8977825d6d46f8708e09
SHA1 (patch-gdb_nbsd-nat.c) = 60b1b2164206e52254e743cca3de762770f7ab9d
SHA1 (patch-gdb_nbsd-nat.h) = 4188f1edfb1b0b437c931fa60049221164a6e59e
SHA1 (patch-gdb_nbsd-tdep.c) = d375084ca0895e71a4f7b837cb633a11eb260884
SHA1 (patch-gdb_nbsd-tdep.h) = ca419a41fa2e7c41c4a84521700dcfae279f4bfc
SHA1 (patch-gdb_objfiles.c) = 25bcbc07b2a919db28c1145489e30dcb38b5a230
SHA1 (patch-gdb_p-exp.y) = 36098acb5eea8adc57160f84342b69abe53c5814
SHA1 (patch-gdb_ppc-nbsd-nat.c) = 9986c45717729ffc4db04068296543e3449495a7
SHA1 (patch-gdb_ppc-nbsd-tdep.c) = af7dd8000489c281be69f52d9c56662aff0f5ba5
SHA1 (patch-gdb_ppc-nbsd-tdep.h) = bc6e015d61b5d6d5e98a370295caf45170fe8e56
SHA1 (patch-gdb_regformats_regdef.h) = a126d2537ade44f669a7a6bcd59dcd89188554d1
SHA1 (patch-gdb_sh-nbsd-nat.c) = f316feea0192b6926ebe01d0fc83effe632ae063
SHA1 (patch-gdb_sh-nbsd-tdep.c) = 868d765ebf6c2d4dfb1319653c9312da1ce45a8e
SHA1 (patch-gdb_sh-nbsd-tdep.h) = 6dca499544ec3e95cd2c10a07926d1e80ab6d109
SHA1 (patch-gdb_sparc-nat.c) = 31a214f01f734add664fba4a462bd9f8e8686c92
SHA1 (patch-gdb_sparc-nat.h) = 1a10f19afb13dd25eb0aef1486a48d8c6c4ac647
SHA1 (patch-gdb_sparc-nbsd-nat.c) = 4aa8d16cf1210125f9117680014f2d8eaa36e681
SHA1 (patch-gdb_sparc-nbsd-tdep.c) = c61b63a6673402852a2e95b06d382b8eda1653e9
SHA1 (patch-gdb_sparc-nbsd-tdep.h) = 7520c8d0d465883abc4a302f1efabd9e52492acc
SHA1 (patch-gdb_sparc-tdep.h) = 74eb0364017aa8b41ef1a06dcb35d8b4a2a31852
SHA1 (patch-gdb_sparc64-nbsd-nat.c) = d7b9988c09f483d9d57dccc36610cb52751dac0b
SHA1 (patch-gdb_sparc64-nbsd-tdep.c) = 1e4562ab7f7a2c8b61b2becc70c9d6aa35140598
SHA1 (patch-gdb_testsuite_gdb.ada_uninitialized__vars_parse__controlled.ads) = da39a3ee5e6b4b0d3255bfef95601890afd80709
SHA1 (patch-gdb_testsuite_gdb.base_testenv.c) = da39a3ee5e6b4b0d3255bfef95601890afd80709
SHA1 (patch-gdb_testsuite_lib_compiler.cc) = da39a3ee5e6b4b0d3255bfef95601890afd80709
SHA1 (patch-gdb_testsuite_lib_pdtrace.in) = da39a3ee5e6b4b0d3255bfef95601890afd80709
SHA1 (patch-gdb_tui_tui-winsource.c) = fc0eb13c8c367bed20630921a6bacce186a80fd8
SHA1 (patch-gdb_user-regs.c) = ced798a4bb8765193bbde67811cea5b98e41d56f
SHA1 (patch-gdb_vax-bsd-nat.c) = 999589c89a2db8a4b38435aa6e9263e72791f60c
SHA1 (patch-gdb_x86-bsd-nat.c) = 615cbfb2b8b00a79fe94b2538d1b1dfc404b3262
SHA1 (patch-include_elf_common.h) = 60e8ee09e6c4727af20686808a637e6d84758e5a
SHA1 (patch-include_elf_epiphany.h) = da39a3ee5e6b4b0d3255bfef95601890afd80709
SHA1 (patch-include_opcode_bfin.h) = da39a3ee5e6b4b0d3255bfef95601890afd80709
SHA1 (patch-intl_Makefile.in) = cb9c50bbdfc086a59a549799254365a27d52feec
SHA1 (patch-libctf_swap.h) = b4755fa27f4d3d98aec03ea4c13a8e3985496d8b
SHA1 (patch-sim_ppc_emul_netbsd.c) = 34fcb884c3c82e8eae6cd6f8c87ce42e9354c347
SHA1 (patch-libiberty_make-temp-file.c) = 6e5c3fc9dde722a263cdbe3d51a714538a0c6cd1
SHA1 (patch-libiberty_strerror.c) = 16ffa959c95aed579747566cc9ce7d80a1435432
SHA1 (patch-opcodes_cgen.sh) = ace9d4c93194da654e27af63d045c3220879ade6
SHA1 (patch-readline_display.c) = daa5bd3dc68c2ef4f5b5cfb412df888317d92c8b
SHA1 (patch-readline_doc_texi2dvi) = dc857093f77a95413151a54e1186322f98f6c489
SHA1 (patch-readline_doc_texi2html) = ec274dc687f2ba70a287b2fc0bc7bade9a5c12f2
SHA1 (patch-readline_examples_readlinebuf.h) = 11b00683f95d77092fc8b7b701c7bfcaf40ca01c
SHA1 (patch-readline_examples_rlfe_config.h.in) = 69f34cc628efe30542248e7ac7458be59d5fab94
SHA1 (patch-readline_examples_rlfe_extern.h) = 69f34cc628efe30542248e7ac7458be59d5fab94
SHA1 (patch-readline_examples_rlfe_os.h) = 69f34cc628efe30542248e7ac7458be59d5fab94
SHA1 (patch-readline_rltty.c) = ffaa8b2d8acd01cfc2f6c087c72f897a976bcbd9
SHA1 (patch-readline_support_config.guess) = bbb5df37baf85c8d5ca80acee340af3bab341936
SHA1 (patch-readline_support_config.sub) = cb78431c434b1a727c56a368cc02099f63e21fd5
SHA1 (patch-readline_terminal.c) = f68a1f69c2e1fde60ed07e76635ec56c68766cde
SHA1 (patch-readline_util.c) = 2012356216efe9416dc2fbc02d33c927640f2df4
SHA1 (patch-sim_common_callback.c) = ac55e639ed6ba51c5daef5fffccc3413abeb1df2
SHA1 (patch-sim_common_cgen.sh) = 2d3dba22472ae9b7b3fcf1462ce2f7870a837cff
SHA1 (patch-sim_common_genmloop.sh) = da39a3ee5e6b4b0d3255bfef95601890afd80709
SHA1 (patch-sim_common_gennltvals.sh) = da39a3ee5e6b4b0d3255bfef95601890afd80709
SHA1 (patch-sim_common_gentvals.sh) = da39a3ee5e6b4b0d3255bfef95601890afd80709
SHA1 (patch-sim_configure) = 438ab3cfdae78a73cd05a9689133bce8739562ef
SHA1 (patch-sim_cr16_configure) = da39a3ee5e6b4b0d3255bfef95601890afd80709
SHA1 (patch-sim_ft32_configure) = da39a3ee5e6b4b0d3255bfef95601890afd80709
SHA1 (patch-sim_lm32_ChangeLog) = da39a3ee5e6b4b0d3255bfef95601890afd80709
SHA1 (patch-sim_microblaze_configure) = da39a3ee5e6b4b0d3255bfef95601890afd80709
SHA1 (patch-sim_mips_Makefile.in) = 21db438aba5935cccc744b0f9d65992f32a9aa69
SHA1 (patch-sim_mn10300_Makefile.in) = 9ef75b2651ca1813b2a09dc7f327af4ee045458f
SHA1 (patch-sim_moxie_configure) = da39a3ee5e6b4b0d3255bfef95601890afd80709
SHA1 (patch-sim_ppc_emul__netbsd.c) = c89ffc38760acedb55c211f946c86dc12bdc6d4a
SHA1 (patch-sim_ppc_events.c) = a32cee946443c5f6ca4a6a1aab2ee2081d40472d
SHA1 (patch-sim_ppc_hw__memory.c) = 1bb1788515ac1aa90192a4d6680cff7363bcaddc
SHA1 (patch-sim_testsuite_sim_bfin_run-tests.sh) = da39a3ee5e6b4b0d3255bfef95601890afd80709
SHA1 (patch-sim_v850_Makefile.in) = 910357bba7ec1c97e0eba1286c31534a2746d854
SHA1 (patch-src-release.sh) = da39a3ee5e6b4b0d3255bfef95601890afd80709

View File

@ -1,32 +0,0 @@
$NetBSD: patch-Makefile.in,v 1.2 2016/04/14 08:40:44 fhajny Exp $
Do not install bfd and opcodes. Conflicts with devel/binutils.
--- Makefile.in.orig 2016-02-24 09:57:08.000000000 +0000
+++ Makefile.in
@@ -1596,7 +1596,6 @@ do-install-info:
.PHONY: install-info-host
-install-info-host: maybe-install-info-bfd
install-info-host: maybe-install-info-opcodes
install-info-host: maybe-install-info-binutils
install-info-host: maybe-install-info-bison
@@ -2482,8 +2481,6 @@ install:
.PHONY: install-host-nogcc
install-host-nogcc: \
- maybe-install-bfd \
- maybe-install-opcodes \
maybe-install-binutils \
maybe-install-bison \
maybe-install-cgen \
@@ -2530,8 +2527,6 @@ install-host-nogcc: \
.PHONY: install-host
install-host: \
- maybe-install-bfd \
- maybe-install-opcodes \
maybe-install-binutils \
maybe-install-bison \
maybe-install-cgen \

View File

@ -0,0 +1,127 @@
$NetBSD$
--- bfd/config.bfd.orig 2019-07-16 00:00:27.000000000 +0000
+++ bfd/config.bfd
@@ -178,6 +178,7 @@ hppa*) targ_archs=bfd_hppa_arch ;;
i[3-7]86) targ_archs=bfd_i386_arch ;;
ia16) targ_archs=bfd_i386_arch ;;
lm32) targ_archs=bfd_lm32_arch ;;
+m5200|m5407) targ_archs=bfd_m68k_arch ;;
m6811*|m68hc11*) targ_archs="bfd_m68hc11_arch bfd_m68hc12_arch bfd_m9s12x_arch bfd_m9s12xg_arch" ;;
m6812*|m68hc12*) targ_archs="bfd_m68hc12_arch bfd_m68hc11_arch bfd_m9s12x_arch bfd_m9s12xg_arch" ;;
m68*) targ_archs=bfd_m68k_arch ;;
@@ -241,6 +242,11 @@ case "${targ}" in
targ_selvecs="aarch64_elf64_be_vec arm_elf32_le_vec arm_elf32_be_vec"
want64=true
;;
+ aarch64-*-netbsd*)
+ targ_defvec=aarch64_elf64_le_vec
+ targ_selvecs="aarch64_elf64_be_vec arm_elf32_le_vec arm_elf32_be_vec"
+ want64=true
+ ;;
aarch64-*-fuchsia*)
targ_defvec=aarch64_elf64_le_vec
targ_selvecs="aarch64_elf64_be_vec arm_elf32_le_vec arm_elf32_be_vec"
@@ -261,6 +267,16 @@ case "${targ}" in
targ_selvecs="aarch64_elf64_le_vec aarch64_elf32_le_vec aarch64_elf32_be_vec arm_elf32_be_vec arm_elf32_le_vec"
want64=true
;;
+ aarch64-*-netbsd*)
+ targ_defvec=aarch64_elf64_le_vec
+ targ_selvecs="aarch64_elf64_be_vec aarch64_elf32_le_vec aarch64_elf32_be_vec arm_elf32_le_vec arm_elf32_be_vec"
+ want64=true
+ ;;
+ aarch64_be-*-netbsd*)
+ targ_defvec=aarch64_elf64_be_vec
+ targ_selvecs="aarch64_elf64_le_vec aarch64_elf32_le_vec aarch64_elf32_be_vec arm_elf32_be_vec arm_elf32_le_vec"
+ want64=true
+ ;;
alpha*-*-freebsd* | alpha*-*-kfreebsd*-gnu)
targ_defvec=alpha_elf64_fbsd_vec
targ_selvecs="alpha_elf64_vec alpha_ecoff_le_vec"
@@ -347,11 +363,11 @@ case "${targ}" in
targ64_selvecs="x86_64_elf32_nacl_vec x86_64_elf64_nacl_vec"
targ_archs="$targ_archs bfd_i386_arch"
;;
- armeb-*-netbsdelf*)
+ arm*eb-*-netbsdelf*)
targ_defvec=arm_elf32_be_vec
targ_selvecs="arm_elf32_le_vec"
;;
- arm-*-netbsdelf*)
+ arm*-*-netbsdelf*)
targ_defvec=arm_elf32_le_vec
targ_selvecs="arm_elf32_be_vec"
;;
@@ -820,6 +836,10 @@ case "${targ}" in
m68*-*-*)
targ_defvec=m68k_elf32_vec
;;
+ m68*-*-netbsdelf* | m5407-*-netbsdelf*)
+ targ_defvec=m68k_elf32_vec
+ targ_selvecs="m68k_aout_nbsd_vec m68k_aout_4knbsd_vec m68k_aout_hp300bsd_vec sparc_aout_sunos_be_vec"
+ ;;
s12z-*-*)
targ_defvec=s12z_elf32_vec
@@ -853,14 +873,35 @@ case "${targ}" in
targ_selvecs=microblaze_elf32_le_vec
;;
+ mips*-big-*)
+ targ_defvec=mips_ecoff_be_vec
+ targ_selvecs=mips_ecoff_le_vec
+ ;;
+
+ mips*-dec-* | mips*el-*-ecoff*)
+ targ_defvec=mips_ecoff_le_vec
+ targ_selvecs=mips_ecoff_be_vec
+ ;;
+ mips*-*-ecoff*)
+ targ_defvec=mips_ecoff_be_vec
+ targ_selvecs=mips_ecoff_le_vec
+ ;;
#ifdef BFD64
+ mips64*el-*-netbsd*)
+ targ_defvec=mips_elf32_ntrad_le_vec
+ targ_selvecs="mips_elf32_ntrad_be_vec mips_elf32_trad_le_vec mips_elf32_trad_be_vec mips_elf64_trad_le_vec mips_elf64_trad_be_vec"
+ ;;
+ mips64*-*-netbsd*)
+ targ_defvec=mips_elf32_ntrad_be_vec
+ targ_selvecs="mips_elf32_ntrad_le_vec mips_elf32_trad_be_vec mips_elf32_trad_le_vec mips_elf64_trad_be_vec mips_elf64_trad_le_vec"
+ ;;
mips*el-*-netbsd*)
targ_defvec=mips_elf32_trad_le_vec
- targ_selvecs="mips_elf32_trad_be_vec mips_elf64_trad_be_vec mips_elf64_trad_le_vec mips_ecoff_le_vec mips_ecoff_be_vec"
+ targ_selvecs="mips_elf32_trad_be_vec mips_elf32_ntrad_le_vec mips_elf32_ntrad_be_vec mips_elf64_trad_be_vec mips_elf64_trad_le_vec mips_ecoff_le_vec mips_ecoff_be_vec"
;;
mips*-*-netbsd*)
targ_defvec=mips_elf32_trad_be_vec
- targ_selvecs="mips_elf32_trad_le_vec mips_elf64_trad_be_vec mips_elf64_trad_le_vec mips_ecoff_be_vec mips_ecoff_le_vec"
+ targ_selvecs="mips_elf32_trad_le_vec mips_elf32_ntrad_be_vec mips_elf32_ntrad_le_vec mips_elf64_trad_le_vec mips_elf64_trad_be_vec mips_ecoff_be_vec mips_ecoff_le_vec"
;;
mips*-*-irix6*)
targ_defvec=mips_elf32_n_be_vec
@@ -902,6 +943,22 @@ case "${targ}" in
targ_defvec=mips_elf32_be_vec
targ_selvecs="mips_elf32_le_vec mips_elf64_be_vec mips_elf64_le_vec"
;;
+ mips64*el-*-netbsd*)
+ targ_defvec=mips_elf32_ntrad_le_vec
+ targ_selvecs="mips_elf32_ntrad_be_vec mips_elf32_trad_le_vec mips_elf32_trad_be_vec mips_elf64_trad_le_vec mips_elf64_trad_be_vec"
+ ;;
+ mips64*-*-netbsd*)
+ targ_defvec=mips_elf32_ntrad_be_vec
+ targ_selvecs="mips_elf32_ntrad_le_vec mips_elf32_trad_be_vec mips_elf32_trad_le_vec mips_elf64_trad_be_vec mips_elf64_trad_le_vec"
+ ;;
+ mips*el-*-netbsd*)
+ targ_defvec=mips_elf32_trad_le_vec
+ targ_selvecs="mips_elf32_trad_be_vec mips_elf32_ntrad_le_vec mips_elf32_ntrad_be_vec mips_elf64_trad_be_vec mips_elf64_trad_le_vec mips_ecoff_le_vec mips_ecoff_be_vec"
+ ;;
+ mips*-*-netbsd*)
+ targ_defvec=mips_elf32_trad_be_vec
+ targ_selvecs="mips_elf32_trad_le_vec mips_elf32_ntrad_be_vec mips_elf32_ntrad_le_vec mips_elf64_trad_le_vec mips_elf64_trad_be_vec mips_ecoff_be_vec mips_ecoff_le_vec"
+ ;;
mips64*-*-openbsd*)
targ_defvec=mips_elf64_trad_be_vec
targ_selvecs="mips_elf32_ntrad_le_vec mips_elf32_ntrad_be_vec mips_elf32_trad_le_vec mips_elf32_trad_be_vec mips_elf64_trad_le_vec"

View File

@ -0,0 +1,39 @@
$NetBSD$
--- bfd/configure.orig 2019-07-16 00:00:27.000000000 +0000
+++ bfd/configure
@@ -474,6 +474,7 @@ as_cr_alnum=$as_cr_Letters$as_cr_digits
as_lineno_2=$LINENO as_lineno_2a=$LINENO
eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" &&
test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || {
+ as_me=bfd_$as_me # XXX don't overwrite our caller's configure.lineno
# Blame Lee E. McMahon (1931-1989) for sed's syntax. :-)
sed -n '
p
@@ -12461,7 +12462,7 @@ if test "${enable_secureplt+set}" = set;
*) as_fn_error $? "bad value ${enableval} for secureplt option" "$LINENO" 5 ;;
esac
else
- use_secureplt=true
+ use_secureplt=false
fi
if test $use_secureplt = true; then
@@ -15116,7 +15117,7 @@ if test "${target}" = "${host}"; then
;;
arm-*-freebsd* | arm-*-kfreebsd*-gnu)
COREFILE='' ;;
- arm-*-netbsd* | arm-*-openbsd*)
+ arm*-*-netbsd* | arm-*-openbsd*)
COREFILE=netbsd-core.lo
;;
arm-*-riscix) COREFILE=trad-core.lo ;;
@@ -15177,7 +15178,7 @@ if test "${target}" = "${host}"; then
;;
i[3-7]86-*-isc*) COREFILE=trad-core.lo ;;
i[3-7]86-*-aix*) COREFILE=aix386-core.lo ;;
- mips-*-netbsd* | mips*-*-openbsd*)
+ mips*-*-netbsd* | mips*-*-openbsd*)
COREFILE=netbsd-core.lo
;;
mips-sgi-irix4*) COREFILE=irix-core.lo ;;

View File

@ -0,0 +1,13 @@
$NetBSD$
--- bfd/doc/Makefile.in.orig 2019-07-16 00:00:27.000000000 +0000
+++ bfd/doc/Makefile.in
@@ -538,6 +538,8 @@ clean-libtool:
-rm -rf .libs _libs
bfd.info: bfd.texi $(bfd_TEXINFOS)
+ @echo "NOT REBUILDING $@"
+NetBSD_DISABLED_bfd.info:
$(AM_V_MAKEINFO)restore=: && backupdir="$(am__leading_dot)am$$$$" && \
rm -rf $$backupdir && mkdir $$backupdir && \
if ($(MAKEINFO) --version) >/dev/null 2>&1; then \

View File

@ -0,0 +1,12 @@
$NetBSD$
--- bfd/elf.c.orig 2019-07-16 00:00:27.000000000 +0000
+++ bfd/elf.c
@@ -10582,6 +10582,7 @@ elfcore_grok_netbsd_note (bfd *abfd, Elf
/* On the Alpha, SPARC (32-bit and 64-bit), PT_GETREGS == mach+0 and
PT_GETFPREGS == mach+2. */
+ case bfd_arch_aarch64:
case bfd_arch_alpha:
case bfd_arch_sparc:
switch (note->type)

View File

@ -0,0 +1,13 @@
$NetBSD$
--- bfd/merge.c.orig 2019-07-16 00:00:27.000000000 +0000
+++ bfd/merge.c
@@ -338,7 +338,7 @@ sec_merge_emit (bfd *abfd, struct sec_me
/* Trailing alignment needed? */
off = sec->size - off;
- if (off != 0)
+ if (pad != NULL && off != 0)
{
BFD_ASSERT (off <= pad_len);
if (contents)

View File

@ -0,0 +1,13 @@
$NetBSD$
--- bfd/netbsd-core.c.orig 2019-07-16 00:00:27.000000000 +0000
+++ bfd/netbsd-core.c
@@ -275,7 +275,7 @@ const bfd_target core_netbsd_vec =
0, /* Symbol prefix. */
' ', /* ar_pad_char. */
16, /* ar_max_namelen. */
- 0, /* Match priority. */
+ 0, /* match priority. */
NO_GET64, NO_GETS64, NO_PUT64, /* 64 bit data. */
NO_GET, NO_GETS, NO_PUT, /* 32 bit data. */
NO_GET, NO_GETS, NO_PUT, /* 16 bit data. */

View File

@ -0,0 +1,13 @@
$NetBSD$
--- gdb/Makefile.in.orig 2019-07-16 00:00:27.000000000 +0000
+++ gdb/Makefile.in
@@ -2137,6 +2137,8 @@ ALLDEPFILES = \
aarch64-fbsd-tdep.c \
aarch64-linux-nat.c \
aarch64-linux-tdep.c \
+ aarch64-nbsd-nat.c \
+ aarch64-nbsd-tdep.c \
aarch64-newlib-tdep.c \
aarch64-ravenscar-thread.c \
aarch64-tdep.c \

View File

@ -0,0 +1,188 @@
$NetBSD$
--- gdb/aarch64-nbsd-nat.c.orig 2019-09-02 20:02:23.493799588 +0000
+++ gdb/aarch64-nbsd-nat.c
@@ -0,0 +1,183 @@
+/* Native-dependent code for NetBSD/aarch64.
+
+ Copyright (C) 2017-2018 Free Software Foundation, Inc.
+
+ This file is part of GDB.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+#include "defs.h"
+#include "target.h"
+
+#include <sys/types.h>
+#include <sys/ptrace.h>
+
+#include <machine/frame.h>
+#include <machine/pcb.h>
+
+#include "nbsd-nat.h"
+#include "aarch64-tdep.h"
+#include "aarch64-nbsd-tdep.h"
+#include "regcache.h"
+#include "gdbcore.h"
+#include "bsd-kvm.h"
+#include "inf-ptrace.h"
+
+/* Determine if PT_GETREGS fetches REGNUM. */
+
+struct aarch64_nbsd_nat_target final : public nbsd_nat_target
+{
+ void fetch_registers (struct regcache *, int) override;
+ void store_registers (struct regcache *, int) override;
+};
+
+static aarch64_nbsd_nat_target the_aarch64_nbsd_nat_target;
+
+static bool
+getregs_supplies (struct gdbarch *gdbarch, int regnum)
+{
+ return (regnum >= AARCH64_X0_REGNUM && regnum <= AARCH64_CPSR_REGNUM);
+}
+
+/* Determine if PT_GETFPREGS fetches REGNUM. */
+
+static bool
+getfpregs_supplies (struct gdbarch *gdbarch, int regnum)
+{
+ return (regnum >= AARCH64_V0_REGNUM && regnum <= AARCH64_FPCR_REGNUM);
+}
+
+void
+aarch64_nbsd_nat_target::fetch_registers (struct regcache *regcache, int regnum)
+{
+ ptid_t ptid = regcache->ptid ();
+ pid_t pid = ptid.pid ();
+ int lwp = ptid.lwp ();
+
+ struct gdbarch *gdbarch = regcache->arch ();
+ if (regnum == -1 || getregs_supplies (gdbarch, regnum))
+ {
+ struct reg regs;
+
+ if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) &regs, lwp) == -1)
+ perror_with_name (_("Couldn't get registers"));
+
+ regcache_supply_regset (&aarch64_nbsd_gregset, regcache, regnum, &regs,
+ sizeof (regs));
+ }
+
+ if (regnum == -1 || getfpregs_supplies (gdbarch, regnum))
+ {
+ struct fpreg fpregs;
+
+ if (ptrace (PT_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, lwp) == -1)
+ perror_with_name (_("Couldn't get floating point status"));
+
+ regcache_supply_regset (&aarch64_nbsd_fpregset, regcache, regnum, &fpregs,
+ sizeof (fpregs));
+ }
+}
+
+/* Store register REGNUM back into the inferior. If REGNUM is -1, do
+ this for all registers. */
+
+void
+aarch64_nbsd_nat_target::store_registers (struct regcache *regcache, int regnum)
+{
+ ptid_t ptid = regcache->ptid ();
+ pid_t pid = ptid.pid ();
+ int lwp = ptid.lwp ();
+
+ struct gdbarch *gdbarch = regcache->arch ();
+ if (regnum == -1 || getregs_supplies (gdbarch, regnum))
+ {
+ struct reg regs;
+
+ if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) &regs, lwp) == -1)
+ perror_with_name (_("Couldn't get registers"));
+
+ regcache_collect_regset (&aarch64_nbsd_gregset, regcache,regnum, &regs,
+ sizeof (regs));
+
+ if (ptrace (PT_SETREGS, pid, (PTRACE_TYPE_ARG3) &regs, lwp) == -1)
+ perror_with_name (_("Couldn't write registers"));
+ }
+
+ if (regnum == -1 || getfpregs_supplies (gdbarch, regnum))
+ {
+ struct fpreg fpregs;
+
+ if (ptrace (PT_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, lwp) == -1)
+ perror_with_name (_("Couldn't get floating point status"));
+
+ regcache_collect_regset (&aarch64_nbsd_fpregset, regcache,regnum, &fpregs,
+ sizeof (fpregs));
+
+ if (ptrace (PT_SETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, lwp) == -1)
+ perror_with_name (_("Couldn't write floating point status"));
+ }
+}
+
+static int
+aarch64_nbsd_supply_pcb (struct regcache *regcache, struct pcb *pcb)
+{
+ struct trapframe tf;
+ int i;
+
+ /* The following is true for NetBSD/arm64:
+
+ The pcb contains the frame pointer at the point of the context
+ switch in cpu_switchto(). At that point we have a stack frame as
+ described by `struct trapframe', which has the following layout:
+
+ x0..x30
+ sp
+ pc
+ spsr
+ tpidr
+
+ This accounts for all callee-saved registers specified by the psABI.
+ From this information we reconstruct the register state as it would
+ look when we just returned from cpu_switchto().
+
+ For kernel core dumps, dumpsys() builds a fake trapframe for us. */
+
+ /* The trapframe pointer shouldn't be zero. */
+ if (pcb->pcb_tf == 0)
+ return 0;
+
+ /* Read the stack frame, and check its validity. */
+ read_memory ((uintptr_t)pcb->pcb_tf, (gdb_byte *) &tf, sizeof tf);
+
+ for (i = 0; i <= 30; i++)
+ {
+ regcache->raw_supply (AARCH64_X0_REGNUM + i, &tf.tf_reg[i]);
+ }
+ regcache->raw_supply (AARCH64_SP_REGNUM, &tf.tf_sp);
+ regcache->raw_supply (AARCH64_PC_REGNUM, &tf.tf_pc);
+
+ regcache->raw_supply (AARCH64_FPCR_REGNUM, &pcb->pcb_fpregs.fpcr);
+ regcache->raw_supply (AARCH64_FPSR_REGNUM, &pcb->pcb_fpregs.fpsr);
+
+ return 1;
+}
+
+void
+_initialize_aarch64_nbsd_nat (void)
+{
+ add_inf_child_target (&the_aarch64_nbsd_nat_target);
+
+ /* Support debugging kernel virtual memory images. */
+ bsd_kvm_add_target (aarch64_nbsd_supply_pcb);
+}

View File

@ -0,0 +1,207 @@
$NetBSD$
--- gdb/aarch64-nbsd-tdep.c.orig 2019-09-02 20:02:23.494088395 +0000
+++ gdb/aarch64-nbsd-tdep.c
@@ -0,0 +1,202 @@
+/* Target-dependent code for NetBSD/aarch64.
+
+ Copyright (C) 2017-2018 Free Software Foundation, Inc.
+
+ This file is part of GDB.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+#include "defs.h"
+
+#include "gdbarch.h"
+#include "nbsd-tdep.h"
+#include "aarch64-tdep.h"
+#include "aarch64-nbsd-tdep.h"
+#include "osabi.h"
+#include "solib-svr4.h"
+#include "target.h"
+#include "tramp-frame.h"
+#include "trad-frame.h"
+
+/* In a signal frame, sp points to a 'struct sigframe' which is
+ defined as:
+
+ struct sigframe {
+ siginfo_t sf_si;
+ ucontext_t sf_uc;
+ };
+
+ ucontext_t is defined as:
+
+ struct __ucontext {
+ sigset_t uc_sigmask;
+ mcontext_t uc_mcontext;
+ ...
+ };
+
+ The mcontext_t contains the general purpose register set followed
+ by the floating point register set. The floating point register
+ set is only valid if the _MC_FP_VALID flag is set in mc_flags. */
+
+#define AARCH64_MCONTEXT_REG_SIZE 8
+#define AARCH64_MCONTEXT_FPREG_SIZE 16
+#define AARCH64_SIGFRAME_UCONTEXT_OFFSET 80
+#define AARCH64_UCONTEXT_MCONTEXT_OFFSET 16
+#define AARCH64_MCONTEXT_FPREGS_OFFSET 272
+#define AARCH64_MCONTEXT_FLAGS_OFFSET 800
+#define AARCH64_MCONTEXT_FLAG_FP_VALID 0x1
+
+/* Implement the "init" method of struct tramp_frame. */
+
+static void
+aarch64_nbsd_sigframe_init (const struct tramp_frame *self,
+ struct frame_info *this_frame,
+ struct trad_frame_cache *this_cache,
+ CORE_ADDR func)
+{
+ struct gdbarch *gdbarch = get_frame_arch (this_frame);
+ enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
+ CORE_ADDR sp = get_frame_register_unsigned (this_frame, AARCH64_SP_REGNUM);
+ CORE_ADDR mcontext_addr =
+ sp
+ + AARCH64_SIGFRAME_UCONTEXT_OFFSET
+ + AARCH64_UCONTEXT_MCONTEXT_OFFSET;
+ gdb_byte buf[4];
+ int i;
+
+ for (i = 0; i < 30; i++)
+ {
+ trad_frame_set_reg_addr (this_cache,
+ AARCH64_X0_REGNUM + i,
+ mcontext_addr + i * AARCH64_MCONTEXT_REG_SIZE);
+ }
+ trad_frame_set_reg_addr (this_cache, AARCH64_LR_REGNUM,
+ mcontext_addr + 30 * AARCH64_MCONTEXT_REG_SIZE);
+ trad_frame_set_reg_addr (this_cache, AARCH64_SP_REGNUM,
+ mcontext_addr + 31 * AARCH64_MCONTEXT_REG_SIZE);
+ trad_frame_set_reg_addr (this_cache, AARCH64_PC_REGNUM,
+ mcontext_addr + 32 * AARCH64_MCONTEXT_REG_SIZE);
+ trad_frame_set_reg_addr (this_cache, AARCH64_CPSR_REGNUM,
+ mcontext_addr + 33 * AARCH64_MCONTEXT_REG_SIZE);
+
+ if (target_read_memory (mcontext_addr + AARCH64_MCONTEXT_FLAGS_OFFSET, buf,
+ 4) == 0
+ && (extract_unsigned_integer (buf, 4, byte_order)
+ & AARCH64_MCONTEXT_FLAG_FP_VALID))
+ {
+ for (i = 0; i < 32; i++)
+ {
+ trad_frame_set_reg_addr (this_cache, AARCH64_V0_REGNUM + i,
+ mcontext_addr
+ + AARCH64_MCONTEXT_FPREGS_OFFSET
+ + i * AARCH64_MCONTEXT_FPREG_SIZE);
+ }
+ trad_frame_set_reg_addr (this_cache, AARCH64_FPSR_REGNUM,
+ mcontext_addr + AARCH64_MCONTEXT_FPREGS_OFFSET
+ + 32 * AARCH64_MCONTEXT_FPREG_SIZE);
+ trad_frame_set_reg_addr (this_cache, AARCH64_FPCR_REGNUM,
+ mcontext_addr + AARCH64_MCONTEXT_FPREGS_OFFSET
+ + 32 * AARCH64_MCONTEXT_FPREG_SIZE + 4);
+ }
+
+ trad_frame_set_id (this_cache, frame_id_build (sp, func));
+}
+
+static const struct tramp_frame aarch64_nbsd_sigframe =
+{
+ SIGTRAMP_FRAME,
+ 4,
+ {
+ {0x910003e0, ULONGEST_MAX}, /* mov x0, sp */
+ {0x91014000, ULONGEST_MAX}, /* add x0, x0, #SF_UC */
+ {0xd2803428, ULONGEST_MAX}, /* mov x8, #SYS_sigreturn */
+ {0xd4000001, ULONGEST_MAX}, /* svc 0x0 */
+ {(ULONGEST)TRAMP_SENTINEL_INSN, ULONGEST_MAX}
+ },
+ aarch64_nbsd_sigframe_init
+};
+
+/* Register maps. */
+
+static const struct regcache_map_entry aarch64_nbsd_gregmap[] =
+ {
+ { 30, AARCH64_X0_REGNUM, 8 }, /* x0 ... x29 */
+ { 1, AARCH64_LR_REGNUM, 8 },
+ { 1, AARCH64_SP_REGNUM, 8 },
+ { 1, AARCH64_PC_REGNUM, 8 },
+ { 1, AARCH64_CPSR_REGNUM, 4 },
+ { 0 }
+ };
+
+static const struct regcache_map_entry aarch64_nbsd_fpregmap[] =
+ {
+ { 32, AARCH64_V0_REGNUM, 16 }, /* v0 ... v31 */
+ { 1, AARCH64_FPSR_REGNUM, 4 },
+ { 1, AARCH64_FPCR_REGNUM, 4 },
+ { 0 }
+ };
+
+/* Register set definitions. */
+
+const struct regset aarch64_nbsd_gregset =
+ {
+ aarch64_nbsd_gregmap,
+ regcache_supply_regset, regcache_collect_regset
+ };
+
+const struct regset aarch64_nbsd_fpregset =
+ {
+ aarch64_nbsd_fpregmap,
+ regcache_supply_regset, regcache_collect_regset
+ };
+
+/* Implement the "regset_from_core_section" gdbarch method. */
+
+static void
+aarch64_nbsd_iterate_over_regset_sections (struct gdbarch *gdbarch,
+ iterate_over_regset_sections_cb *cb,
+ void *cb_data,
+ const struct regcache *regcache)
+{
+ cb (".reg", AARCH64_NBSD_SIZEOF_GREGSET, AARCH64_NBSD_SIZEOF_GREGSET,
+ &aarch64_nbsd_gregset, NULL, cb_data);
+ cb (".reg2", AARCH64_NBSD_SIZEOF_FPREGSET, AARCH64_NBSD_SIZEOF_FPREGSET,
+ &aarch64_nbsd_fpregset, NULL, cb_data);
+}
+
+/* Implement the 'init_osabi' method of struct gdb_osabi_handler. */
+
+static void
+aarch64_nbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
+{
+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+
+ set_solib_svr4_fetch_link_map_offsets (gdbarch,
+ svr4_lp64_fetch_link_map_offsets);
+
+ tramp_frame_prepend_unwinder (gdbarch, &aarch64_nbsd_sigframe);
+
+ /* Enable longjmp. */
+ tdep->jb_pc = 13;
+
+ set_gdbarch_iterate_over_regset_sections
+ (gdbarch, aarch64_nbsd_iterate_over_regset_sections);
+}
+
+void
+_initialize_aarch64_nbsd_tdep (void)
+{
+ gdbarch_register_osabi (bfd_arch_aarch64, 0, GDB_OSABI_NETBSD,
+ aarch64_nbsd_init_abi);
+}

View File

@ -0,0 +1,38 @@
$NetBSD$
--- gdb/aarch64-nbsd-tdep.h.orig 2019-09-02 20:02:23.494326453 +0000
+++ gdb/aarch64-nbsd-tdep.h
@@ -0,0 +1,33 @@
+/* NetBSD/aarch64 target support, prototypes.
+
+ Copyright (C) 2017-2018 Free Software Foundation, Inc.
+
+ This file is part of GDB.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+#include "regset.h"
+
+/* The general-purpose regset consists of 31 registers (30 X , plus LR), SP,
+ ELR (PC), SPSR register, and TPIDR. SPSR is 32 bits but the structure is
+ passed to 64 bit alignment. */
+#define AARCH64_NBSD_SIZEOF_GREGSET (35 * X_REGISTER_SIZE)
+
+/* The fp regset consists of 32 V registers, plus FPSR and FPCR which
+ are 4 bytes wide each, and the whole structure is padded to 128 bit
+ alignment. */
+#define AARCH64_NBSD_SIZEOF_FPREGSET (33 * V_REGISTER_SIZE)
+
+extern const struct regset aarch64_nbsd_gregset;
+extern const struct regset aarch64_nbsd_fpregset;

View File

@ -0,0 +1,132 @@
$NetBSD$
--- gdb/alpha-bsd-nat.c.orig 2019-07-16 00:00:27.000000000 +0000
+++ gdb/alpha-bsd-nat.c
@@ -33,17 +33,12 @@
#include <sys/procfs.h>
#endif
-#ifndef HAVE_GREGSET_T
-typedef struct reg gregset_t;
-#endif
-
-#ifndef HAVE_FPREGSET_T
-typedef struct fpreg fpregset_t;
-#endif
-
-#include "gregset.h"
-
+#ifdef __NetBSD__
+#include "nbsd-nat.h"
+struct alpha_bsd_nat_target final : public nbsd_nat_target
+#else
struct alpha_bsd_nat_target final : public inf_ptrace_target
+#endif
{
void fetch_registers (struct regcache *, int) override;
void store_registers (struct regcache *, int) override;
@@ -51,33 +46,6 @@ struct alpha_bsd_nat_target final : publ
static alpha_bsd_nat_target the_alpha_bsd_nat_target;
-/* Provide *regset() wrappers around the generic Alpha BSD register
- supply/fill routines. */
-
-void
-supply_gregset (struct regcache *regcache, const gregset_t *gregsetp)
-{
- alphabsd_supply_reg (regcache, (const char *) gregsetp, -1);
-}
-
-void
-fill_gregset (const struct regcache *regcache, gregset_t *gregsetp, int regno)
-{
- alphabsd_fill_reg (regcache, (char *) gregsetp, regno);
-}
-
-void
-supply_fpregset (struct regcache *regcache, const fpregset_t *fpregsetp)
-{
- alphabsd_supply_fpreg (regcache, (const char *) fpregsetp, -1);
-}
-
-void
-fill_fpregset (const struct regcache *regcache,
- fpregset_t *fpregsetp, int regno)
-{
- alphabsd_fill_fpreg (regcache, (char *) fpregsetp, regno);
-}
/* Determine if PT_GETREGS fetches this register. */
@@ -94,12 +62,15 @@ getregs_supplies (int regno)
void
alpha_bsd_nat_target::fetch_registers (struct regcache *regcache, int regno)
{
+ ptid_t ptid = regcache->ptid ();
+ pid_t pid = ptid.pid ();
+ int lwp = ptid.lwp ();
+
if (regno == -1 || getregs_supplies (regno))
{
struct reg gregs;
- if (ptrace (PT_GETREGS, regcache->ptid ().pid (),
- (PTRACE_TYPE_ARG3) &gregs, 0) == -1)
+ if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) &gregs, lwp) == -1)
perror_with_name (_("Couldn't get registers"));
alphabsd_supply_reg (regcache, (char *) &gregs, regno);
@@ -112,8 +83,7 @@ alpha_bsd_nat_target::fetch_registers (s
{
struct fpreg fpregs;
- if (ptrace (PT_GETFPREGS, regcache->ptid ().pid (),
- (PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
+ if (ptrace (PT_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, lwp) == -1)
perror_with_name (_("Couldn't get floating point status"));
alphabsd_supply_fpreg (regcache, (char *) &fpregs, regno);
@@ -126,17 +96,20 @@ alpha_bsd_nat_target::fetch_registers (s
void
alpha_bsd_nat_target::store_registers (struct regcache *regcache, int regno)
{
+ ptid_t ptid = regcache->ptid ();
+ pid_t pid = ptid.pid ();
+ int lwp = ptid.lwp ();
+
if (regno == -1 || getregs_supplies (regno))
{
struct reg gregs;
- if (ptrace (PT_GETREGS, regcache->ptid ().pid (),
- (PTRACE_TYPE_ARG3) &gregs, 0) == -1)
+ if (ptrace (PT_GETREGS, pid,
+ (PTRACE_TYPE_ARG3) &gregs, lwp) == -1)
perror_with_name (_("Couldn't get registers"));
alphabsd_fill_reg (regcache, (char *) &gregs, regno);
- if (ptrace (PT_SETREGS, regcache->ptid ().pid (),
- (PTRACE_TYPE_ARG3) &gregs, 0) == -1)
+ if (ptrace (PT_SETREGS, pid, (PTRACE_TYPE_ARG3) &gregs, lwp) == -1)
perror_with_name (_("Couldn't write registers"));
if (regno != -1)
@@ -148,14 +121,13 @@ alpha_bsd_nat_target::store_registers (s
{
struct fpreg fpregs;
- if (ptrace (PT_GETFPREGS, regcache->ptid ().pid (),
- (PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
+ if (ptrace (PT_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, lwp) == -1)
perror_with_name (_("Couldn't get floating point status"));
alphabsd_fill_fpreg (regcache, (char *) &fpregs, regno);
- if (ptrace (PT_SETFPREGS, regcache->ptid ().pid (),
- (PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
+ if (ptrace (PT_SETFPREGS, pid,
+ (PTRACE_TYPE_ARG3) &fpregs, lwp) == -1)
perror_with_name (_("Couldn't write floating point status"));
}
}

View File

@ -0,0 +1,184 @@
$NetBSD$
--- gdb/alpha-nbsd-tdep.c.orig 2019-07-16 00:00:27.000000000 +0000
+++ gdb/alpha-nbsd-tdep.c
@@ -28,13 +28,18 @@
#include "value.h"
#include "alpha-tdep.h"
-#include "alpha-bsd-tdep.h"
#include "nbsd-tdep.h"
#include "solib-svr4.h"
+#include "trad-frame.h"
+#include "frame-unwind.h"
+#include "tramp-frame.h"
#include "target.h"
/* Core file support. */
+/* Even though NetBSD/alpha used ELF since day one, it used the
+ traditional a.out-style core dump format before NetBSD 1.6. */
+
/* Sizeof `struct reg' in <machine/reg.h>. */
#define ALPHANBSD_SIZEOF_GREGS (32 * 8)
@@ -170,31 +175,95 @@ alphanbsd_iterate_over_regset_sections (
/* Signal trampolines. */
+static void
+alphanbsd_sigtramp_cache_init (const struct tramp_frame *,
+ struct frame_info *,
+ struct trad_frame_cache *,
+ CORE_ADDR);
/* Under NetBSD/alpha, signal handler invocations can be identified by the
designated code sequence that is used to return from a signal handler.
In particular, the return address of a signal handler points to the
- following code sequence:
+ following code sequences: */
+static const struct tramp_frame alphanbsd_sigtramp_sc1 = {
+ SIGTRAMP_FRAME,
+ 4,
+ {
+ { 0xa61e0000, 0xffffffff }, /* ldq a0, 0(sp) */
+ { 0x23de0010, 0xffffffff }, /* lda sp, 16(sp) */
+ { 0x201f0127, 0xffffffff }, /* lda v0, 295 */
+ { 0x00000083, 0xffffffff }, /* call_pal callsys */
+ { TRAMP_SENTINEL_INSN, ULONGEST_MAX }
+ },
+ alphanbsd_sigtramp_cache_init
+};
- ldq a0, 0(sp)
- lda sp, 16(sp)
- lda v0, 295(zero) # __sigreturn14
- call_pal callsys
-
- Each instruction has a unique encoding, so we simply attempt to match
- the instruction the PC is pointing to with any of the above instructions.
- If there is a hit, we know the offset to the start of the designated
- sequence and can then check whether we really are executing in the
- signal trampoline. If not, -1 is returned, otherwise the offset from the
- start of the return sequence is returned. */
-static const gdb_byte sigtramp_retcode[] =
-{
- 0x00, 0x00, 0x1e, 0xa6, /* ldq a0, 0(sp) */
- 0x10, 0x00, 0xde, 0x23, /* lda sp, 16(sp) */
- 0x27, 0x01, 0x1f, 0x20, /* lda v0, 295(zero) */
- 0x83, 0x00, 0x00, 0x00, /* call_pal callsys */
+/* The siginfo signal trampoline for NetBSD/alpha introduced in 2.0 */
+static const struct tramp_frame alphanbsd_sigtramp_si2 =
+{
+ SIGTRAMP_FRAME,
+ 4,
+ {
+ { 0x221e0080, ULONGEST_MAX }, /* lda a0,128(sp) */
+ { 0x201f0134, ULONGEST_MAX }, /* lda v0,308 */
+ { 0x00000083, ULONGEST_MAX }, /* callsys */
+ { 0x47e00410, ULONGEST_MAX }, /* mov v0,a0 */
+ { 0x201f0001, ULONGEST_MAX }, /* lda v0,1 */
+ { 0x00000083, ULONGEST_MAX }, /* callsys */
+ { TRAMP_SENTINEL_INSN, ULONGEST_MAX }
+ },
+ alphanbsd_sigtramp_cache_init
+};
+/* The siginfo signal trampoline for NetBSD/alpha introduced in 4.0 */
+static const struct tramp_frame alphanbsd_sigtramp_si4 =
+{
+ SIGTRAMP_FRAME,
+ 4,
+ {
+ { 0x27ba0000, 0xffff0000 },
+ { 0x23bd0000, 0xffff0000 }, /* ldgp gp,0(ra) */
+ { 0x221e0080, ULONGEST_MAX }, /* lda a0,128(sp) */
+ { 0x201f0134, ULONGEST_MAX }, /* lda v0,308 */
+ { 0x00000083, ULONGEST_MAX }, /* callsys */
+ { 0x221fffff, ULONGEST_MAX }, /* lda a0,-1 */
+ { 0x201f0001, ULONGEST_MAX }, /* lda v0,1 */
+ { 0x00000083, ULONGEST_MAX }, /* callsys */
+ { TRAMP_SENTINEL_INSN, ULONGEST_MAX }
+ },
+ alphanbsd_sigtramp_cache_init
};
-#define RETCODE_NWORDS 4
-#define RETCODE_SIZE (RETCODE_NWORDS * 4)
+
+static void
+alphanbsd_sigtramp_cache_init (const struct tramp_frame *self,
+ struct frame_info *this_frame,
+ struct trad_frame_cache *this_cache,
+ CORE_ADDR func)
+{
+ struct gdbarch *gdbarch = get_frame_arch (this_frame);
+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ CORE_ADDR addr, sp;
+ int i;
+
+ sp = get_frame_register_unsigned (this_frame, ALPHA_SP_REGNUM);
+
+ if (self == &alphanbsd_sigtramp_sc1) {
+ addr = sp;
+ } else {
+ addr = sp + 128 + 56;
+ }
+
+ for (i = 0; i < 32; i++, addr += ALPHA_REGISTER_SIZE)
+ {
+ trad_frame_set_reg_addr (this_cache, i, addr);
+ }
+ trad_frame_set_reg_addr (this_cache, ALPHA_PC_REGNUM, addr);
+
+ /* Construct the frame ID using the function start. */
+ trad_frame_set_id (this_cache, frame_id_build (sp, func));
+}
+
+#ifdef notyet
+#define RETCODE_NWORDS 4
+#define RETCODE_SIZE (RETCODE_NWORDS * 4)
static LONGEST
alphanbsd_sigtramp_offset (struct gdbarch *gdbarch, CORE_ADDR pc)
@@ -244,6 +313,7 @@ alphanbsd_sigcontext_addr (struct frame_
return 0;
return get_frame_base (get_next_frame (frame));
}
+#endif
static void
@@ -261,18 +331,24 @@ alphanbsd_init_abi (struct gdbarch_info
/* NetBSD/alpha does not provide single step support via ptrace(2); we
must use software single-stepping. */
set_gdbarch_software_single_step (gdbarch, alpha_software_single_step);
-
/* NetBSD/alpha has SVR4-style shared libraries. */
set_solib_svr4_fetch_link_map_offsets
(gdbarch, svr4_lp64_fetch_link_map_offsets);
+ set_gdbarch_skip_solib_resolver (gdbarch, nbsd_skip_solib_resolver);
+#ifdef notyet
tdep->dynamic_sigtramp_offset = alphanbsd_sigtramp_offset;
tdep->pc_in_sigtramp = alphanbsd_pc_in_sigtramp;
tdep->sigcontext_addr = alphanbsd_sigcontext_addr;
+#endif
tdep->jb_pc = 2;
tdep->jb_elt_size = 8;
+ tramp_frame_prepend_unwinder (gdbarch, &alphanbsd_sigtramp_sc1);
+ tramp_frame_prepend_unwinder (gdbarch, &alphanbsd_sigtramp_si2);
+ tramp_frame_prepend_unwinder (gdbarch, &alphanbsd_sigtramp_si4);
+
set_gdbarch_iterate_over_regset_sections
(gdbarch, alphanbsd_iterate_over_regset_sections);
}
@@ -281,9 +357,6 @@ alphanbsd_init_abi (struct gdbarch_info
void
_initialize_alphanbsd_tdep (void)
{
- /* Even though NetBSD/alpha used ELF since day one, it used the
- traditional a.out-style core dump format before NetBSD 1.6, but
- we don't support those. */
gdbarch_register_osabi (bfd_arch_alpha, 0, GDB_OSABI_NETBSD,
alphanbsd_init_abi);
}

View File

@ -0,0 +1,36 @@
$NetBSD$
--- gdb/alpha-tdep.c.orig 2019-07-16 00:00:27.000000000 +0000
+++ gdb/alpha-tdep.c
@@ -754,6 +754,31 @@ alpha_skip_prologue (struct gdbarch *gdb
return pc + offset;
}
+/* GNU ld for alpha is so clever that the redundant GP load in function
+ entrypoint is skipped. We must therefore skip initial GP loads; otherwise
+ breakpoints in function entrypoints can also be skipped. */
+
+static CORE_ADDR
+alpha_skip_entrypoint (struct gdbarch *gdbarch, CORE_ADDR pc)
+{
+ unsigned long inst;
+ gdb_byte buf[ALPHA_INSN_SIZE];
+
+ /* Refer to the comment in alpha_skip_prologue above. */
+ if (target_read_memory (pc, buf, sizeof (buf)))
+ return pc;
+
+ /* Skip a GP load in the first two words in the function entrypoint. */
+ inst = alpha_read_insn (gdbarch, pc);
+ if ((inst & 0xffff0000) != 0x27bb0000) /* ldah $gp,n($t12) */
+ return pc;
+ inst = alpha_read_insn (gdbarch, pc + ALPHA_INSN_SIZE);
+ if ((inst & 0xffff0000) != 0x23bd0000) /* lda $gp,n($gp) */
+ return pc;
+
+ return pc + 2 * ALPHA_INSN_SIZE;
+}
+
static const int ldl_l_opcode = 0x2a;
static const int ldq_l_opcode = 0x2b;

View File

@ -0,0 +1,75 @@
$NetBSD$
--- gdb/amd64-bsd-nat.c.orig 2019-07-16 00:00:27.000000000 +0000
+++ gdb/amd64-bsd-nat.c
@@ -51,7 +51,7 @@ amd64bsd_fetch_inferior_registers (struc
{
struct reg regs;
- if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) &regs, 0) == -1)
+ if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) &regs, inferior_ptid.lwp ()) == -1)
perror_with_name (_("Couldn't get registers"));
amd64_supply_native_gregset (regcache, &regs, -1);
@@ -95,7 +95,7 @@ amd64bsd_fetch_inferior_registers (struc
if (x86bsd_xsave_len != 0)
{
xstateregs = alloca (x86bsd_xsave_len);
- if (ptrace (PT_GETXSTATE, pid, (PTRACE_TYPE_ARG3) xstateregs, 0)
+ if (ptrace (PT_GETXSTATE, pid, (PTRACE_TYPE_ARG3) xstateregs, inferior_ptid.lwp ())
== -1)
perror_with_name (_("Couldn't get extended state status"));
@@ -104,7 +104,7 @@ amd64bsd_fetch_inferior_registers (struc
}
#endif
- if (ptrace (PT_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
+ if (ptrace (PT_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, inferior_ptid.lwp ()) == -1)
perror_with_name (_("Couldn't get floating point status"));
amd64_supply_fxsave (regcache, -1, &fpregs);
@@ -127,12 +127,12 @@ amd64bsd_store_inferior_registers (struc
{
struct reg regs;
- if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) &regs, 0) == -1)
+ if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) &regs, inferior_ptid.lwp ()) == -1)
perror_with_name (_("Couldn't get registers"));
amd64_collect_native_gregset (regcache, &regs, regnum);
- if (ptrace (PT_SETREGS, pid, (PTRACE_TYPE_ARG3) &regs, 0) == -1)
+ if (ptrace (PT_SETREGS, pid, (PTRACE_TYPE_ARG3) &regs, inferior_ptid.lwp ()) == -1)
perror_with_name (_("Couldn't write registers"));
if (regnum != -1)
@@ -179,11 +179,11 @@ amd64bsd_store_inferior_registers (struc
if (x86bsd_xsave_len != 0)
{
xstateregs = alloca (x86bsd_xsave_len);
- if (ptrace (PT_GETXSTATE, pid, (PTRACE_TYPE_ARG3) xstateregs, 0)
+ if (ptrace (PT_GETXSTATE, pid, (PTRACE_TYPE_ARG3) xstateregs, inferior_ptid.lwp ())
== -1)
perror_with_name (_("Couldn't get extended state status"));
- amd64_collect_xsave (regcache, regnum, xstateregs, 0);
+ amd64_collect_xsave (regcache, regnum, xstateregs, inferior_ptid.lwp ());
if (ptrace (PT_SETXSTATE, pid, (PTRACE_TYPE_ARG3) xstateregs,
x86bsd_xsave_len) == -1)
@@ -192,12 +192,12 @@ amd64bsd_store_inferior_registers (struc
}
#endif
- if (ptrace (PT_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
+ if (ptrace (PT_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, inferior_ptid.lwp ()) == -1)
perror_with_name (_("Couldn't get floating point status"));
amd64_collect_fxsave (regcache, regnum, &fpregs);
- if (ptrace (PT_SETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
+ if (ptrace (PT_SETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, inferior_ptid.lwp ()) == -1)
perror_with_name (_("Couldn't write floating point status"));
}
}

View File

@ -0,0 +1,81 @@
$NetBSD$
--- gdb/amd64-nbsd-nat.c.orig 2019-07-16 00:00:27.000000000 +0000
+++ gdb/amd64-nbsd-nat.c
@@ -24,6 +24,13 @@
#include "amd64-tdep.h"
#include "amd64-bsd-nat.h"
#include "amd64-nat.h"
+#include "regcache.h"
+#include "gdbcore.h"
+#include "bsd-kvm.h"
+
+#include <machine/frame.h>
+#include <machine/pcb.h>
+#include <machine/reg.h>
/* Mapping between the general-purpose registers in NetBSD/amd64
`struct reg' format and GDB's register cache layout for
@@ -54,6 +61,55 @@ static int amd64nbsd32_r_reg_offset[] =
15 * 8 /* %gs */
};
+static int
+amd64nbsd_supply_pcb (struct regcache *regcache, struct pcb *pcb)
+{
+ struct switchframe sf;
+
+ /* The following is true for NetBSD/amd64:
+
+ The pcb contains the stack pointer at the point of the context
+ switch in cpu_switchto(). At that point we have a stack frame as
+ described by `struct switchframe', which for NetBSD/amd64 has the
+ following layout:
+
+ interrupt level
+ %r15
+ %r14
+ %r13
+ %r12
+ %rbx
+ return address
+
+ Together with %rsp in the pcb, this accounts for all callee-saved
+ registers specified by the psABI. From this information we
+ reconstruct the register state as it would look when we just
+ returned from cpu_switchto().
+
+ For kernel core dumps, dumpsys() builds a fake switchframe for us. */
+
+ /* The stack pointer shouldn't be zero. */
+ if (pcb->pcb_rsp == 0)
+ return 0;
+
+ /* Read the stack frame, and check its validity. */
+ read_memory (pcb->pcb_rsp, (gdb_byte *) &sf, sizeof sf);
+ pcb->pcb_rsp += sizeof (struct switchframe);
+ regcache->raw_supply (12, &sf.sf_r12);
+ regcache->raw_supply (13, &sf.sf_r13);
+ regcache->raw_supply (14, &sf.sf_r14);
+ regcache->raw_supply (15, &sf.sf_r15);
+ regcache->raw_supply (AMD64_RBX_REGNUM, &sf.sf_rbx);
+ regcache->raw_supply (AMD64_RIP_REGNUM, &sf.sf_rip);
+
+ regcache->raw_supply (AMD64_RSP_REGNUM, &pcb->pcb_rsp);
+ regcache->raw_supply (AMD64_RBP_REGNUM, &pcb->pcb_rbp);
+ regcache->raw_supply (AMD64_FS_REGNUM, &pcb->pcb_fs);
+ regcache->raw_supply (AMD64_GS_REGNUM, &pcb->pcb_gs);
+
+ return 1;
+}
+
static amd64_bsd_nat_target<nbsd_nat_target> the_amd64_nbsd_nat_target;
void
@@ -64,4 +120,6 @@ _initialize_amd64nbsd_nat (void)
amd64_native_gregset64_reg_offset = amd64nbsd_r_reg_offset;
add_inf_child_target (&the_amd64_nbsd_nat_target);
+
+ bsd_kvm_add_target (amd64nbsd_supply_pcb);
}

View File

@ -0,0 +1,219 @@
$NetBSD$
--- gdb/amd64-nbsd-tdep.c.orig 2019-07-16 00:00:27.000000000 +0000
+++ gdb/amd64-nbsd-tdep.c
@@ -28,6 +28,8 @@
#include "gdbsupport/x86-xstate.h"
#include "nbsd-tdep.h"
#include "solib-svr4.h"
+#include "trad-frame.h"
+#include "frame-unwind.h"
/* Support for signal handlers. */
@@ -94,6 +96,196 @@ int amd64nbsd_r_reg_offset[] =
15 * 8 /* %gs */
};
+/* Kernel debugging support */
+static const int amd64nbsd_tf_reg_offset[] =
+{
+ 18 * 8, /* %rax */
+ 17 * 8, /* %rbx */
+ 10 * 8, /* %rcx */
+ 2 * 8, /* %rdx */
+ 1 * 8, /* %rsi */
+ 0 * 8, /* %rdi */
+ 16 * 8, /* %rbp */
+ 28 * 8, /* %rsp */
+ 4 * 8, /* %r8 .. */
+ 5 * 8,
+ 3 * 8,
+ 11 * 8,
+ 12 * 8,
+ 13 * 8,
+ 14 * 8,
+ 15 * 8, /* ... %r15 */
+ 25 * 8, /* %rip */
+ 27 * 8, /* %eflags */
+ 26 * 8, /* %cs */
+ 29 * 8, /* %ss */
+ 22 * 8, /* %ds */
+ 21 * 8, /* %es */
+ 20 * 8, /* %fs */
+ 19 * 8, /* %gs */
+};
+
+static struct trad_frame_cache *
+amd64nbsd_trapframe_cache(struct frame_info *this_frame, void **this_cache)
+{
+ struct trad_frame_cache *cache;
+ CORE_ADDR func, sp, addr;
+ ULONGEST cs = 0, rip = 0;
+ const char *name;
+ int i;
+ struct gdbarch *gdbarch = get_frame_arch (this_frame);
+ enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
+
+ if (*this_cache)
+ return (struct trad_frame_cache *)*this_cache;
+
+ cache = trad_frame_cache_zalloc (this_frame);
+ *this_cache = cache;
+
+ func = get_frame_func (this_frame);
+ sp = get_frame_register_unsigned (this_frame, AMD64_RSP_REGNUM);
+
+ find_pc_partial_function (func, &name, NULL, NULL);
+
+ /* There is an extra 'call' in the interrupt sequence - ignore the extra
+ * return address */
+
+ addr = sp;
+ if (name) {
+ if (strncmp (name, "Xintr", 5) == 0
+ || strncmp (name, "Xhandle", 7) == 0) {
+ addr += 8; /* It's an interrupt frame. */
+ }
+ }
+
+#ifdef DEBUG_TRAPFRAME
+ for (i = 0; i < 50; i++) {
+ cs = read_memory_unsigned_integer (addr + i * 8, 8, byte_order);
+ printf("%s i=%d r=%#jx\n", name, i, (intmax_t)cs);
+ }
+#endif
+
+ for (i = 0; i < ARRAY_SIZE (amd64nbsd_tf_reg_offset); i++)
+ if (amd64nbsd_tf_reg_offset[i] != -1)
+ trad_frame_set_reg_addr (cache, i, addr + amd64nbsd_tf_reg_offset[i]);
+
+ /* Read %cs and %rip when we have the addresses to hand */
+ cs = read_memory_unsigned_integer (addr
+ + amd64nbsd_tf_reg_offset[AMD64_CS_REGNUM], 8, byte_order);
+ rip = read_memory_unsigned_integer (addr
+ + amd64nbsd_tf_reg_offset[AMD64_RIP_REGNUM], 8, byte_order);
+
+#ifdef DEBUG_TRAPFRAME
+ printf("%s cs=%#jx rip=%#jx\n", name, (intmax_t)cs, (intmax_t)rip);
+#endif
+
+ /* The trap frame layout was changed lf the %rip value is less than 2^16 it
+ * is almost certainly the %ss of the old format. */
+ if (rip < (1 << 16))
+ {
+
+ for (i = 0; i < ARRAY_SIZE (amd64nbsd_tf_reg_offset); i++)
+ {
+
+ if (amd64nbsd_tf_reg_offset[i] == -1)
+ continue;
+
+ trad_frame_set_reg_addr (cache, i, addr + amd64nbsd_r_reg_offset[i]);
+
+ /* Read %cs when we have the address to hand */
+ if (i == AMD64_CS_REGNUM)
+ cs = read_memory_unsigned_integer (addr + amd64nbsd_r_reg_offset[i],
+ 8, byte_order);
+ }
+ }
+
+ if ((cs & I386_SEL_RPL) == I386_SEL_UPL ||
+ (name && strncmp(name, "Xsoft", 5) == 0))
+ {
+ /* Trap from user space or soft interrupt; terminate backtrace. */
+ trad_frame_set_id (cache, outer_frame_id);
+ }
+ else
+ {
+ /* Construct the frame ID using the function start. */
+ trad_frame_set_id (cache, frame_id_build (sp + 16, func));
+ }
+
+ return cache;
+}
+
+static void
+amd64nbsd_trapframe_this_id (struct frame_info *this_frame,
+ void **this_cache,
+ struct frame_id *this_id)
+{
+ struct trad_frame_cache *cache =
+ amd64nbsd_trapframe_cache (this_frame, this_cache);
+
+ trad_frame_get_id (cache, this_id);
+}
+
+static struct value *
+amd64nbsd_trapframe_prev_register (struct frame_info *this_frame,
+ void **this_cache, int regnum)
+{
+ struct trad_frame_cache *cache =
+ amd64nbsd_trapframe_cache (this_frame, this_cache);
+
+ return trad_frame_get_register (cache, this_frame, regnum);
+}
+
+static int
+amd64nbsd_trapframe_sniffer (const struct frame_unwind *self,
+ struct frame_info *this_frame,
+ void **this_prologue_cache)
+{
+ ULONGEST cs = 0;
+ const char *name;
+
+ try
+ {
+ cs = get_frame_register_unsigned (this_frame, AMD64_CS_REGNUM);
+ }
+ catch (gdb_exception_error &except)
+ {
+ if (except.reason < 0 && except.error != NOT_AVAILABLE_ERROR)
+ throw_exception (std::move (except));
+ }
+
+ if ((cs & I386_SEL_RPL) == I386_SEL_UPL)
+ return 0;
+
+ find_pc_partial_function (get_frame_pc (this_frame), &name, NULL, NULL);
+ return (name && ((strcmp (name, "alltraps") == 0)
+ || (strcmp (name, "calltrap") == 0)
+ || (strcmp (name, "handle_syscall") == 0)
+ || (strcmp (name, "Xdoreti") == 0)
+ || (strcmp (name, "Xspllower") == 0)
+ || (strncmp (name, "Xhandle", 7) == 0)
+ || (strncmp (name, "Xintr", 5) == 0)
+ || (strncmp (name, "Xpreempt", 8) == 0)
+ || (strncmp (name, "Xrecurse", 8) == 0)
+ || (strncmp (name, "Xresume", 7) == 0)
+ || (strncmp (name, "Xsoft", 5) == 0)
+ || (strncmp (name, "Xstray", 6) == 0)
+ || (strncmp (name, "Xsyscall", 8) == 0)
+ || (strncmp (name, "Xtrap", 5) == 0)
+ ));
+}
+
+static const struct frame_unwind amd64nbsd_trapframe_unwind = {
+ /* FIXME: kettenis/20051219: This really is more like an interrupt
+ frame, but SIGTRAMP_FRAME would print <signal handler called>,
+ which really is not what we want here. */
+ NORMAL_FRAME,
+ default_frame_unwind_stop_reason,
+ amd64nbsd_trapframe_this_id,
+ amd64nbsd_trapframe_prev_register,
+ NULL,
+ amd64nbsd_trapframe_sniffer
+};
+
static void
amd64nbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
{
@@ -118,6 +310,8 @@ amd64nbsd_init_abi (struct gdbarch_info
/* NetBSD uses SVR4-style shared libraries. */
set_solib_svr4_fetch_link_map_offsets
(gdbarch, svr4_lp64_fetch_link_map_offsets);
+ /* Unwind kernel trap frames correctly. */
+ frame_unwind_prepend_unwinder (gdbarch, &amd64nbsd_trapframe_unwind);
}
void

View File

@ -0,0 +1,568 @@
$NetBSD$
--- gdb/arm-nbsd-nat.c.orig 2019-07-16 00:00:27.000000000 +0000
+++ gdb/arm-nbsd-nat.c
@@ -1,5 +1,4 @@
-/* Native-dependent code for BSD Unix running on ARM's, for GDB.
-
+/*
Copyright (C) 1988-2019 Free Software Foundation, Inc.
This file is part of GDB.
@@ -17,20 +16,30 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
+#ifndef _KERNTYPES
+#define _KERNTYPES
+#endif
#include "defs.h"
#include "gdbcore.h"
#include "inferior.h"
#include "regcache.h"
#include "target.h"
+
+#include "nbsd-nat.h"
#include <sys/types.h>
#include <sys/ptrace.h>
#include <machine/reg.h>
#include <machine/frame.h>
+#include <arm/arm32/frame.h>
+
+/* Support for debugging kernel virtual memory images. */
+#include <machine/pcb.h>
#include "arm-tdep.h"
#include "inf-ptrace.h"
+#include "bsd-kvm.h"
-class arm_netbsd_nat_target final : public inf_ptrace_target
+class arm_nbsd_nat_target final : public nbsd_nat_target
{
public:
/* Add our register access methods. */
@@ -38,10 +47,60 @@ public:
void store_registers (struct regcache *, int) override;
};
-static arm_netbsd_nat_target the_arm_netbsd_nat_target;
+static arm_nbsd_nat_target the_arm_nbsd_nat_target;
extern int arm_apcs_32;
+#define FPSCR(r) ((char *) &(r)->fpr_vfp.vfp_fpscr)
+#define FPREG(r, regno) \
+ ((char *) (r)->fpr_vfp.vfp_regs + 8 * ((regno) - ARM_D0_REGNUM))
+
+static int
+armnbsd_supply_pcb (struct regcache *regcache, struct pcb *pcb)
+{
+ struct switchframe sf;
+
+ /* The following is true for NetBSD/arm32 in 5.0 and after:
+
+ The pcb contains r8-r13 (sp) at the point of context switch in
+ cpu_switchto() or call of dumpsys(). At that point we have a
+ stack frame as described by `struct switchframe', which for
+ NetBSD/arm32 has the following layout:
+
+ r4 ascending.
+ r5 |
+ r6 |
+ r7 \|/
+ old sp
+ pc
+
+ we reconstruct the register state as it would look when we just
+ returned from cpu_switchto() or dumpsys(). */
+
+ if (!arm_apcs_32)
+ return 0;
+
+ /* The stack pointer shouldn't be zero. */
+ if (pcb->pcb_sp == 0)
+ return 0;
+
+ read_memory (pcb->pcb_sp, (gdb_byte *) &sf, sizeof sf);
+
+ regcache->raw_supply (ARM_PC_REGNUM, &sf.sf_pc);
+ regcache->raw_supply (ARM_SP_REGNUM, &pcb->pcb_sp);
+ regcache->raw_supply (12, &pcb->pcb_r12);
+ regcache->raw_supply (11, &pcb->pcb_r11);
+ regcache->raw_supply (10, &pcb->pcb_r10);
+ regcache->raw_supply (9, &pcb->pcb_r9);
+ regcache->raw_supply (8, &pcb->pcb_r8);
+ regcache->raw_supply (7, &sf.sf_r7);
+ regcache->raw_supply (6, &sf.sf_r6);
+ regcache->raw_supply (5, &sf.sf_r5);
+ regcache->raw_supply (4, &sf.sf_r4);
+
+ return 1;
+}
+
static void
arm_supply_gregset (struct regcache *regcache, struct reg *gregset)
{
@@ -65,25 +124,26 @@ arm_supply_gregset (struct regcache *reg
}
static void
-arm_supply_fparegset (struct regcache *regcache, struct fpreg *fparegset)
+arm_supply_vfpregset (struct regcache *regcache, struct fpreg *vfpregset)
{
int regno;
- for (regno = ARM_F0_REGNUM; regno <= ARM_F7_REGNUM; regno++)
- regcache->raw_supply (regno,
- (char *) &fparegset->fpr[regno - ARM_F0_REGNUM]);
+ for (regno = ARM_D0_REGNUM; regno < 16 + ARM_D0_REGNUM; regno++)
+ regcache->raw_supply (regno, FPREG(vfpregset, regno));
- regcache->raw_supply (ARM_FPS_REGNUM, (char *) &fparegset->fpr_fpsr);
+ regcache->raw_supply (ARM_FPSCR_REGNUM, FPSCR(vfpregset));
}
static void
fetch_register (struct regcache *regcache, int regno)
{
- struct reg inferior_registers;
+ struct reg regs;
+ ptid_t ptid = regcache->ptid ();
+ pid_t pid = ptid.pid ();
+ int lwp = ptid.lwp ();
int ret;
- ret = ptrace (PT_GETREGS, regcache->ptid ().pid (),
- (PTRACE_TYPE_ARG3) &inferior_registers, 0);
+ ret = ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) &regs, lwp);
if (ret < 0)
{
@@ -94,32 +154,28 @@ fetch_register (struct regcache *regcach
switch (regno)
{
case ARM_SP_REGNUM:
- regcache->raw_supply (ARM_SP_REGNUM, (char *) &inferior_registers.r_sp);
+ regcache->raw_supply (ARM_SP_REGNUM, (char *) &regs.r_sp);
break;
case ARM_LR_REGNUM:
- regcache->raw_supply (ARM_LR_REGNUM, (char *) &inferior_registers.r_lr);
+ regcache->raw_supply (ARM_LR_REGNUM, (char *) &regs.r_lr);
break;
case ARM_PC_REGNUM:
/* This is ok: we're running native... */
- inferior_registers.r_pc = gdbarch_addr_bits_remove
- (regcache->arch (),
- inferior_registers.r_pc);
- regcache->raw_supply (ARM_PC_REGNUM, (char *) &inferior_registers.r_pc);
+ regs.r_pc = gdbarch_addr_bits_remove (regcache->arch (), regs.r_pc);
+ regcache->raw_supply (ARM_PC_REGNUM, (char *) &regs.r_pc);
break;
case ARM_PS_REGNUM:
if (arm_apcs_32)
- regcache->raw_supply (ARM_PS_REGNUM,
- (char *) &inferior_registers.r_cpsr);
+ regcache->raw_supply (ARM_PS_REGNUM, (char *) &regs.r_cpsr);
else
- regcache->raw_supply (ARM_PS_REGNUM,
- (char *) &inferior_registers.r_pc);
+ regcache->raw_supply (ARM_PS_REGNUM, (char *) &regs.r_pc);
break;
default:
- regcache->raw_supply (regno, (char *) &inferior_registers.r[regno]);
+ regcache->raw_supply (regno, (char *) &regs.r[regno]);
break;
}
}
@@ -127,12 +183,14 @@ fetch_register (struct regcache *regcach
static void
fetch_regs (struct regcache *regcache)
{
- struct reg inferior_registers;
+ ptid_t ptid = regcache->ptid ();
+ pid_t pid = ptid.pid ();
+ int lwp = ptid.lwp ();
+ struct reg regs;
int ret;
int regno;
- ret = ptrace (PT_GETREGS, regcache->ptid ().pid (),
- (PTRACE_TYPE_ARG3) &inferior_registers, 0);
+ ret = ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) &regs, lwp);
if (ret < 0)
{
@@ -140,17 +198,19 @@ fetch_regs (struct regcache *regcache)
return;
}
- arm_supply_gregset (regcache, &inferior_registers);
+ arm_supply_gregset (regcache, &regs);
}
static void
fetch_fp_register (struct regcache *regcache, int regno)
{
- struct fpreg inferior_fp_registers;
+ ptid_t ptid = regcache->ptid ();
+ pid_t pid = ptid.pid ();
+ int lwp = ptid.lwp ();
+ struct fpreg fpregs;
int ret;
- ret = ptrace (PT_GETFPREGS, regcache->ptid ().pid (),
- (PTRACE_TYPE_ARG3) &inferior_fp_registers, 0);
+ ret = ptrace (PT_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, lwp);
if (ret < 0)
{
@@ -160,14 +220,13 @@ fetch_fp_register (struct regcache *regc
switch (regno)
{
- case ARM_FPS_REGNUM:
- regcache->raw_supply (ARM_FPS_REGNUM,
- (char *) &inferior_fp_registers.fpr_fpsr);
+ case ARM_FPSCR_REGNUM:
+ regcache->raw_supply (ARM_FPSCR_REGNUM, FPSCR(&fpregs));
break;
default:
- regcache->raw_supply
- (regno, (char *) &inferior_fp_registers.fpr[regno - ARM_F0_REGNUM]);
+ regno += ARM_D0_REGNUM;
+ regcache->raw_supply (regno, FPREG(&fpregs, regno));
break;
}
}
@@ -175,20 +234,21 @@ fetch_fp_register (struct regcache *regc
static void
fetch_fp_regs (struct regcache *regcache)
{
- struct fpreg inferior_fp_registers;
+ ptid_t ptid = regcache->ptid ();
+ pid_t pid = ptid.pid ();
+ int lwp = ptid.lwp ();
+ struct fpreg fpregs;
int ret;
- int regno;
- ret = ptrace (PT_GETFPREGS, regcache->ptid ().pid (),
- (PTRACE_TYPE_ARG3) &inferior_fp_registers, 0);
+ ret = ptrace (PT_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, lwp);
if (ret < 0)
{
- warning (_("unable to fetch general registers"));
+ warning (_("unable to fetch floating-point registers"));
return;
}
- arm_supply_fparegset (regcache, &inferior_fp_registers);
+ arm_supply_vfpregset (regcache, &fpregs);
}
void
@@ -196,10 +256,10 @@ arm_nbsd_nat_target::fetch_registers (st
{
if (regno >= 0)
{
- if (regno < ARM_F0_REGNUM || regno > ARM_FPS_REGNUM)
- fetch_register (regcache, regno);
- else
+ if (regno >= ARM_D0_REGNUM && regno <= ARM_FPSCR_REGNUM)
fetch_fp_register (regcache, regno);
+ else
+ fetch_register (regcache, regno);
}
else
{
@@ -213,11 +273,13 @@ static void
store_register (const struct regcache *regcache, int regno)
{
struct gdbarch *gdbarch = regcache->arch ();
- struct reg inferior_registers;
+ struct reg regs;
int ret;
+ ptid_t ptid = regcache->ptid ();
+ pid_t pid = ptid.pid ();
+ int lwp = ptid.lwp ();
- ret = ptrace (PT_GETREGS, regcache->ptid ().pid (),
- (PTRACE_TYPE_ARG3) &inferior_registers, 0);
+ ret = ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) &regs, lwp);
if (ret < 0)
{
@@ -228,17 +290,16 @@ store_register (const struct regcache *r
switch (regno)
{
case ARM_SP_REGNUM:
- regcache->raw_collect (ARM_SP_REGNUM, (char *) &inferior_registers.r_sp);
+ regcache->raw_collect (ARM_SP_REGNUM, (char *) &regs.r_sp);
break;
case ARM_LR_REGNUM:
- regcache->raw_collect (ARM_LR_REGNUM, (char *) &inferior_registers.r_lr);
+ regcache->raw_collect (ARM_LR_REGNUM, (char *) &regs.r_lr);
break;
case ARM_PC_REGNUM:
if (arm_apcs_32)
- regcache->raw_collect (ARM_PC_REGNUM,
- (char *) &inferior_registers.r_pc);
+ regcache->raw_collect (ARM_PC_REGNUM, (char *) &regs.r_pc);
else
{
unsigned pc_val;
@@ -246,16 +307,14 @@ store_register (const struct regcache *r
regcache->raw_collect (ARM_PC_REGNUM, (char *) &pc_val);
pc_val = gdbarch_addr_bits_remove (gdbarch, pc_val);
- inferior_registers.r_pc ^= gdbarch_addr_bits_remove
- (gdbarch, inferior_registers.r_pc);
- inferior_registers.r_pc |= pc_val;
+ regs.r_pc ^= gdbarch_addr_bits_remove (gdbarch, regs.r_pc);
+ regs.r_pc |= pc_val;
}
break;
case ARM_PS_REGNUM:
if (arm_apcs_32)
- regcache->raw_collect (ARM_PS_REGNUM,
- (char *) &inferior_registers.r_cpsr);
+ regcache->raw_collect (ARM_PS_REGNUM, (char *) &regs.r_cpsr);
else
{
unsigned psr_val;
@@ -263,19 +322,17 @@ store_register (const struct regcache *r
regcache->raw_collect (ARM_PS_REGNUM, (char *) &psr_val);
psr_val ^= gdbarch_addr_bits_remove (gdbarch, psr_val);
- inferior_registers.r_pc = gdbarch_addr_bits_remove
- (gdbarch, inferior_registers.r_pc);
- inferior_registers.r_pc |= psr_val;
+ regs.r_pc = gdbarch_addr_bits_remove (gdbarch, regs.r_pc);
+ regs.r_pc |= psr_val;
}
break;
default:
- regcache->raw_collect (regno, (char *) &inferior_registers.r[regno]);
+ regcache->raw_collect (regno, (char *) &regs.r[regno]);
break;
}
- ret = ptrace (PT_SETREGS, regcache->ptid ().pid (),
- (PTRACE_TYPE_ARG3) &inferior_registers, 0);
+ ret = ptrace (PT_SETREGS, pid, (PTRACE_TYPE_ARG3) &regs, lwp);
if (ret < 0)
warning (_("unable to write register %d to inferior"), regno);
@@ -285,22 +342,24 @@ static void
store_regs (const struct regcache *regcache)
{
struct gdbarch *gdbarch = regcache->arch ();
- struct reg inferior_registers;
+ ptid_t ptid = regcache->ptid ();
+ pid_t pid = ptid.pid ();
+ int lwp = ptid.lwp ();
+ struct reg regs;
int ret;
int regno;
for (regno = ARM_A1_REGNUM; regno < ARM_SP_REGNUM; regno++)
- regcache->raw_collect (regno, (char *) &inferior_registers.r[regno]);
+ regcache->raw_collect (regno, (char *) &regs.r[regno]);
- regcache->raw_collect (ARM_SP_REGNUM, (char *) &inferior_registers.r_sp);
- regcache->raw_collect (ARM_LR_REGNUM, (char *) &inferior_registers.r_lr);
+ regcache->raw_collect (ARM_SP_REGNUM, (char *) &regs.r_sp);
+ regcache->raw_collect (ARM_LR_REGNUM, (char *) &regs.r_lr);
if (arm_apcs_32)
{
- regcache->raw_collect (ARM_PC_REGNUM, (char *) &inferior_registers.r_pc);
- regcache->raw_collect (ARM_PS_REGNUM,
- (char *) &inferior_registers.r_cpsr);
+ regcache->raw_collect (ARM_PC_REGNUM, (char *) &regs.r_pc);
+ regcache->raw_collect (ARM_PS_REGNUM, (char *) &regs.r_cpsr);
}
else
{
@@ -313,11 +372,10 @@ store_regs (const struct regcache *regca
pc_val = gdbarch_addr_bits_remove (gdbarch, pc_val);
psr_val ^= gdbarch_addr_bits_remove (gdbarch, psr_val);
- inferior_registers.r_pc = pc_val | psr_val;
+ regs.r_pc = pc_val | psr_val;
}
- ret = ptrace (PT_SETREGS, regcache->ptid ().pid (),
- (PTRACE_TYPE_ARG3) &inferior_registers, 0);
+ ret = ptrace (PT_SETREGS, pid, (PTRACE_TYPE_ARG3) &regs, lwp);
if (ret < 0)
warning (_("unable to store general registers"));
@@ -326,11 +384,13 @@ store_regs (const struct regcache *regca
static void
store_fp_register (const struct regcache *regcache, int regno)
{
- struct fpreg inferior_fp_registers;
+ struct fpreg fpregs;
+ ptid_t ptid = regcache->ptid ();
+ pid_t pid = ptid.pid ();
+ int lwp = ptid.lwp ();
int ret;
- ret = ptrace (PT_GETFPREGS, regcache->ptid ().pid (),
- (PTRACE_TYPE_ARG3) &inferior_fp_registers, 0);
+ ret = ptrace (PT_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, lwp);
if (ret < 0)
{
@@ -341,18 +401,15 @@ store_fp_register (const struct regcache
switch (regno)
{
case ARM_FPS_REGNUM:
- regcache->raw_collect (ARM_FPS_REGNUM,
- (char *) &inferior_fp_registers.fpr_fpsr);
+ regcache->raw_collect (ARM_FPS_REGNUM, FPSCR(&fpregs));
break;
default:
- regcache->raw_collect
- (regno, (char *) &inferior_fp_registers.fpr[regno - ARM_F0_REGNUM]);
+ regcache->raw_collect (regno, FPREG(&fpregs, regno));
break;
}
- ret = ptrace (PT_SETFPREGS, regcache->ptid ().pid (),
- (PTRACE_TYPE_ARG3) &inferior_fp_registers, 0);
+ ret = ptrace (PT_SETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, lwp);
if (ret < 0)
warning (_("unable to write register %d to inferior"), regno);
@@ -361,20 +418,20 @@ store_fp_register (const struct regcache
static void
store_fp_regs (const struct regcache *regcache)
{
- struct fpreg inferior_fp_registers;
+ ptid_t ptid = regcache->ptid ();
+ pid_t pid = ptid.pid ();
+ int lwp = ptid.lwp ();
+ struct fpreg fpregs;
int ret;
int regno;
- for (regno = ARM_F0_REGNUM; regno <= ARM_F7_REGNUM; regno++)
- regcache->raw_collect
- (regno, (char *) &inferior_fp_registers.fpr[regno - ARM_F0_REGNUM]);
+ for (regno = ARM_D0_REGNUM; regno < 16 + ARM_D0_REGNUM; regno++)
+ regcache->raw_collect (regno, FPREG(&fpregs, regno));
- regcache->raw_collect (ARM_FPS_REGNUM,
- (char *) &inferior_fp_registers.fpr_fpsr);
+ regcache->raw_collect (ARM_FPSCR_REGNUM, FPSCR(&fpregs));
- ret = ptrace (PT_SETFPREGS, regcache->ptid ().pid (),
- (PTRACE_TYPE_ARG3) &inferior_fp_registers, 0);
+ ret = ptrace (PT_SETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, lwp);
if (ret < 0)
warning (_("unable to store floating-point registers"));
@@ -385,10 +442,10 @@ arm_nbsd_nat_target::store_registers (st
{
if (regno >= 0)
{
- if (regno < ARM_F0_REGNUM || regno > ARM_FPS_REGNUM)
- store_register (regcache, regno);
- else
+ if (regno >= ARM_D0_REGNUM && regno <= ARM_FPSCR_REGNUM)
store_fp_register (regcache, regno);
+ else
+ store_register (regcache, regno);
}
else
{
@@ -397,13 +454,32 @@ arm_nbsd_nat_target::store_registers (st
}
}
+struct md_core
+{
+ struct reg intreg;
+ struct fpreg freg;
+};
+
+static void
+fetch_core_registers (struct regcache *regcache,
+ char *core_reg_sect, unsigned core_reg_size,
+ int which, CORE_ADDR ignore)
+{
+ struct md_core *core_reg = (struct md_core *) core_reg_sect;
+ int regno;
+ CORE_ADDR r_pc;
+
+ arm_supply_gregset (regcache, &core_reg->intreg);
+ arm_supply_vfpregset (regcache, &core_reg->freg);
+}
+
static void
fetch_elfcore_registers (struct regcache *regcache,
char *core_reg_sect, unsigned core_reg_size,
int which, CORE_ADDR ignore)
{
struct reg gregset;
- struct fpreg fparegset;
+ struct fpreg vfpregset;
switch (which)
{
@@ -426,8 +502,8 @@ fetch_elfcore_registers (struct regcache
{
/* The memcpy may be unnecessary, but we can't really be sure
of the alignment of the data in the core file. */
- memcpy (&fparegset, core_reg_sect, sizeof (fparegset));
- arm_supply_fparegset (regcache, &fparegset);
+ memcpy (&vfpregset, core_reg_sect, sizeof (vfpregset));
+ arm_supply_vfpregset (regcache, &vfpregset);
}
break;
@@ -437,9 +513,18 @@ fetch_elfcore_registers (struct regcache
}
}
+static struct core_fns arm_netbsd_core_fns =
+{
+ bfd_target_unknown_flavour, /* core_flavour. */
+ default_check_format, /* check_format. */
+ default_core_sniffer, /* core_sniffer. */
+ fetch_core_registers, /* core_read_registers. */
+ NULL
+};
+
static struct core_fns arm_netbsd_elfcore_fns =
{
- bfd_target_elf_flavour, /* core_flovour. */
+ bfd_target_elf_flavour, /* core_flavour. */
default_check_format, /* check_format. */
default_core_sniffer, /* core_sniffer. */
fetch_elfcore_registers, /* core_read_registers. */
@@ -449,7 +534,8 @@ static struct core_fns arm_netbsd_elfcor
void
_initialize_arm_netbsd_nat (void)
{
- add_inf_child_target (&the_arm_netbsd_nat_target);
+ add_inf_child_target (&the_arm_nbsd_nat_target);
+ deprecated_add_core_fns (&arm_netbsd_core_fns);
deprecated_add_core_fns (&arm_netbsd_elfcore_fns);
}

View File

@ -0,0 +1,56 @@
$NetBSD$
--- gdb/arm-nbsd-tdep.c.orig 2019-07-16 00:00:27.000000000 +0000
+++ gdb/arm-nbsd-tdep.c
@@ -22,6 +22,7 @@
#include "arch/arm.h"
#include "arm-tdep.h"
+#include "nbsd-tdep.h"
#include "solib-svr4.h"
/* Description of the longjmp buffer. */
@@ -42,7 +43,7 @@ arm_netbsd_init_abi_common (struct gdbar
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
tdep->lowest_pc = 0x8000;
- switch (info.byte_order)
+ switch (info.byte_order_for_code)
{
case BFD_ENDIAN_LITTLE:
tdep->arm_breakpoint = arm_nbsd_arm_le_breakpoint;
@@ -68,8 +69,23 @@ arm_netbsd_init_abi_common (struct gdbar
/* Single stepping. */
set_gdbarch_software_single_step (gdbarch, arm_software_single_step);
+ /* Core support */
+ set_gdbarch_iterate_over_regset_sections
+ (gdbarch, armbsd_iterate_over_regset_sections);
+
}
-
+
+static void
+arm_netbsd_aout_init_abi (struct gdbarch_info info,
+ struct gdbarch *gdbarch)
+{
+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+
+ arm_netbsd_init_abi_common (info, gdbarch);
+ if (tdep->fp_model == ARM_FLOAT_AUTO)
+ tdep->fp_model = ARM_FLOAT_SOFT_FPA;
+}
+
static void
arm_netbsd_elf_init_abi (struct gdbarch_info info,
struct gdbarch *gdbarch)
@@ -83,6 +99,9 @@ arm_netbsd_elf_init_abi (struct gdbarch_
/* NetBSD ELF uses SVR4-style shared libraries. */
set_solib_svr4_fetch_link_map_offsets
(gdbarch, svr4_ilp32_fetch_link_map_offsets);
+
+ /* for single stepping; see PR/50773 */
+ set_gdbarch_skip_solib_resolver (gdbarch, nbsd_skip_solib_resolver);
}
void

View File

@ -0,0 +1,19 @@
$NetBSD$
--- gdb/auxv.c.orig 2019-07-16 00:00:27.000000000 +0000
+++ gdb/auxv.c
@@ -266,8 +266,12 @@ default_auxv_parse (struct target_ops *o
if (endptr - ptr < sizeof_auxv_field * 2)
return -1;
-
- *typep = extract_unsigned_integer (ptr, sizeof_auxv_field, byte_order);
+#ifdef __NetBSD__
+ const int sizeof_auxv_type = 4;
+#else
+ const int sizeof_auxv_type = sizeof_auxv_field;
+#endif
+ *typep = extract_unsigned_integer (ptr, sizeof_auxv_type, byte_order);
ptr += sizeof_auxv_field;
*valp = extract_unsigned_integer (ptr, sizeof_auxv_field, byte_order);
ptr += sizeof_auxv_field;

View File

@ -0,0 +1,61 @@
$NetBSD$
--- gdb/bsd-kvm.c.orig 2019-07-16 00:00:27.000000000 +0000
+++ gdb/bsd-kvm.c
@@ -29,6 +29,7 @@
#include "gdbcore.h"
#include "inferior.h" /* for get_exec_file */
#include "gdbthread.h"
+#include "arch-utils.h"
#include <fcntl.h>
#include <kvm.h>
@@ -108,6 +109,7 @@ bsd_kvm_target_open (const char *arg, in
char errbuf[_POSIX2_LINE_MAX];
char *execfile = NULL;
kvm_t *temp_kd;
+ struct inferior *inf;
char *filename = NULL;
target_preopen (from_tty);
@@ -136,6 +138,12 @@ bsd_kvm_target_open (const char *arg, in
core_kd = temp_kd;
push_target (&bsd_kvm_ops);
+ inf = add_inferior_silent (bsd_kvm_ptid.pid ());
+ inf->aspace = maybe_new_address_space ();
+ inf->pspace = new program_space (inf->aspace);
+
+ inf->gdbarch = get_current_arch ();
+
add_thread_silent (bsd_kvm_ptid);
inferior_ptid = bsd_kvm_ptid;
@@ -273,6 +281,27 @@ bsd_kvm_target::fetch_registers (struct
return;
}
+#if 1 /* TODO: HAVE_STRUCT_LWP_L_ADDR */
+ memset (nl, 0, sizeof nl);
+ nl[0].n_name = "_lwp0";
+
+ if (kvm_nlist (core_kd, nl) == -1)
+ error (("%s"), kvm_geterr (core_kd));
+
+ if (nl[0].n_value != 0)
+ {
+ struct pcb *paddr;
+
+ /* Found lwp0. */
+ nl[0].n_value += offsetof (struct lwp, l_addr);
+ if (kvm_read (core_kd, nl[0].n_value, &paddr, sizeof paddr) == -1)
+ error (("%s"), kvm_geterr (core_kd));
+
+ bsd_kvm_fetch_pcb (regcache, paddr);
+ return;
+ }
+#endif
+
#ifdef HAVE_STRUCT_THREAD_TD_PCB
/* In FreeBSD kernels for 5.0-RELEASE and later, the PCB no longer
lives in `struct proc' but in `struct thread'. The `struct

View File

@ -0,0 +1,10 @@
$NetBSD$
--- gdb/config/aarch64/nbsd.mh.orig 2019-09-02 20:02:23.496700950 +0000
+++ gdb/config/aarch64/nbsd.mh
@@ -0,0 +1,5 @@
+# Host: NetBSD/arm64
+NATDEPFILES= fork-child.o inf-ptrace.o nbsd-nat.o aarch64-nbsd-nat.o \
+ bsd-kvm.o
+
+LOADLIBES= -lkvm

View File

@ -0,0 +1,10 @@
$NetBSD$
--- gdb/config/ia64/netbsd.mh.orig 2019-09-02 20:02:23.496835039 +0000
+++ gdb/config/ia64/netbsd.mh
@@ -0,0 +1,5 @@
+# Host: NetBSD/ia64 ELF
+NATDEPFILES= fork-child.o inf-ptrace.o nbsd-nat.o ia64-bsd-nat.o bsd-kvm.o \
+ ia64-nbsd-tdep.o
+
+LOADLIBES= -lkvm

View File

@ -0,0 +1,9 @@
$NetBSD$
--- gdb/config/powerpc/ppc64-nbsd.mh.orig 2019-09-02 20:02:23.496966514 +0000
+++ gdb/config/powerpc/ppc64-nbsd.mh
@@ -0,0 +1,4 @@
+# Host: NetBSD/powerpc64
+NATDEPFILES= fork-child.o inf-ptrace.o nbsd-nat.o ppc-nbsd-nat.o bsd-kvm.o
+
+LOADLIBES= -lkvm

View File

@ -0,0 +1,22 @@
$NetBSD$
--- gdb/configure.orig 2019-07-16 00:00:27.000000000 +0000
+++ gdb/configure
@@ -13532,6 +13532,9 @@ if ${am_cv_langinfo_codeset+:} false; th
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
+#include <sys/param.h>
+#define _KMEMUSER
+#include <sys/lwp.h>
#include <langinfo.h>
int
main ()
@@ -13998,6 +14001,7 @@ if ${gdb_cv_struct_lwp+:} false; then :
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
+#define _KMEMUSER
#include <sys/param.h>
#define _KMEMUSER
#include <sys/lwp.h>

View File

@ -0,0 +1,30 @@
$NetBSD$
--- gdb/configure.host.orig 2019-07-16 00:00:27.000000000 +0000
+++ gdb/configure.host
@@ -84,6 +84,7 @@ case "${host}" in
*-*-darwin*) gdb_host=darwin ;;
aarch64*-*-linux*) gdb_host=linux ;;
+aarch64*-*-netbsd*) gdb_host=nbsd ;;
aarch64*-*-freebsd*) gdb_host=fbsd ;;
alpha*-*-linux*) gdb_host=alpha-linux ;;
@@ -121,7 +122,7 @@ i[34567]86-*-cygwin*) gdb_host=cygwin ;;
ia64-*-linux*) gdb_host=linux ;;
m68*-*-linux*) gdb_host=linux ;;
-m68*-*-netbsdelf* | m68*-*-knetbsd*-gnu)
+m68*-*-netbsdelf* | m68*-*-knetbsd*-gnu | m5407-*-netbsdelf*)
gdb_host=nbsdelf ;;
m68*-*-openbsd*) gdb_host=obsd ;;
@@ -138,6 +139,8 @@ powerpc-*-aix* | rs6000-*-* | powerpc64-
powerpc*-*-freebsd*) gdb_host=fbsd ;;
powerpc-*-netbsd* | powerpc-*-knetbsd*-gnu)
gdb_host=nbsd ;;
+powerpc64-*-netbsd* | powerpc64-*-knetbsd*-gnu)
+ gdb_host=ppc64-nbsd ;;
powerpc-*-openbsd*) gdb_host=obsd ;;
powerpc64*-*-linux*) gdb_host=ppc64-linux

View File

@ -0,0 +1,100 @@
$NetBSD$
--- gdb/configure.nat.orig 2019-07-16 00:00:27.000000000 +0000
+++ gdb/configure.nat
@@ -329,11 +329,16 @@ case ${gdb_host} in
esac
;;
nbsd)
+ NATDEPFILES="${NATDEPFILES} nbsd-nat.o bsd-kvm.o"
+ LOADLIBES='-lkvm'
case ${gdb_host_cpu} in
+ aarch64)
+ # Host: NetBSD/aarch64
+ NATDEPFILES="${NATDEPFILES} aarch64-nbsd-nat.o"
+ ;;
alpha)
# Host: NetBSD/alpha
- NATDEPFILES="${NATDEPFILES} alpha-bsd-nat.o bsd-kvm.o"
- LOADLIBES='-lkvm'
+ NATDEPFILES="${NATDEPFILES} alpha-bsd-nat.o"
;;
mips)
# Host: NetBSD/mips
@@ -341,12 +346,11 @@ case ${gdb_host} in
;;
pa)
# Host: NetBSD/hppa
- NATDEPFILES="${NATDEPFILES} nbsd-nat.o hppa-nbsd-nat.o"
+ NATDEPFILES="${NATDEPFILES} hppa-nbsd-nat.o"
;;
powerpc)
# Host: NetBSD/powerpc
- NATDEPFILES="${NATDEPFILES} ppc-nbsd-nat.o bsd-kvm.o"
- LOADLIBES='-lkvm'
+ NATDEPFILES="${NATDEPFILES} ppc-nbsd-nat.o"
;;
sh)
# Host: NetBSD/sh
@@ -356,22 +360,24 @@ case ${gdb_host} in
esac
;;
nbsd64)
+ NATDEPFILES="${NATDEPFILES} nbsd-nat.o bsd-kvm.o"
+ LOADLIBES='-lkvm'
case ${gdb_host_cpu} in
i386)
# Host: NetBSD/amd64
- NATDEPFILES="${NATDEPFILES} nbsd-nat.o amd64-nat.o x86-nat.o \
- nat/x86-dregs.o x86-bsd-nat.o amd64-bsd-nat.o amd64-nbsd-nat.o"
+ NATDEPFILES="${NATDEPFILES} amd64-nbsd-nat.o amd64-bsd-nat.o \
+ amd64-nat.o x86-bsd-nat.o x86-nat.o nat/x86-dregs.o"
;;
sparc)
# Host: NetBSD/sparc64
- NATDEPFILES="${NATDEPFILES} sparc64-nbsd-nat.o sparc-nat.o \
- bsd-kvm.o"
- LOADLIBES='-lkvm'
+ NATDEPFILES="${NATDEPFILES} sparc64-nbsd-nat.o sparc-nat.o"
;;
esac
;;
nbsdelf)
+ NATDEPFILES="${NATDEPFILES} nbsd-nat.o bsd-kvm.o"
+ LOADLIBES='-lkvm'
case ${gdb_host_cpu} in
arm)
# Host: NetBSD/arm
@@ -379,26 +385,20 @@ case ${gdb_host} in
;;
i386)
# Host: NetBSD/i386 ELF
- NATDEPFILES="${NATDEPFILES} nbsd-nat.o x86-nat.o \
- nat/x86-dregs.o \
- x86-bsd-nat.o i386-bsd-nat.o i386-nbsd-nat.o bsd-kvm.o"
- LOADLIBES='-lkvm'
+ NATDEPFILES="${NATDEPFILES} i386-nbsd-nat.o i386-bsd-nat.o \
+ x86-bsd-nat.o x86-nat.o nat/x86-dregs.o"
;;
m68k)
# Host: NetBSD/m68k ELF
- NATDEPFILES="${NATDEPFILES} m68k-bsd-nat.o bsd-kvm.o"
- LOADLIBES='-lkvm'
+ NATDEPFILES="${NATDEPFILES} m68k-bsd-nat.o"
;;
sparc)
# Host: NetBSD/sparc ELF
- NATDEPFILES="${NATDEPFILES} sparc-nat.o sparc-nbsd-nat.o \
- bsd-kvm.o"
- LOADLIBES='-lkvm'
+ NATDEPFILES="${NATDEPFILES} sparc-nat.o sparc-nbsd-nat.o"
;;
vax)
# Host: NetBSD/vax ELF
- NATDEPFILES="${NATDEPFILES} vax-bsd-nat.o bsd-kvm.o"
- LOADLIBES='-lkvm'
+ NATDEPFILES="${NATDEPFILES} vax-bsd-nat.o"
;;
esac

View File

@ -2,7 +2,74 @@ $NetBSD$
--- gdb/configure.tgt.orig 2019-07-16 00:00:27.000000000 +0000
+++ gdb/configure.tgt
@@ -762,6 +762,7 @@ x86_64-*-mingw* | x86_64-*-cygwin*)
@@ -128,6 +128,16 @@ aarch64*-*-linux*)
build_gdbserver=yes
;;
+aarch64*-*-netbsd*)
+ # Target: AArch64 NetBSD
+ gdb_target_obs="aarch64-tdep.o aarch64-nbsd-tdep.o \
+ arch/aarch64-insn.o"
+ ;;
+
+alpha*-*-osf*)
+ # Target: Little-endian Alpha running OSF/1
+ gdb_target_obs="alpha-tdep.o alpha-osf1-tdep.o alpha-mdebug-tdep.o"
+ ;;
alpha*-*-linux*)
# Target: Little-endian Alpha running Linux
gdb_target_obs="alpha-mdebug-tdep.o alpha-linux-tdep.o \
@@ -172,7 +182,7 @@ arm*-*-freebsd*)
;;
arm*-*-netbsd* | arm*-*-knetbsd*-gnu)
# Target: NetBSD/arm
- gdb_target_obs="arm-nbsd-tdep.o"
+ gdb_target_obs="arm-bsd-tdep.o arm-nbsd-tdep.o"
;;
arm*-*-openbsd*)
# Target: OpenBSD/arm
@@ -246,11 +256,11 @@ hppa*-*-linux*)
;;
hppa*-*-netbsd*)
# Target: NetBSD/hppa
- gdb_target_obs="hppa-bsd-tdep.o hppa-nbsd-tdep.o solib-svr4.o"
+ gdb_target_obs="hppa-bsd-tdep.o hppa-nbsd-tdep.o"
;;
hppa*-*-openbsd*)
# Target: OpenBSD/hppa
- gdb_target_obs="hppa-bsd-tdep.o hppa-obsd-tdep.o solib-svr4.o"
+ gdb_target_obs="hppa-bsd-tdep.o hppa-obsd-tdep.o"
;;
i[34567]86-*-darwin*)
@@ -380,7 +390,7 @@ m68*-*-linux*)
linux-tdep.o glibc-tdep.o symfile-mem.o"
build_gdbserver=yes
;;
-m68*-*-netbsd* | m68*-*-knetbsd*-gnu)
+m68*-*-netbsd* | m68*-*-knetbsd*-gnu | m5407-*-netbsdelf*)
# Target: NetBSD/m68k
gdb_target_obs="m68k-tdep.o m68k-bsd-tdep.o"
;;
@@ -492,7 +502,7 @@ powerpc*-*-freebsd*)
ravenscar-thread.o ppc-ravenscar-thread.o"
;;
-powerpc-*-netbsd* | powerpc-*-knetbsd*-gnu)
+powerpc-*-netbsd* | powerpc-*-knetbsd*-gnu | powerpc64-*-netbsd*)
# Target: NetBSD/powerpc
gdb_target_obs="rs6000-tdep.o ppc-sysv-tdep.o ppc-nbsd-tdep.o \
ravenscar-thread.o ppc-ravenscar-thread.o"
@@ -714,7 +724,7 @@ v850*-*-elf | v850*-*-rtems*)
vax-*-netbsd* | vax-*-knetbsd*-gnu)
# Target: NetBSD/vax
- gdb_target_obs="vax-tdep.o solib-svr4.o"
+ gdb_target_obs="vax-tdep.o"
;;
vax-*-openbsd*)
# Target: OpenBSD/vax
@@ -762,6 +772,7 @@ x86_64-*-mingw* | x86_64-*-cygwin*)
x86_64-*-netbsd* | x86_64-*-knetbsd*-gnu)
# Target: NetBSD/amd64
gdb_target_obs="amd64-nbsd-tdep.o ${i386_tobjs}"

View File

@ -0,0 +1,5 @@
Cannot strip away RCS IDs, please handle manually!
These are the matching lines:
-\xdef\manvers{\$Revision$} % For use in headers, footers too
Setting PKGDIFF_FMT might help.
Otherwise you may need to run diff by hand.

View File

@ -1,6 +1,6 @@
$NetBSD$
--- gdb/gdbserver/netbsd-low.c.orig 2019-08-12 16:19:29.741607490 +0000
--- gdb/gdbserver/netbsd-low.c.orig 2019-09-02 20:02:23.503085722 +0000
+++ gdb/gdbserver/netbsd-low.c
@@ -0,0 +1,2084 @@
+/* Copyright (C) 2019 Free Software Foundation, Inc.

View File

@ -1,6 +1,6 @@
$NetBSD$
--- gdb/gdbserver/netbsd-low.h.orig 2019-08-12 16:19:29.741747438 +0000
--- gdb/gdbserver/netbsd-low.h.orig 2019-09-02 20:02:23.503235772 +0000
+++ gdb/gdbserver/netbsd-low.h
@@ -0,0 +1,61 @@
+/* Copyright (C) 2010-2019 Free Software Foundation, Inc.

View File

@ -1,6 +1,6 @@
$NetBSD$
--- gdb/gdbserver/netbsd-x86_64-low.c.orig 2019-08-12 16:19:29.741931595 +0000
--- gdb/gdbserver/netbsd-x86_64-low.c.orig 2019-09-02 20:02:23.503455942 +0000
+++ gdb/gdbserver/netbsd-x86_64-low.c
@@ -0,0 +1,383 @@
+/* Copyright (C) 2010-2019 Free Software Foundation, Inc.

View File

@ -0,0 +1,12 @@
$NetBSD$
--- gdb/gdbsupport/agent.c.orig 2019-07-16 00:00:27.000000000 +0000
+++ gdb/gdbsupport/agent.c
@@ -155,6 +155,7 @@ gdb_connect_sync_socket (int pid)
return -1;
}
+ memset(&addr, 0, sizeof(addr));
addr.sun_family = AF_UNIX;
res = xsnprintf (addr.sun_path, UNIX_PATH_MAX, "%s", path);

View File

@ -0,0 +1,23 @@
$NetBSD$
--- gdb/gdbsupport/common-defs.h.orig 2019-07-16 00:00:27.000000000 +0000
+++ gdb/gdbsupport/common-defs.h
@@ -96,9 +96,9 @@
#include <strings.h> /* for strcasecmp and strncasecmp */
#endif
#include <errno.h>
-#include <alloca.h>
#include "ansidecl.h"
+#ifndef __NetBSD__
/* This is defined by ansidecl.h, but we prefer gnulib's version. On
MinGW, gnulib might enable __USE_MINGW_ANSI_STDIO, which may or not
require use of attribute gnu_printf instead of printf. gnulib
@@ -106,6 +106,7 @@
is compatible with ATTRIBUTE_PRINTF, simply use it. */
#undef ATTRIBUTE_PRINTF
#define ATTRIBUTE_PRINTF _GL_ATTRIBUTE_FORMAT_PRINTF
+#endif
#if GCC_VERSION >= 3004
#define ATTRIBUTE_UNUSED_RESULT __attribute__ ((__warn_unused_result__))

View File

@ -0,0 +1,11 @@
$NetBSD$
--- gdb/gdbsupport/pathstuff.h.orig 2019-07-16 00:00:27.000000000 +0000
+++ gdb/gdbsupport/pathstuff.h
@@ -92,4 +92,6 @@ extern const char *get_shell ();
extern gdb::char_vector make_temp_filename (const std::string &f);
+extern "C" char *canonicalize_file_name (const char *path);
+
#endif /* COMMON_PATHSTUFF_H */

View File

@ -0,0 +1,112 @@
$NetBSD$
--- gdb/hppa-nbsd-nat.c.orig 2019-07-16 00:00:27.000000000 +0000
+++ gdb/hppa-nbsd-nat.c
@@ -58,8 +58,7 @@ hppanbsd_fpregset_supplies_p (int regnum
static void
hppanbsd_supply_gregset (struct regcache *regcache, const void *gregs)
{
- const char *regs = gregs;
- const int *r = gregs;
+ const char *regs = (const char *) gregs;
int regnum;
for (regnum = HPPA_R1_REGNUM; regnum <= HPPA_R31_REGNUM; regnum++)
@@ -83,7 +82,7 @@ hppanbsd_supply_gregset (struct regcache
static void
hppanbsd_supply_fpregset (struct regcache *regcache, const void *fpregs)
{
- const char *regs = fpregs;
+ const char *regs = (const char *) fpregs;
int regnum;
for (regnum = HPPA_FP0_REGNUM; regnum <= HPPA_FP31R_REGNUM;
@@ -101,8 +100,7 @@ static void
hppanbsd_collect_gregset (const struct regcache *regcache,
void *gregs, int regnum)
{
- char *regs = gregs;
- int *r = gregs;
+ char *regs = (char *) gregs;
int i;
for (i = HPPA_R1_REGNUM; i <= HPPA_R31_REGNUM; i++)
@@ -146,10 +144,10 @@ hppanbsd_collect_gregset (const struct r
in FPREGS. */
static void
-hppanbsd_collect_fpregset (struct regcache *regcache,
+hppanbsd_collect_fpregset (const struct regcache *regcache,
void *fpregs, int regnum)
{
- char *regs = fpregs;
+ char *regs = (char *) fpregs;
int i;
for (i = HPPA_FP0_REGNUM; i <= HPPA_FP31R_REGNUM; i += 2, regs += 8)
@@ -170,13 +168,15 @@ void
hppa_nbsd_nat_target::fetch_registers (struct regcache *regcache, int regnum)
{
- pid_t pid = regcache->ptid ().pid ();
+ ptid_t ptid = regcache->ptid ();
+ pid_t pid = ptid.pid ();
+ int lwp = ptid.lwp ();
if (regnum == -1 || hppanbsd_gregset_supplies_p (regnum))
{
struct reg regs;
- if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) &regs, 0) == -1)
+ if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) &regs, lwp) == -1)
perror_with_name (_("Couldn't get registers"));
hppanbsd_supply_gregset (regcache, &regs);
@@ -186,7 +186,7 @@ hppa_nbsd_nat_target::fetch_registers (s
{
struct fpreg fpregs;
- if (ptrace (PT_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
+ if (ptrace (PT_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, lwp) == -1)
perror_with_name (_("Couldn't get floating point status"));
hppanbsd_supply_fpregset (regcache, &fpregs);
@@ -199,18 +199,20 @@ hppa_nbsd_nat_target::fetch_registers (s
void
hppa_nbsd_nat_target::store_registers (struct regcache *regcache, int regnum)
{
- pid_t pid = regcache->ptid ().pid ();
+ ptid_t ptid = regcache->ptid ();
+ pid_t pid = ptid.pid ();
+ int lwp = ptid.lwp ();
if (regnum == -1 || hppanbsd_gregset_supplies_p (regnum))
{
struct reg regs;
- if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) &regs, 0) == -1)
+ if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) &regs, lwp) == -1)
perror_with_name (_("Couldn't get registers"));
hppanbsd_collect_gregset (regcache, &regs, regnum);
- if (ptrace (PT_SETREGS, pid, (PTRACE_TYPE_ARG3) &regs, 0) == -1)
+ if (ptrace (PT_SETREGS, pid, (PTRACE_TYPE_ARG3) &regs, lwp) == -1)
perror_with_name (_("Couldn't write registers"));
}
@@ -218,12 +220,12 @@ hppa_nbsd_nat_target::store_registers (s
{
struct fpreg fpregs;
- if (ptrace (PT_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
+ if (ptrace (PT_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, lwp) == -1)
perror_with_name (_("Couldn't get floating point status"));
hppanbsd_collect_fpregset (regcache, &fpregs, regnum);
- if (ptrace (PT_SETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
+ if (ptrace (PT_SETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, lwp) == -1)
perror_with_name (_("Couldn't write floating point status"));
}
}

View File

@ -0,0 +1,69 @@
$NetBSD$
--- gdb/hppa-nbsd-tdep.c.orig 2019-07-16 00:00:27.000000000 +0000
+++ gdb/hppa-nbsd-tdep.c
@@ -25,8 +25,8 @@
#include "trad-frame.h"
#include "tramp-frame.h"
-#include "hppa-tdep.h"
#include "hppa-bsd-tdep.h"
+#include "hppa-tdep.h"
#include "gdbarch.h"
/* From <machine/mcontext.h>. */
@@ -58,6 +58,19 @@ static int hppanbsd_mc_reg_offset[] =
38 * 4, /* sr1 */
39 * 4, /* sr2 */
40 * 4, /* sr3 */
+ -1, /* 48 */
+ -1, /* 49 */
+ -1, /* 50 */
+ -1, /* 51 */
+ -1, /* 52 */
+ -1, /* 53 */
+ -1, /* 54 */
+ -1, /* 55 */
+ -1, /* 56 */
+ -1, /* 57 CR24 */
+ -1, /* 58 CR25 */
+ -1, /* 59 CR26 */
+ 43 * 4, /* HPPA_CR27_REGNUM */
/* more tbd */
};
@@ -129,7 +142,7 @@ hppanbsd_sigtramp_cache_init (const stru
/* Core file support. */
/* Sizeof `struct reg' in <machine/reg.h>. */
-#define HPPANBSD_SIZEOF_GREGS (44 * 4)
+#define HPPANBSD_SIZEOF_GREGS (47 * 4)
static int hppanbsd_reg_offset[] =
{
@@ -153,6 +166,25 @@ static int hppanbsd_reg_offset[] =
-1, /* HPPA_ISR_REGNUM */
-1, /* HPPA_IOR_REGNUM */
0 * 4, /* HPPA_IPSW_REGNUM */
+ -1, /* spare? */
+ 41 * 4, /* HPPA_SR4_REGNUM */
+ 37 * 4, /* sr0 */
+ 38 * 4, /* sr1 */
+ 39 * 4, /* sr2 */
+ 40 * 4, /* sr3 */
+ -1, /* 48 */
+ -1, /* 49 */
+ -1, /* 50 */
+ -1, /* 51 */
+ -1, /* 52 */
+ -1, /* 53 */
+ -1, /* 54 */
+ -1, /* 55 */
+ -1, /* 56 */
+ -1, /* 57 */
+ -1, /* 58 */
+ -1, /* 59 */
+ 46 * 4, /* HPPA_CR27_REGNUM */
};
/* Supply register REGNUM from the buffer specified by GREGS and LEN

View File

@ -0,0 +1,13 @@
$NetBSD$
--- gdb/hppa-tdep.c.orig 2019-07-16 00:00:27.000000000 +0000
+++ gdb/hppa-tdep.c
@@ -624,7 +624,7 @@ hppa32_register_name (struct gdbarch *gd
"sr5", "sr6", "sr7", "cr0",
"cr8", "cr9", "ccr", "cr12",
"cr13", "cr24", "cr25", "cr26",
- "mpsfu_high","mpsfu_low","mpsfu_ovflo","pad",
+ "cr27", "cr28", "cr29", "cr30",
"fpsr", "fpe1", "fpe2", "fpe3",
"fpe4", "fpe5", "fpe6", "fpe7",
"fr4", "fr4R", "fr5", "fr5R",

View File

@ -0,0 +1,11 @@
$NetBSD$
--- gdb/hppa-tdep.h.orig 2019-07-16 00:00:27.000000000 +0000
+++ gdb/hppa-tdep.h
@@ -215,4 +215,6 @@ extern int hppa_in_solib_call_trampoline
CORE_ADDR pc);
extern CORE_ADDR hppa_skip_trampoline_code (struct frame_info *, CORE_ADDR pc);
+void _initialize_hppabsd_tdep (void);
+
#endif /* hppa-tdep.h */

View File

@ -0,0 +1,110 @@
$NetBSD$
--- gdb/i386-bsd-nat.c.orig 2019-07-16 00:00:27.000000000 +0000
+++ gdb/i386-bsd-nat.c
@@ -131,12 +131,13 @@ void
i386bsd_fetch_inferior_registers (struct regcache *regcache, int regnum)
{
pid_t pid = get_ptrace_pid (regcache->ptid ());
+ int lwp = regcache->ptid ().lwp ();
if (regnum == -1 || GETREGS_SUPPLIES (regnum))
{
struct reg regs;
- if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) &regs, 0) == -1)
+ if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) &regs, lwp) == -1)
perror_with_name (_("Couldn't get registers"));
i386bsd_supply_gregset (regcache, &regs);
@@ -185,7 +186,7 @@ i386bsd_fetch_inferior_registers (struct
xstateregs = alloca (x86bsd_xsave_len);
if (ptrace (PT_GETXSTATE, pid,
- (PTRACE_TYPE_ARG3) xstateregs, 0) == -1)
+ (PTRACE_TYPE_ARG3) xstateregs, lwp) == -1)
perror_with_name (_("Couldn't get extended state status"));
i387_supply_xsave (regcache, -1, xstateregs);
@@ -195,7 +196,7 @@ i386bsd_fetch_inferior_registers (struct
#ifdef HAVE_PT_GETXMMREGS
if (have_ptrace_xmmregs != 0
- && ptrace(PT_GETXMMREGS, pid, (PTRACE_TYPE_ARG3) xmmregs, 0) == 0)
+ && ptrace(PT_GETXMMREGS, pid, (PTRACE_TYPE_ARG3) xmmregs, lwp) == 0)
{
have_ptrace_xmmregs = 1;
i387_supply_fxsave (regcache, -1, xmmregs);
@@ -204,7 +205,7 @@ i386bsd_fetch_inferior_registers (struct
{
have_ptrace_xmmregs = 0;
#endif
- if (ptrace (PT_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
+ if (ptrace (PT_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, lwp) == -1)
perror_with_name (_("Couldn't get floating point status"));
i387_supply_fsave (regcache, -1, &fpregs);
@@ -221,17 +222,18 @@ void
i386bsd_store_inferior_registers (struct regcache *regcache, int regnum)
{
pid_t pid = get_ptrace_pid (regcache->ptid ());
+ int lwp = regcache->ptid ().lwp ();
if (regnum == -1 || GETREGS_SUPPLIES (regnum))
{
struct reg regs;
- if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) &regs, 0) == -1)
+ if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) &regs, lwp) == -1)
perror_with_name (_("Couldn't get registers"));
i386bsd_collect_gregset (regcache, &regs, regnum);
- if (ptrace (PT_SETREGS, pid, (PTRACE_TYPE_ARG3) &regs, 0) == -1)
+ if (ptrace (PT_SETREGS, pid, (PTRACE_TYPE_ARG3) &regs, lwp) == -1)
perror_with_name (_("Couldn't write registers"));
if (regnum != -1)
@@ -279,10 +281,10 @@ i386bsd_store_inferior_registers (struct
xstateregs = alloca (x86bsd_xsave_len);
if (ptrace (PT_GETXSTATE, pid,
- (PTRACE_TYPE_ARG3) xstateregs, 0) == -1)
+ (PTRACE_TYPE_ARG3) xstateregs, lwp) == -1)
perror_with_name (_("Couldn't get extended state status"));
- i387_collect_xsave (regcache, -1, xstateregs, 0);
+ i387_collect_xsave (regcache, -1, xstateregs, lwp);
if (ptrace (PT_SETXSTATE, pid,
(PTRACE_TYPE_ARG3) xstateregs, x86bsd_xsave_len) == -1)
@@ -293,25 +295,25 @@ i386bsd_store_inferior_registers (struct
#ifdef HAVE_PT_GETXMMREGS
if (have_ptrace_xmmregs != 0
- && ptrace(PT_GETXMMREGS, pid, (PTRACE_TYPE_ARG3) xmmregs, 0) == 0)
+ && ptrace(PT_GETXMMREGS, pid, (PTRACE_TYPE_ARG3) xmmregs, lwp) == 0)
{
have_ptrace_xmmregs = 1;
i387_collect_fxsave (regcache, regnum, xmmregs);
- if (ptrace (PT_SETXMMREGS, pid, (PTRACE_TYPE_ARG3) xmmregs, 0) == -1)
+ if (ptrace (PT_SETXMMREGS, pid, (PTRACE_TYPE_ARG3) xmmregs, lwp) == -1)
perror_with_name (_("Couldn't write XMM registers"));
}
else
{
have_ptrace_xmmregs = 0;
#endif
- if (ptrace (PT_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
+ if (ptrace (PT_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, lwp) == -1)
perror_with_name (_("Couldn't get floating point status"));
i387_collect_fsave (regcache, regnum, &fpregs);
- if (ptrace (PT_SETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
+ if (ptrace (PT_SETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, lwp) == -1)
perror_with_name (_("Couldn't write floating point status"));
#ifdef HAVE_PT_GETXMMREGS
}

View File

@ -0,0 +1,13 @@
$NetBSD$
--- gdb/i386-bsd-nat.h.orig 2019-07-16 00:00:27.000000000 +0000
+++ gdb/i386-bsd-nat.h
@@ -20,6 +20,8 @@
#ifndef I386_BSD_NAT_H
#define I386_BSD_NAT_H
+#include "x86-bsd-nat.h"
+
/* Helper functions. See definitions. */
extern void i386bsd_fetch_inferior_registers (struct regcache *regcache,
int regnum);

View File

@ -0,0 +1,51 @@
$NetBSD$
--- gdb/i386-nbsd-nat.c.orig 2019-07-16 00:00:27.000000000 +0000
+++ gdb/i386-nbsd-nat.c
@@ -23,11 +23,13 @@
#include "target.h"
#include "i386-tdep.h"
+#include "i387-tdep.h"
#include "i386-bsd-nat.h"
/* Support for debugging kernel virtual memory images. */
#include <sys/types.h>
+#include <machine/reg.h>
#include <machine/frame.h>
#include <machine/pcb.h>
@@ -39,21 +41,25 @@ i386nbsd_supply_pcb (struct regcache *re
{
struct switchframe sf;
- /* The following is true for NetBSD 1.6.2:
+ /* The following is true for NetBSD 1.6.2 and after:
The pcb contains %esp and %ebp at the point of the context switch
- in cpu_switch(). At that point we have a stack frame as
- described by `struct switchframe', which for NetBSD 1.6.2 has the
- following layout:
+ in cpu_switch()/cpu_switchto(). At that point we have a stack frame as
+ described by `struct switchframe', which for NetBSD (2.0 and later) has
+ the following layout:
- interrupt level
%edi
%esi
%ebx
- %eip
+ return address
we reconstruct the register state as it would look when we just
- returned from cpu_switch(). */
+ returned from cpu_switch()/cpu_switchto().
+
+ For core dumps the pcb is saved by savectx()/dumpsys() and contains the
+ stack pointer and frame pointer. A new dumpsys() fakes a switchframe
+ whereas older code isn't reliable so use an iffy heuristic to detect this
+ and use the frame pointer to recover enough state. */
/* The stack pointer shouldn't be zero. */
if (pcb->pcb_esp == 0)

View File

@ -0,0 +1,183 @@
$NetBSD$
--- gdb/i386-nbsd-tdep.c.orig 2019-07-16 00:00:27.000000000 +0000
+++ gdb/i386-nbsd-tdep.c
@@ -33,6 +33,11 @@
#include "nbsd-tdep.h"
#include "solib-svr4.h"
+#include "elf-bfd.h" /* for header hack */
+#include "trad-frame.h" /* signal trampoline/kernel frame support */
+#include "frame-unwind.h" /* kernel frame support */
+#include "tramp-frame.h" /* signal trampoline/kernel frame support */
+
/* From <machine/reg.h>. */
static int i386nbsd_r_reg_offset[] =
{
@@ -369,6 +374,156 @@ i386nbsd_sigtramp_cache_init (const stru
}
+/* From <machine/frame.h>. Note that %esp and %ess are only saved in
+ a trap frame when entering the kernel from user space. */
+static int i386nbsd_tf_reg_offset[] =
+{
+ 10 * 4, /* %eax */
+ 9 * 4, /* %ecx */
+ 8 * 4, /* %edx */
+ 7 * 4, /* %ebx */
+ -1, /* %esp */
+ 6 * 4, /* %ebp */
+ 5 * 4, /* %esi */
+ 4 * 4, /* %edi */
+ 13 * 4, /* %eip */
+ 15 * 4, /* %eflags */
+ 14 * 4, /* %cs */
+ -1, /* %ss */
+ 3 * 4, /* %ds */
+ 2 * 4, /* %es */
+ 1 * 4, /* %fs */
+ 0 * 4 /* %gs */
+};
+
+static struct trad_frame_cache *
+i386nbsd_trapframe_cache(struct frame_info *this_frame, void **this_cache)
+{
+ struct trad_frame_cache *cache;
+ CORE_ADDR func, sp, addr, tmp;
+ ULONGEST cs;
+ const char *name;
+ int i;
+ struct gdbarch *gdbarch = get_frame_arch (this_frame);
+ enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
+
+ if (*this_cache)
+ return (struct trad_frame_cache *)*this_cache;
+
+ cache = trad_frame_cache_zalloc (this_frame);
+ *this_cache = cache;
+
+ func = get_frame_func (this_frame);
+ sp = get_frame_register_unsigned (this_frame, I386_ESP_REGNUM);
+
+ find_pc_partial_function (func, &name, NULL, NULL);
+ if (name && (strncmp (name, "Xintr", 5) == 0 ||
+ strncmp (name, "Xhandle", 7) == 0))
+ {
+ /* It's an interrupt frame. */
+ tmp = read_memory_unsigned_integer (sp + 4, 4, byte_order);
+ if (tmp < 15)
+ {
+ /* Reasonable value for 'ppl': already on interrupt stack. */
+ addr = sp + 8;
+ }
+ else
+ {
+ /* Switch to previous stack. */
+ addr = tmp + 4;
+ }
+ }
+ else
+ {
+ /* It's a trap frame. */
+ addr = sp + 4;
+ }
+
+ for (i = 0; i < ARRAY_SIZE (i386nbsd_tf_reg_offset); i++)
+ if (i386nbsd_tf_reg_offset[i] != -1)
+ trad_frame_set_reg_addr (cache, i, addr + i386nbsd_tf_reg_offset[i]);
+
+ /* Read %cs from trap frame. */
+ addr += i386nbsd_tf_reg_offset[I386_CS_REGNUM];
+ cs = read_memory_unsigned_integer (addr, 4, byte_order);
+ if ((cs & I386_SEL_RPL) == I386_SEL_UPL)
+ {
+ /* Trap from user space; terminate backtrace. */
+ trad_frame_set_id (cache, outer_frame_id);
+ }
+ else
+ {
+ /* Construct the frame ID using the function start. */
+ trad_frame_set_id (cache, frame_id_build (sp + 8, func));
+ }
+
+ return cache;
+}
+
+static void
+i386nbsd_trapframe_this_id (struct frame_info *this_frame,
+ void **this_cache, struct frame_id *this_id)
+{
+ struct trad_frame_cache *cache =
+ i386nbsd_trapframe_cache (this_frame, this_cache);
+
+ trad_frame_get_id (cache, this_id);
+}
+
+static struct value *
+i386nbsd_trapframe_prev_register (struct frame_info *this_frame,
+ void **this_cache, int regnum)
+{
+ struct trad_frame_cache *cache =
+ i386nbsd_trapframe_cache (this_frame, this_cache);
+
+ return trad_frame_get_register (cache, this_frame, regnum);
+}
+
+static int
+i386nbsd_trapframe_sniffer (const struct frame_unwind *self,
+ struct frame_info *this_frame,
+ void **this_prologue_cache)
+{
+ ULONGEST cs;
+ const char *name;
+
+ /* Check Current Privilege Level and bail out if we're not executing
+ in kernel space. */
+ cs = get_frame_register_unsigned (this_frame, I386_CS_REGNUM);
+ if ((cs & I386_SEL_RPL) == I386_SEL_UPL)
+ return 0;
+
+
+ find_pc_partial_function (get_frame_pc (this_frame), &name, NULL, NULL);
+ return (name && ((strcmp (name, "alltraps") == 0)
+ || (strcmp (name, "calltrap") == 0)
+ || (strcmp (name, "syscall1") == 0)
+ || (strcmp (name, "Xdoreti") == 0)
+ || (strncmp (name, "Xintr", 5) == 0)
+ || (strncmp (name, "Xhandle", 7) == 0)
+ || (strncmp (name, "Xpreempt", 8) == 0)
+ || (strncmp (name, "Xrecurse", 8) == 0)
+ || (strncmp (name, "Xresume", 7) == 0)
+ || (strncmp (name, "Xsoft", 5) == 0)
+ || (strncmp (name, "Xstray", 6) == 0)
+ || (strncmp (name, "Xsyscall", 8) == 0)
+ || (strncmp (name, "Xtrap", 5) == 0)
+ ));
+}
+
+const struct frame_unwind i386nbsd_trapframe_unwind = {
+ /* FIXME: kettenis/20051219: This really is more like an interrupt
+ frame, but SIGTRAMP_FRAME would print <signal handler called>,
+ which really is not what we want here. */
+ NORMAL_FRAME,
+ default_frame_unwind_stop_reason,
+ i386nbsd_trapframe_this_id,
+ i386nbsd_trapframe_prev_register,
+ NULL,
+ i386nbsd_trapframe_sniffer
+};
+
static void
i386nbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
{
@@ -398,6 +553,9 @@ i386nbsd_init_abi (struct gdbarch_info i
tramp_frame_prepend_unwinder (gdbarch, &i386nbsd_sigtramp_si2);
tramp_frame_prepend_unwinder (gdbarch, &i386nbsd_sigtramp_si31);
tramp_frame_prepend_unwinder (gdbarch, &i386nbsd_sigtramp_si4);
+
+ /* Unwind kernel trap frames correctly. */
+ frame_unwind_prepend_unwinder (gdbarch, &i386nbsd_trapframe_unwind);
}
/* NetBSD ELF. */

View File

@ -0,0 +1,51 @@
$NetBSD$
--- gdb/ia64-nbsd-tdep.c.orig 2019-09-02 20:02:23.506067905 +0000
+++ gdb/ia64-nbsd-tdep.c
@@ -0,0 +1,46 @@
+/* Target-dependent code for NetBSD/ia64.
+
+ Copyright (C) 2004-2017 Free Software Foundation, Inc.
+
+ This file is part of GDB.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+#include "defs.h"
+#include "arch-utils.h"
+#include "osabi.h"
+
+#include "ia64-tdep.h"
+#include "solib-svr4.h"
+
+/* NetBSD ELF. */
+
+static void
+ia64nbsd_elf_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
+{
+ /* NetBSD ELF uses SVR4-style shared libraries. */
+ set_solib_svr4_fetch_link_map_offsets
+ (gdbarch, svr4_ilp32_fetch_link_map_offsets);
+}
+
+
+/* Provide a prototype to silence -Wmissing-prototypes. */
+void _initialize_ia64nbsd_tdep (void);
+
+void
+_initialize_ia64nbsd_tdep (void)
+{
+ gdbarch_register_osabi (bfd_arch_ia64, 0, GDB_OSABI_NETBSD,
+ ia64nbsd_elf_init_abi);
+}

View File

@ -0,0 +1,68 @@
$NetBSD$
--- gdb/inf-ptrace.c.orig 2019-07-16 00:00:27.000000000 +0000
+++ gdb/inf-ptrace.c
@@ -322,10 +322,12 @@ get_ptrace_pid (ptid_t ptid)
{
pid_t pid;
+#ifndef __NetBSD__
/* If we have an LWPID to work with, use it. Otherwise, we're
dealing with a non-threaded program/target. */
pid = ptid.lwp ();
if (pid == 0)
+#endif
pid = ptid.pid ();
return pid;
}
@@ -338,7 +340,7 @@ void
inf_ptrace_target::resume (ptid_t ptid, int step, enum gdb_signal signal)
{
pid_t pid;
- int request;
+ int request, sig;
if (minus_one_ptid == ptid)
/* Resume all threads. Traditionally ptrace() only supports
@@ -360,13 +362,23 @@ inf_ptrace_target::resume (ptid_t ptid,
all possible successor instructions), so we don't have to
worry about that here. */
request = PT_STEP;
- }
+#if __NetBSD__
+ /*
+ * On NetBSD the data field of PT_STEP contains the thread
+ * to be stepped; all other threads are continued if this value is > 0
+ */
+ sig = ptid.lwp ();
+#else
+ sig = 0;
+#endif
+ } else
+ sig = gdb_signal_to_host (signal);
/* An address of (PTRACE_TYPE_ARG3)1 tells ptrace to continue from
where it was. If GDB wanted it to start some other way, we have
already written a new program counter value to the child. */
errno = 0;
- ptrace (request, pid, (PTRACE_TYPE_ARG3)1, gdb_signal_to_host (signal));
+ ptrace (request, pid, (PTRACE_TYPE_ARG3)1, sig);
if (errno != 0)
perror_with_name (("ptrace"));
}
@@ -562,6 +574,15 @@ inf_ptrace_target::xfer_partial (enum ta
/* If the PT_IO request is somehow not supported, fallback on
using PT_WRITE_D/PT_READ_D. Otherwise we will return zero
to indicate failure. */
+ if (errno == EACCES)
+ {
+ fprintf_unfiltered (gdb_stderr, "Cannot %s process at %p (%s). "
+ "Is PaX MPROTECT active? See security(7), "
+ "sysctl(7), paxctl(8)\n", writebuf ? "write to" :
+ "read from", piod.piod_offs,
+ strerror(errno));
+ return TARGET_XFER_E_IO; /* Some other error perhaps? */
+ }
if (errno != EINVAL)
return TARGET_XFER_EOF;
}

View File

@ -0,0 +1,110 @@
$NetBSD$
--- gdb/m68k-bsd-nat.c.orig 2019-07-16 00:00:27.000000000 +0000
+++ gdb/m68k-bsd-nat.c
@@ -29,7 +29,12 @@
#include "m68k-tdep.h"
#include "inf-ptrace.h"
+#ifdef __NetBSD__
+#include "nbsd-nat.h"
+struct m68k_bsd_nat_target final : public nbsd_nat_target
+#else
struct m68k_bsd_nat_target final : public inf_ptrace_target
+#endif
{
void fetch_registers (struct regcache *, int) override;
void store_registers (struct regcache *, int) override;
@@ -54,7 +59,7 @@ m68kbsd_fpregset_supplies_p (int regnum)
static void
m68kbsd_supply_gregset (struct regcache *regcache, const void *gregs)
{
- const char *regs = gregs;
+ const gdb_byte *regs = (const gdb_byte *)gregs;
int regnum;
for (regnum = M68K_D0_REGNUM; regnum <= M68K_PC_REGNUM; regnum++)
@@ -67,7 +72,7 @@ static void
m68kbsd_supply_fpregset (struct regcache *regcache, const void *fpregs)
{
struct gdbarch *gdbarch = regcache->arch ();
- const char *regs = fpregs;
+ const gdb_byte *regs = (const gdb_byte *)fpregs;
int regnum;
for (regnum = M68K_FP0_REGNUM; regnum <= M68K_FPI_REGNUM; regnum++)
@@ -82,7 +87,7 @@ static void
m68kbsd_collect_gregset (const struct regcache *regcache,
void *gregs, int regnum)
{
- char *regs = gregs;
+ gdb_byte *regs = (gdb_byte *)gregs;
int i;
for (i = M68K_D0_REGNUM; i <= M68K_PC_REGNUM; i++)
@@ -100,7 +105,7 @@ m68kbsd_collect_fpregset (struct regcach
void *fpregs, int regnum)
{
struct gdbarch *gdbarch = regcache->arch ();
- char *regs = fpregs;
+ gdb_byte *regs = (gdb_byte *)fpregs;
int i;
for (i = M68K_FP0_REGNUM; i <= M68K_FPI_REGNUM; i++)
@@ -123,7 +128,7 @@ m68k_bsd_nat_target::fetch_registers (st
{
struct reg regs;
- if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) &regs, 0) == -1)
+ if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) &regs, inferior_ptid.lwp ()) == -1)
perror_with_name (_("Couldn't get registers"));
m68kbsd_supply_gregset (regcache, &regs);
@@ -133,7 +138,7 @@ m68k_bsd_nat_target::fetch_registers (st
{
struct fpreg fpregs;
- if (ptrace (PT_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
+ if (ptrace (PT_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, inferior_ptid.lwp ()) == -1)
perror_with_name (_("Couldn't get floating point status"));
m68kbsd_supply_fpregset (regcache, &fpregs);
@@ -152,12 +157,12 @@ m68k_bsd_nat_target::store_registers (st
{
struct reg regs;
- if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) &regs, 0) == -1)
+ if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) &regs, inferior_ptid.lwp ()) == -1)
perror_with_name (_("Couldn't get registers"));
m68kbsd_collect_gregset (regcache, &regs, regnum);
- if (ptrace (PT_SETREGS, pid, (PTRACE_TYPE_ARG3) &regs, 0) == -1)
+ if (ptrace (PT_SETREGS, pid, (PTRACE_TYPE_ARG3) &regs, inferior_ptid.lwp ()) == -1)
perror_with_name (_("Couldn't write registers"));
}
@@ -165,12 +170,12 @@ m68k_bsd_nat_target::store_registers (st
{
struct fpreg fpregs;
- if (ptrace (PT_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
+ if (ptrace (PT_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, inferior_ptid.lwp ()) == -1)
perror_with_name (_("Couldn't get floating point status"));
m68kbsd_collect_fpregset (regcache, &fpregs, regnum);
- if (ptrace (PT_SETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
+ if (ptrace (PT_SETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, inferior_ptid.lwp ()) == -1)
perror_with_name (_("Couldn't write floating point status"));
}
}
@@ -215,7 +220,7 @@ m68kbsd_supply_pcb (struct regcache *reg
tmp = pcb->pcb_ps & 0xffff;
regcache->raw_supply (M68K_PS_REGNUM, &tmp);
- read_memory (pcb->pcb_regs[PCB_REGS_FP] + 4, (char *) &tmp, sizeof tmp);
+ read_memory (pcb->pcb_regs[PCB_REGS_FP] + 4, (gdb_byte *) &tmp, sizeof tmp);
regcache->raw_supply (M68K_PC_REGNUM, &tmp);
return 1;

View File

@ -0,0 +1,141 @@
$NetBSD$
--- gdb/mips-nbsd-nat.c.orig 2019-07-16 00:00:27.000000000 +0000
+++ gdb/mips-nbsd-nat.c
@@ -16,7 +16,9 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
+#ifndef _KERNTYPES
+#define _KERNTYPES
+#endif
#include "defs.h"
#include "inferior.h"
#include "regcache.h"
@@ -27,10 +29,14 @@
#include <machine/reg.h>
#include "mips-tdep.h"
+#include "nbsd-nat.h"
#include "mips-nbsd-tdep.h"
#include "inf-ptrace.h"
+#include "bsd-kvm.h"
+
+#include "machine/pcb.h"
-class mips_nbsd_nat_target final : public inf_ptrace_target
+class mips_nbsd_nat_target final : public nbsd_nat_target
{
void fetch_registers (struct regcache *, int) override;
void store_registers (struct regcache *, int) override;
@@ -49,14 +55,16 @@ getregs_supplies (struct gdbarch *gdbarc
void
mips_nbsd_nat_target::fetch_registers (struct regcache *regcache, int regno)
{
- pid_t pid = regcache->ptid ().pid ();
+ ptid_t ptid = regcache->ptid ();
+ pid_t pid = ptid.pid ();
+ int lwp = ptid.lwp ();
struct gdbarch *gdbarch = regcache->arch ();
if (regno == -1 || getregs_supplies (gdbarch, regno))
{
struct reg regs;
- if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) &regs, 0) == -1)
+ if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) &regs, lwp) == -1)
perror_with_name (_("Couldn't get registers"));
mipsnbsd_supply_reg (regcache, (char *) &regs, regno);
@@ -69,7 +77,7 @@ mips_nbsd_nat_target::fetch_registers (s
{
struct fpreg fpregs;
- if (ptrace (PT_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
+ if (ptrace (PT_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, lwp) == -1)
perror_with_name (_("Couldn't get floating point status"));
mipsnbsd_supply_fpreg (regcache, (char *) &fpregs, regno);
@@ -79,19 +87,21 @@ mips_nbsd_nat_target::fetch_registers (s
void
mips_nbsd_nat_target::store_registers (struct regcache *regcache, int regno)
{
- pid_t pid = regcache->ptid ().pid ();
+ ptid_t ptid = regcache->ptid ();
+ pid_t pid = ptid.pid ();
+ int lwp = ptid.lwp ();
struct gdbarch *gdbarch = regcache->arch ();
if (regno == -1 || getregs_supplies (gdbarch, regno))
{
struct reg regs;
- if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) &regs, 0) == -1)
+ if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) &regs, lwp) == -1)
perror_with_name (_("Couldn't get registers"));
mipsnbsd_fill_reg (regcache, (char *) &regs, regno);
- if (ptrace (PT_SETREGS, pid, (PTRACE_TYPE_ARG3) &regs, 0) == -1)
+ if (ptrace (PT_SETREGS, pid, (PTRACE_TYPE_ARG3) &regs, lwp) == -1)
perror_with_name (_("Couldn't write registers"));
if (regno != -1)
@@ -103,18 +113,54 @@ mips_nbsd_nat_target::store_registers (s
{
struct fpreg fpregs;
- if (ptrace (PT_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
+ if (ptrace (PT_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, lwp) == -1)
perror_with_name (_("Couldn't get floating point status"));
mipsnbsd_fill_fpreg (regcache, (char *) &fpregs, regno);
- if (ptrace (PT_SETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
+ if (ptrace (PT_SETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, lwp) == -1)
perror_with_name (_("Couldn't write floating point status"));
}
}
+static int
+mipsnbsd_supply_pcb (struct regcache *regcache, struct pcb *pcb)
+{
+ struct label_t sf;
+
+ sf = pcb->pcb_context;
+
+ /* really should test for n{32,64} abi for this register
+ unless this is purely the "n" ABI */
+
+ regcache->raw_supply (MIPS_S0_REGNUM, &sf.val[_L_S0]);
+ regcache->raw_supply (MIPS_S1_REGNUM, &sf.val[_L_S1]);
+ regcache->raw_supply (MIPS_S2_REGNUM, &sf.val[_L_S2]);
+ regcache->raw_supply (MIPS_S3_REGNUM, &sf.val[_L_S3]);
+ regcache->raw_supply (MIPS_S4_REGNUM, &sf.val[_L_S4]);
+ regcache->raw_supply (MIPS_S5_REGNUM, &sf.val[_L_S5]);
+ regcache->raw_supply (MIPS_S6_REGNUM, &sf.val[_L_S6]);
+ regcache->raw_supply (MIPS_S7_REGNUM, &sf.val[_L_S7]);
+
+ regcache->raw_supply (MIPS_S8_REGNUM, &sf.val[_L_S8]);
+
+ regcache->raw_supply (MIPS_T8_REGNUM, &sf.val[_L_T8]);
+
+ regcache->raw_supply (MIPS_GP_REGNUM, &sf.val[_L_GP]);
+
+ regcache->raw_supply (MIPS_SP_REGNUM, &sf.val[_L_SP]);
+ regcache->raw_supply (MIPS_RA_REGNUM, &sf.val[_L_RA]);
+ regcache->raw_supply (MIPS_PS_REGNUM, &sf.val[_L_SR]);
+
+ /* provide the return address of the savectx as the current pc */
+ regcache->raw_supply (MIPS_EMBED_PC_REGNUM, &sf.val[_L_RA]);
+
+ return 0;
+}
+
void
_initialize_mipsnbsd_nat (void)
{
add_inf_child_target (&the_mips_nbsd_nat_target);
+ bsd_kvm_add_target (mipsnbsd_supply_pcb);
}

View File

@ -0,0 +1,24 @@
$NetBSD$
--- gdb/mips-tdep.h.orig 2019-07-16 00:00:27.000000000 +0000
+++ gdb/mips-tdep.h
@@ -126,10 +126,19 @@ enum
MIPS_AT_REGNUM = 1,
MIPS_V0_REGNUM = 2, /* Function integer return value. */
MIPS_A0_REGNUM = 4, /* Loc of first arg during a subr call. */
+ MIPS_S0_REGNUM = 16,
+ MIPS_S1_REGNUM = 17,
MIPS_S2_REGNUM = 18, /* Contains return address in MIPS16 thunks. */
+ MIPS_S3_REGNUM = 19,
+ MIPS_S4_REGNUM = 20,
+ MIPS_S5_REGNUM = 21,
+ MIPS_S6_REGNUM = 22,
+ MIPS_S7_REGNUM = 23,
+ MIPS_T8_REGNUM = 24,
MIPS_T9_REGNUM = 25, /* Contains address of callee in PIC. */
MIPS_GP_REGNUM = 28,
MIPS_SP_REGNUM = 29,
+ MIPS_S8_REGNUM = 30,
MIPS_RA_REGNUM = 31,
MIPS_PS_REGNUM = 32, /* Contains processor status. */
MIPS_EMBED_LO_REGNUM = 33,

View File

@ -0,0 +1,533 @@
$NetBSD$
--- gdb/nbsd-nat.c.orig 2019-07-16 00:00:27.000000000 +0000
+++ gdb/nbsd-nat.c
@@ -1,4 +1,4 @@
-/* Native-dependent code for NetBSD.
+/* Native-dependent code for NetBSD
Copyright (C) 2006-2019 Free Software Foundation, Inc.
@@ -18,7 +18,21 @@
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include "defs.h"
+#include "gdbcore.h"
+#include "inferior.h"
+#include "regcache.h"
+#include "regset.h"
+#include "gdbcmd.h"
+#include "gdbthread.h"
+#include "gdbsupport/gdb_wait.h"
+#include <sys/types.h>
+#include <sys/ptrace.h>
+#include <sys/sysctl.h>
+#ifdef HAVE_KINFO_GETVMMAP
+#include <util.h>
+#endif
+#include "elf-bfd.h"
#include "nbsd-nat.h"
/* Return the name of a file that can be opened to get the symbols for
@@ -31,6 +45,17 @@ nbsd_nat_target::pid_to_exec_file (int p
static char buf[PATH_MAX];
char name[PATH_MAX];
+ size_t buflen;
+ int mib[4];
+
+ mib[0] = CTL_KERN;
+ mib[1] = KERN_PROC_ARGS;
+ mib[2] = pid;
+ mib[3] = KERN_PROC_PATHNAME;
+ buflen = sizeof buf;
+ if (sysctl (mib, 4, buf, &buflen, NULL, 0) == 0)
+ return buf;
+
xsnprintf (name, PATH_MAX, "/proc/%d/exe", pid);
len = readlink (name, buf, PATH_MAX - 1);
if (len != -1)
@@ -41,3 +66,482 @@ nbsd_nat_target::pid_to_exec_file (int p
return NULL;
}
+
+/* Iterate over all the memory regions in the current inferior,
+ calling FUNC for each memory region. OBFD is passed as the last
+ argument to FUNC. */
+
+int
+nbsd_nat_target::find_memory_regions (find_memory_region_ftype func,
+ void *obfd)
+{
+ pid_t pid = inferior_ptid.pid ();
+ struct kinfo_vmentry *vmentl, *kve;
+ uint64_t size;
+ int i;
+ size_t nitems;
+
+ vmentl = kinfo_getvmmap (pid, &nitems);
+ if (vmentl == NULL)
+ perror_with_name (_("Couldn't fetch VM map entries."));
+
+ for (i = 0; i < nitems; i++)
+ {
+ kve = &vmentl[i];
+
+ /* Skip unreadable segments and those where MAP_NOCORE has been set. */
+ if (!(kve->kve_protection & KVME_PROT_READ)
+ || kve->kve_flags & KVME_FLAG_NOCOREDUMP)
+ continue;
+
+ /* Skip segments with an invalid type. */
+ switch (kve->kve_type) {
+ case KVME_TYPE_VNODE:
+ case KVME_TYPE_ANON:
+ case KVME_TYPE_SUBMAP:
+ case KVME_TYPE_OBJECT:
+ break;
+ default:
+ continue;
+ }
+
+ size = kve->kve_end - kve->kve_start;
+ if (info_verbose)
+ {
+ fprintf_filtered (gdb_stdout,
+ "Save segment, %ld bytes at %llx (%c%c%c)\n",
+ (long) size,
+ (long long int)kve->kve_start,
+ kve->kve_protection & KVME_PROT_READ ? 'r' : '-',
+ kve->kve_protection & KVME_PROT_WRITE ? 'w' : '-',
+ kve->kve_protection & KVME_PROT_EXEC ? 'x' : '-');
+ }
+
+ /* Invoke the callback function to create the corefile segment.
+ Pass MODIFIED as true, we do not know the real modification state. */
+ func (kve->kve_start, size, kve->kve_protection & KVME_PROT_READ,
+ kve->kve_protection & KVME_PROT_WRITE,
+ kve->kve_protection & KVME_PROT_EXEC, 1, obfd);
+ }
+ free(vmentl);
+ return 0;
+}
+
+static int debug_nbsd_lwp;
+
+static void
+show_nbsd_lwp_debug (struct ui_file *file, int from_tty,
+ struct cmd_list_element *c, const char *value)
+{
+ fprintf_filtered (file, _("Debugging of NetBSD lwp module is %s.\n"), value);
+}
+
+/* Return true if PTID is still active in the inferior. */
+
+bool
+nbsd_nat_target::thread_alive (ptid_t ptid)
+{
+ if (ptid.lwp_p ())
+ {
+ struct ptrace_lwpinfo pl;
+
+ pl.pl_lwpid = ptid.lwp ();
+ if (ptrace (PT_LWPINFO, ptid.pid (), (caddr_t) &pl, sizeof pl)
+ == -1)
+ return 0;
+ }
+
+ return 1;
+}
+
+/* Convert PTID to a string. Returns the string in a static
+ buffer. */
+
+std::string
+nbsd_nat_target::pid_to_str (ptid_t ptid)
+{
+ lwpid_t lwp;
+
+ lwp = ptid.lwp ();
+ if (lwp != 0)
+ {
+ static char buf[64];
+ int pid = ptid.pid ();
+
+ xsnprintf (buf, sizeof buf, "LWP %d of process %d", lwp, pid);
+ return buf;
+ }
+
+ return normal_pid_to_str (ptid);
+}
+
+/* Return the name assigned to a thread by an application. Returns
+ the string in a static buffer. */
+
+const char *
+nbsd_nat_target::thread_name (struct thread_info *thr)
+{
+ struct kinfo_lwp *kl;
+ pid_t pid = thr->ptid.pid ();
+ lwpid_t lwp = thr->ptid.lwp ();
+ static char buf[KI_LNAMELEN];
+ int mib[5];
+ size_t i, nlwps;
+ size_t size;
+
+ mib[0] = CTL_KERN;
+ mib[1] = KERN_LWP;
+ mib[2] = pid;
+ mib[3] = sizeof(struct kinfo_lwp);
+ mib[4] = 0;
+
+ if (sysctl(mib, 5, NULL, &size, NULL, 0) == -1 || size == 0)
+ perror_with_name (("sysctl"));
+
+ mib[4] = size / sizeof(size_t);
+
+ kl = (struct kinfo_lwp *) xmalloc (size);
+ if (kl == NULL)
+ perror_with_name (("malloc"));
+
+ if (sysctl(mib, 5, kl, &size, NULL, 0) == -1 || size == 0)
+ perror_with_name (("sysctl"));
+
+ nlwps = size / sizeof(struct kinfo_lwp);
+ buf[0] = '\0';
+ for (i = 0; i < nlwps; i++) {
+ if (kl[i].l_lid == lwp) {
+ xsnprintf (buf, sizeof buf, "%s", kl[i].l_name);
+ break;
+ }
+ }
+ xfree(kl);
+
+ return buf;
+}
+
+/* Enable additional event reporting on new processes. */
+
+static void
+nbsd_enable_proc_events (pid_t pid)
+{
+ int events;
+
+ if (ptrace (PT_GET_EVENT_MASK, pid, (PTRACE_TYPE_ARG3)&events,
+ sizeof (events)) == -1)
+ perror_with_name (("ptrace"));
+ events |= PTRACE_FORK;
+ events |= PTRACE_VFORK;
+ events |= PTRACE_VFORK_DONE;
+ events |= PTRACE_LWP_CREATE;
+ events |= PTRACE_LWP_EXIT;
+#if notyet
+ events |= PTRACE_POSIX_SPAWN;
+#endif
+ if (ptrace (PT_SET_EVENT_MASK, pid, (PTRACE_TYPE_ARG3)&events,
+ sizeof (events)) == -1)
+ perror_with_name (("ptrace"));
+}
+
+/* Add threads for any new LWPs in a process.
+
+ When LWP events are used, this function is only used to detect existing
+ threads when attaching to a process. On older systems, this function is
+ called to discover new threads each time the thread list is updated. */
+
+static void
+nbsd_add_threads (pid_t pid)
+{
+ int val;
+ struct ptrace_lwpinfo pl;
+
+ pl.pl_lwpid = 0;
+ while ((val = ptrace (PT_LWPINFO, pid, (void *)&pl, sizeof(pl))) != -1
+ && pl.pl_lwpid != 0)
+ {
+ ptid_t ptid = ptid_t (pid, pl.pl_lwpid, 0);
+ if (!in_thread_list (ptid))
+ {
+ if (inferior_ptid.lwp () == 0)
+ thread_change_ptid (inferior_ptid, ptid);
+ else
+ add_thread (ptid);
+ }
+ }
+}
+
+/* Implement the "to_update_thread_list" target_ops method. */
+
+void
+nbsd_nat_target::update_thread_list ()
+{
+ prune_threads ();
+
+ nbsd_add_threads (inferior_ptid.pid ());
+}
+
+
+struct nbsd_fork_info
+{
+ struct nbsd_fork_info *next;
+ ptid_t ptid;
+};
+
+void
+nbsd_nat_target::resume (ptid_t ptid, int step, enum gdb_signal signo)
+{
+ if (debug_nbsd_lwp)
+ fprintf_unfiltered (gdb_stdlog,
+ "NLWP: nbsd_resume for ptid (%d, %ld, %ld)\n",
+ ptid.pid (), ptid.lwp (), ptid.tid ());
+ if (ptid.pid () == -1)
+ ptid = inferior_ptid;
+ inf_ptrace_target::resume (ptid, step, signo);
+}
+
+/* Wait for the child specified by PTID to do something. Return the
+ process ID of the child, or MINUS_ONE_PTID in case of error; store
+ the status in *OURSTATUS. */
+
+ptid_t
+nbsd_nat_target::wait (ptid_t ptid, struct target_waitstatus *ourstatus,
+ int target_options)
+{
+ ptid_t wptid;
+
+ /*
+ * Always perform polling on exact PID, overwrite the default polling on
+ * WAIT_ANY.
+ *
+ * This avoids events reported in random order reported for FORK / VFORK.
+ *
+ * Polling on traced parent always simplifies the code.
+ */
+ ptid = inferior_ptid;
+
+ if (debug_nbsd_lwp)
+ fprintf_unfiltered (gdb_stdlog, "NLWP: calling super_wait (%d, %ld, %ld) target_options=%#x\n",
+ ptid.pid (), ptid.lwp (), ptid.tid (), target_options);
+
+ wptid = inf_ptrace_target::wait (ptid, ourstatus, target_options);
+
+ if (debug_nbsd_lwp)
+ fprintf_unfiltered (gdb_stdlog, "NLWP: returned from super_wait (%d, %ld, %ld) target_options=%#x with ourstatus->kind=%d\n",
+ ptid.pid (), ptid.lwp (), ptid.tid (),
+ target_options, ourstatus->kind);
+
+ if (ourstatus->kind == TARGET_WAITKIND_STOPPED)
+ {
+ ptrace_state_t pst;
+ ptrace_siginfo_t psi, child_psi;
+ int status;
+ pid_t pid, child, wchild;
+ ptid_t child_ptid;
+ lwpid_t lwp;
+
+ pid = wptid.pid ();
+ // Find the lwp that caused the wait status change
+ if (ptrace(PT_GET_SIGINFO, pid, &psi, sizeof(psi)) == -1)
+ perror_with_name (("ptrace"));
+
+ /* For whole-process signals pick random thread */
+ if (psi.psi_lwpid == 0) {
+ // XXX: Is this always valid?
+ lwp = inferior_ptid.lwp ();
+ } else {
+ lwp = psi.psi_lwpid;
+ }
+
+ wptid = ptid_t (pid, lwp, 0);
+
+ /* Set LWP in the process */
+ if (in_thread_list (ptid_t (pid))) {
+ if (debug_nbsd_lwp)
+ fprintf_unfiltered (gdb_stdlog,
+ "NLWP: using LWP %d for first thread\n",
+ lwp);
+ thread_change_ptid (ptid_t (pid), wptid);
+ }
+
+ if (debug_nbsd_lwp)
+ fprintf_unfiltered (gdb_stdlog,
+ "NLWP: received signal=%d si_code=%d in process=%d lwp=%d\n",
+ psi.psi_siginfo.si_signo, psi.psi_siginfo.si_code, pid, lwp);
+
+ switch (psi.psi_siginfo.si_signo) {
+ case SIGTRAP:
+ switch (psi.psi_siginfo.si_code) {
+ case TRAP_BRKPT:
+// lp->stop_reason = TARGET_STOPPED_BY_SW_BREAKPOINT;
+ break;
+ case TRAP_DBREG:
+// if (hardware_breakpoint_inserted_here_p (get_regcache_aspace (regcache), pc))
+// lp->stop_reason = TARGET_STOPPED_BY_HW_BREAKPOINT;
+// else
+// lp->stop_reason = TARGET_STOPPED_BY_WATCHPOINT;
+ break;
+ case TRAP_TRACE:
+// lp->stop_reason = TARGET_STOPPED_BY_SINGLE_STEP;
+ break;
+ case TRAP_SCE:
+ ourstatus->kind = TARGET_WAITKIND_SYSCALL_ENTRY;
+ ourstatus->value.syscall_number = psi.psi_siginfo.si_sysnum;
+ break;
+ case TRAP_SCX:
+ ourstatus->kind = TARGET_WAITKIND_SYSCALL_RETURN;
+ ourstatus->value.syscall_number = psi.psi_siginfo.si_sysnum;
+ break;
+ case TRAP_EXEC:
+ ourstatus->kind = TARGET_WAITKIND_EXECD;
+ ourstatus->value.execd_pathname = xstrdup(pid_to_exec_file (pid));
+ break;
+ case TRAP_LWP:
+ case TRAP_CHLD:
+ if (ptrace(PT_GET_PROCESS_STATE, pid, &pst, sizeof(pst)) == -1)
+ perror_with_name (("ptrace"));
+ switch (pst.pe_report_event) {
+ case PTRACE_FORK:
+ case PTRACE_VFORK:
+ if (pst.pe_report_event == PTRACE_FORK)
+ ourstatus->kind = TARGET_WAITKIND_FORKED;
+ else
+ ourstatus->kind = TARGET_WAITKIND_VFORKED;
+ child = pst.pe_other_pid;
+
+ if (debug_nbsd_lwp)
+ fprintf_unfiltered (gdb_stdlog,
+ "NLWP: registered %s event for PID %d\n",
+ (pst.pe_report_event == PTRACE_FORK) ? "FORK" : "VFORK", child);
+
+ wchild = waitpid (child, &status, 0);
+
+ if (wchild == -1)
+ perror_with_name (("waitpid"));
+
+ gdb_assert (wchild == child);
+
+ if (!WIFSTOPPED(status)) {
+ /* Abnormal situation (SIGKILLed?).. bail out */
+ ourstatus->kind = TARGET_WAITKIND_SPURIOUS;
+ return wptid;
+ }
+
+ if (ptrace(PT_GET_SIGINFO, child, &child_psi, sizeof(child_psi)) == -1)
+ perror_with_name (("ptrace"));
+
+ if (child_psi.psi_siginfo.si_signo != SIGTRAP) {
+ /* Abnormal situation.. bail out */
+ ourstatus->kind = TARGET_WAITKIND_SPURIOUS;
+ return wptid;
+ }
+
+ if (child_psi.psi_siginfo.si_code != TRAP_CHLD) {
+ /* Abnormal situation.. bail out */
+ ourstatus->kind = TARGET_WAITKIND_SPURIOUS;
+ return wptid;
+ }
+
+ child_ptid = ptid_t (child, child_psi.psi_lwpid, 0);
+ nbsd_enable_proc_events (child_ptid.pid ());
+ ourstatus->value.related_pid = child_ptid;
+ break;
+ case PTRACE_VFORK_DONE:
+ ourstatus->kind = TARGET_WAITKIND_VFORK_DONE;
+ if (debug_nbsd_lwp)
+ fprintf_unfiltered (gdb_stdlog, "NLWP: reported VFORK_DONE parent=%d child=%d\n", pid, pst.pe_other_pid);
+ break;
+ case PTRACE_LWP_CREATE:
+ wptid = ptid_t (pid, pst.pe_lwp, 0);
+ if (in_thread_list (wptid)) {
+ /* Newborn reported after attach? */
+ ourstatus->kind = TARGET_WAITKIND_SPURIOUS;
+ return wptid;
+ }
+ if (inferior_ptid.lwp () == 0)
+ thread_change_ptid (inferior_ptid, wptid);
+ else
+ add_thread (wptid);
+ ourstatus->kind = TARGET_WAITKIND_THREAD_CREATED;
+ if (debug_nbsd_lwp)
+ fprintf_unfiltered (gdb_stdlog, "NLWP: created LWP %d\n", pst.pe_lwp);
+ break;
+ case PTRACE_LWP_EXIT:
+ wptid = ptid_t (pid, pst.pe_lwp, 0);
+ if (!in_thread_list (wptid)) {
+ /* Dead child reported after attach? */
+ ourstatus->kind = TARGET_WAITKIND_SPURIOUS;
+ return wptid;
+ }
+ delete_thread (find_thread_ptid (wptid));
+ ourstatus->kind = TARGET_WAITKIND_THREAD_EXITED;
+ if (debug_nbsd_lwp)
+ fprintf_unfiltered (gdb_stdlog, "NLWP: exited LWP %d\n", pst.pe_lwp);
+ if (ptrace (PT_CONTINUE, pid, (void *)1, 0) == -1)
+ perror_with_name (("ptrace"));
+ break;
+ }
+ break;
+ }
+ break;
+ }
+
+ if (debug_nbsd_lwp)
+ fprintf_unfiltered (gdb_stdlog,
+ "NLWP: nbsd_wait returned (%d, %ld, %ld)\n",
+ wptid.pid (), wptid.lwp (),
+ wptid.tid ());
+ inferior_ptid = wptid;
+
+ }
+ return wptid;
+}
+
+/* Target hook for follow_fork. On entry and at return inferior_ptid is
+ the ptid of the followed inferior. */
+
+int
+nbsd_nat_target::follow_fork (int follow_child, int detach_fork)
+{
+ if (!follow_child && detach_fork)
+ {
+ struct thread_info *tp = inferior_thread ();
+ pid_t child_pid = tp->pending_follow.value.related_pid.pid ();
+
+ /* Breakpoints have already been detached from the child by
+ infrun.c. */
+
+ if (ptrace (PT_DETACH, child_pid, (PTRACE_TYPE_ARG3)1, 0) == -1)
+ perror_with_name (("ptrace"));
+ }
+
+ return 0;
+}
+
+void
+nbsd_nat_target::post_startup_inferior (ptid_t pid)
+{
+ nbsd_enable_proc_events (pid.pid ());
+}
+
+void
+nbsd_nat_target::post_attach (int pid)
+{
+ nbsd_enable_proc_events (pid);
+ nbsd_add_threads (pid);
+}
+
+/* Provide a prototype to silence -Wmissing-prototypes. */
+extern initialize_file_ftype _initialize_nbsd_nat;
+
+void
+_initialize_nbsd_nat (void)
+{
+ add_setshow_boolean_cmd ("nbsd-lwp", class_maintenance,
+ &debug_nbsd_lwp, _("\
+Set debugging of NetBSD lwp module."), _("\
+Show debugging of NetBSD lwp module."), _("\
+Enables printf debugging output."),
+ NULL,
+ &show_nbsd_lwp_debug,
+ &setdebuglist, &showdebuglist);
+}

View File

@ -0,0 +1,32 @@
$NetBSD$
--- gdb/nbsd-nat.h.orig 2019-07-16 00:00:27.000000000 +0000
+++ gdb/nbsd-nat.h
@@ -27,6 +27,27 @@
struct nbsd_nat_target : public inf_ptrace_target
{
char *pid_to_exec_file (int pid) override;
+ int find_memory_regions (find_memory_region_ftype func, void *data) override;
+
+ bool thread_alive (ptid_t ptid) override;
+ std::string pid_to_str (ptid_t) override;
+
+ const char *thread_name (struct thread_info *) override;
+
+ void update_thread_list () override;
+
+ thread_control_capabilities get_thread_control_capabilities () override
+ { return tc_schedlock; }
+
+ void resume (ptid_t, int, enum gdb_signal) override;
+
+ ptid_t wait (ptid_t, struct target_waitstatus *, int) override;
+
+ void post_startup_inferior (ptid_t) override;
+ void post_attach (int) override;
+
+ int follow_fork (int, int) override;
+
};
#endif /* nbsd-nat.h */

View File

@ -0,0 +1,41 @@
$NetBSD$
--- gdb/nbsd-tdep.c.orig 2019-07-16 00:00:27.000000000 +0000
+++ gdb/nbsd-tdep.c
@@ -3,9 +3,9 @@
Copyright (C) 2002-2019 Free Software Foundation, Inc.
Contributed by Wasabi Systems, Inc.
-
+
This file is part of GDB.
-
+
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
@@ -20,6 +20,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include "defs.h"
+#include "objfiles.h"
#include "solib-svr4.h"
#include "nbsd-tdep.h"
@@ -47,3 +48,16 @@ nbsd_pc_in_sigtramp (CORE_ADDR pc, const
return (func_name != NULL
&& startswith (func_name, "__sigtramp"));
}
+
+CORE_ADDR
+nbsd_skip_solib_resolver (struct gdbarch *gdbarch, CORE_ADDR pc)
+{
+ struct bound_minimal_symbol msym;
+
+ msym = lookup_minimal_symbol("_rtld_bind_start", NULL, NULL);
+ if (msym.minsym && BMSYMBOL_VALUE_ADDRESS (msym) == pc)
+ return frame_unwind_caller_pc (get_current_frame ());
+ else
+ return find_solib_trampoline_target (get_current_frame (), pc);
+}
+

View File

@ -0,0 +1,11 @@
$NetBSD$
--- gdb/nbsd-tdep.h.orig 2019-07-16 00:00:27.000000000 +0000
+++ gdb/nbsd-tdep.h
@@ -25,4 +25,6 @@ struct link_map_offsets *nbsd_lp64_solib
int nbsd_pc_in_sigtramp (CORE_ADDR, const char *);
+CORE_ADDR nbsd_skip_solib_resolver (struct gdbarch *gdbarch,
+ CORE_ADDR pc);
#endif /* NBSD_TDEP_H */

View File

@ -0,0 +1,26 @@
$NetBSD$
--- gdb/objfiles.c.orig 2019-07-16 00:00:27.000000000 +0000
+++ gdb/objfiles.c
@@ -1123,6 +1123,13 @@ static int
insert_section_p (const struct bfd *abfd,
const struct bfd_section *section)
{
+#ifndef __NetBSD__
+ /*
+ * On NetBSD we don't typically have overlay sections and in some of
+ * our kernels (i386 vma = lma | 0xc0000000), so the following test
+ * makes kernels not load any symbols. There must be a better way to
+ * detect overlays.
+ */
const bfd_vma lma = bfd_section_lma (abfd, section);
if (overlay_debugging && lma != 0 && lma != bfd_section_vma (abfd, section)
@@ -1131,6 +1138,7 @@ insert_section_p (const struct bfd *abfd
discarding sections from the "system supplied DSO" (aka vdso)
on some Linux systems (e.g. Fedora 11). */
return 0;
+#endif
if ((bfd_get_section_flags (abfd, section) & SEC_THREAD_LOCAL) != 0)
/* This is a TLS section. */
return 0;

View File

@ -0,0 +1,13 @@
$NetBSD$
--- gdb/p-exp.y.orig 2019-07-16 00:00:27.000000000 +0000
+++ gdb/p-exp.y
@@ -1516,7 +1516,7 @@ yylex (void)
{
std::string tmp = copy_name (yylval.sval);
struct symbol *sym;
- struct field_of_this_result is_a_field_of_this;
+ struct field_of_this_result is_a_field_of_this = { .type = NULL };
int is_a_field = 0;
int hextype;

View File

@ -0,0 +1,130 @@
$NetBSD$
--- gdb/ppc-nbsd-nat.c.orig 2019-07-16 00:00:27.000000000 +0000
+++ gdb/ppc-nbsd-nat.c
@@ -19,6 +19,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
+#define _KMEMUSER
#include "defs.h"
#include <sys/types.h>
@@ -31,12 +32,15 @@
#include "inferior.h"
#include "regcache.h"
+#include "common/gdb_assert.h"
+
+#include "nbsd-nat.h"
#include "ppc-tdep.h"
#include "ppc-nbsd-tdep.h"
#include "bsd-kvm.h"
#include "inf-ptrace.h"
-struct ppc_nbsd_nat_target final : public inf_ptrace_target
+struct ppc_nbsd_nat_target final : public nbsd_nat_target
{
void fetch_registers (struct regcache *, int) override;
void store_registers (struct regcache *, int) override;
@@ -88,13 +92,15 @@ void
ppc_nbsd_nat_target::fetch_registers (struct regcache *regcache, int regnum)
{
struct gdbarch *gdbarch = regcache->arch ();
- pid_t pid = regcache->ptid ().pid ();
+ ptid_t ptid = regcache->ptid ();
+ pid_t pid = ptid.pid ();
+ int lwp = ptid.lwp ();
if (regnum == -1 || getregs_supplies (gdbarch, regnum))
{
struct reg regs;
- if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) &regs, 0) == -1)
+ if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) &regs, lwp) == -1)
perror_with_name (_("Couldn't get registers"));
ppc_supply_gregset (&ppcnbsd_gregset, regcache,
@@ -105,7 +111,7 @@ ppc_nbsd_nat_target::fetch_registers (st
{
struct fpreg fpregs;
- if (ptrace (PT_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
+ if (ptrace (PT_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, lwp) == -1)
perror_with_name (_("Couldn't get FP registers"));
ppc_supply_fpregset (&ppcnbsd_fpregset, regcache,
@@ -117,19 +123,21 @@ void
ppc_nbsd_nat_target::store_registers (struct regcache *regcache, int regnum)
{
struct gdbarch *gdbarch = regcache->arch ();
- pid_t pid = regcache->ptid ().pid ();
+ ptid_t ptid = regcache->ptid ();
+ pid_t pid = ptid.pid ();
+ int lwp = ptid.lwp ();
if (regnum == -1 || getregs_supplies (gdbarch, regnum))
{
struct reg regs;
- if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) &regs, 0) == -1)
+ if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) &regs, lwp) == -1)
perror_with_name (_("Couldn't get registers"));
ppc_collect_gregset (&ppcnbsd_gregset, regcache,
regnum, &regs, sizeof regs);
- if (ptrace (PT_SETREGS, pid, (PTRACE_TYPE_ARG3) &regs, 0) == -1)
+ if (ptrace (PT_SETREGS, pid, (PTRACE_TYPE_ARG3) &regs, lwp) == -1)
perror_with_name (_("Couldn't write registers"));
}
@@ -137,13 +145,13 @@ ppc_nbsd_nat_target::store_registers (st
{
struct fpreg fpregs;
- if (ptrace (PT_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
+ if (ptrace (PT_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, lwp) == -1)
perror_with_name (_("Couldn't get FP registers"));
ppc_collect_fpregset (&ppcnbsd_fpregset, regcache,
regnum, &fpregs, sizeof fpregs);
- if (ptrace (PT_SETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
+ if (ptrace (PT_SETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, lwp) == -1)
perror_with_name (_("Couldn't set FP registers"));
}
}
@@ -161,20 +169,20 @@ ppcnbsd_supply_pcb (struct regcache *reg
if (pcb->pcb_sp == 0)
return 0;
- read_memory (pcb->pcb_sp, (gdb_byte *)&sf, sizeof sf);
- regcache->raw_supply (tdep->ppc_cr_regnum, &sf.cr);
- regcache->raw_supply (tdep->ppc_gp0_regnum + 2, &sf.fixreg2);
+ read_memory (pcb->pcb_sp, (gdb_byte *)&sf, sizeof(sf));
+ regcache->raw_supply (tdep->ppc_cr_regnum, &sf.sf_cr);
+ regcache->raw_supply (tdep->ppc_gp0_regnum + 2, &sf.sf_fixreg2);
for (i = 0 ; i < 19 ; i++)
- regcache->raw_supply (tdep->ppc_gp0_regnum + 13 + i, &sf.fixreg[i]);
+ regcache->raw_supply (tdep->ppc_gp0_regnum + 13 + i, &sf.sf_fixreg[i]);
- read_memory(sf.sp, (gdb_byte *)&cf, sizeof(cf));
- regcache->raw_supply (tdep->ppc_gp0_regnum + 30, &cf.r30);
- regcache->raw_supply (tdep->ppc_gp0_regnum + 31, &cf.r31);
- regcache->raw_supply (tdep->ppc_gp0_regnum + 1, &cf.sp);
-
- read_memory(cf.sp, (gdb_byte *)&cf, sizeof(cf));
- regcache->raw_supply (tdep->ppc_lr_regnum, &cf.lr);
- regcache->raw_supply (gdbarch_pc_regnum (gdbarch), &cf.lr);
+ read_memory(sf.sf_sp, (gdb_byte *)&cf, sizeof(cf));
+ regcache->raw_supply (tdep->ppc_gp0_regnum + 30, &cf.cf_r30);
+ regcache->raw_supply (tdep->ppc_gp0_regnum + 31, &cf.cf_r31);
+ regcache->raw_supply (tdep->ppc_gp0_regnum + 1, &cf.cf_sp);
+
+ read_memory(cf.cf_sp, (gdb_byte *)&cf, sizeof(cf));
+ regcache->raw_supply (tdep->ppc_lr_regnum, &cf.cf_lr);
+ regcache->raw_supply (gdbarch_pc_regnum (gdbarch), &cf.cf_lr);
return 1;
}

View File

@ -0,0 +1,13 @@
$NetBSD$
--- gdb/ppc-nbsd-tdep.c.orig 2019-07-16 00:00:27.000000000 +0000
+++ gdb/ppc-nbsd-tdep.c
@@ -195,7 +195,7 @@ _initialize_ppcnbsd_tdep (void)
ppcnbsd_init_abi);
/* Avoid initializing the register offsets again if they were
- already initialized by ppcnbsd-nat.c. */
+ already initailized by ppcnbsd-nat.c. */
if (ppcnbsd_reg_offsets.pc_offset == 0)
{
/* General-purpose registers. */

View File

@ -0,0 +1,10 @@
$NetBSD$
--- gdb/ppc-nbsd-tdep.h.orig 2019-07-16 00:00:27.000000000 +0000
+++ gdb/ppc-nbsd-tdep.h
@@ -29,4 +29,4 @@ extern struct ppc_reg_offsets ppcnbsd_re
extern const struct regset ppcnbsd_gregset;
extern const struct regset ppcnbsd_fpregset;
-#endif /* ppc-nbsd-tdep.h */
+#endif /* PPC_NBSD_TDEP_H */

View File

@ -0,0 +1,81 @@
$NetBSD$
--- gdb/sh-nbsd-nat.c.orig 2019-07-16 00:00:27.000000000 +0000
+++ gdb/sh-nbsd-nat.c
@@ -29,8 +29,10 @@
#include "sh-tdep.h"
#include "inf-ptrace.h"
#include "regcache.h"
+#include "inf-ptrace.h"
+#include "nbsd-nat.h"
-struct sh_nbsd_nat_target final : public inf_ptrace_target
+struct sh_nbsd_nat_target final : public nbsd_nat_target
{
void fetch_registers (struct regcache *, int) override;
void store_registers (struct regcache *, int) override;
@@ -43,26 +45,27 @@ static sh_nbsd_nat_target the_sh_nbsd_na
(((regno) >= R0_REGNUM && (regno) <= (R0_REGNUM + 15)) \
|| (regno) == gdbarch_pc_regnum (gdbarch) || (regno) == PR_REGNUM \
|| (regno) == MACH_REGNUM || (regno) == MACL_REGNUM \
-|| (regno) == SR_REGNUM)
+|| (regno) == SR_REGNUM || (regno) == GBR_REGNUM)
/* Sizeof `struct reg' in <machine/reg.h>. */
-#define SHNBSD_SIZEOF_GREGS (21 * 4)
+#define SHNBSD_SIZEOF_GREGS (22 * 4)
void
sh_nbsd_nat_target::fetch_registers (struct regcache *regcache, int regno)
{
- pid_t pid = regcache->ptid ().pid ();
+ ptid_t ptid = regcache->ptid ();
+ pid_t pid = ptid.pid ();
+ int lwp = ptid.lwp ();
if (regno == -1 || GETREGS_SUPPLIES (regcache->arch (), regno))
{
- struct reg inferior_registers;
+ struct reg regs;
- if (ptrace (PT_GETREGS, pid,
- (PTRACE_TYPE_ARG3) &inferior_registers, 0) == -1)
+ if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) &regs, lwp) == -1)
perror_with_name (_("Couldn't get registers"));
sh_corefile_supply_regset (&sh_corefile_gregset, regcache, regno,
- (char *) &inferior_registers,
+ (char *) &regs,
SHNBSD_SIZEOF_GREGS);
if (regno != -1)
@@ -73,22 +76,22 @@ sh_nbsd_nat_target::fetch_registers (str
void
sh_nbsd_nat_target::store_registers (struct regcache *regcache, int regno)
{
- pid_t pid = regcache->ptid ().pid ();
+ ptid_t ptid = regcache->ptid ();
+ pid_t pid = ptid.pid ();
+ int lwp = ptid.lwp ();
if (regno == -1 || GETREGS_SUPPLIES (regcache->arch (), regno))
{
- struct reg inferior_registers;
+ struct reg regs;
- if (ptrace (PT_GETREGS, pid,
- (PTRACE_TYPE_ARG3) &inferior_registers, 0) == -1)
+ if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) &regs, lwp) == -1)
perror_with_name (_("Couldn't get registers"));
sh_corefile_collect_regset (&sh_corefile_gregset, regcache, regno,
- (char *) &inferior_registers,
+ (char *) &regs,
SHNBSD_SIZEOF_GREGS);
- if (ptrace (PT_SETREGS, pid,
- (PTRACE_TYPE_ARG3) &inferior_registers, 0) == -1)
+ if (ptrace (PT_SETREGS, pid, (PTRACE_TYPE_ARG3) &regs, lwp) == -1)
perror_with_name (_("Couldn't set registers"));
if (regno != -1)

View File

@ -0,0 +1,197 @@
$NetBSD$
--- gdb/sh-nbsd-tdep.c.orig 2019-07-16 00:00:27.000000000 +0000
+++ gdb/sh-nbsd-tdep.c
@@ -21,17 +21,26 @@
#include "defs.h"
#include "gdbcore.h"
+#include "inferior.h"
+#include "regcache.h"
#include "regset.h"
#include "value.h"
#include "osabi.h"
-#include "sh-tdep.h"
+#include "trad-frame.h"
+#include "tramp-frame.h"
+
+#include "common/gdb_assert.h"
#include "solib-svr4.h"
+#include "sh-tdep.h"
+#include "sh-nbsd-tdep.h"
+#include "nbsd-tdep.h"
+
#include "gdbarch.h"
/* Convert a register number into an offset into a ptrace
register structure. */
-static const struct sh_corefile_regmap regmap[] =
+static const struct sh_corefile_regmap gregs_table[] =
{
{R0_REGNUM, 20 * 4},
{R0_REGNUM + 1, 19 * 4},
@@ -54,9 +63,136 @@ static const struct sh_corefile_regmap r
{PR_REGNUM, 2 * 4},
{MACH_REGNUM, 3 * 4},
{MACL_REGNUM, 4 * 4},
+ {GBR_REGNUM, 21 * 4},
{-1 /* Terminator. */, 0}
};
+
+
+#define REGSx16(base) \
+ {(base), 0}, \
+ {(base) + 1, 4}, \
+ {(base) + 2, 8}, \
+ {(base) + 3, 12}, \
+ {(base) + 4, 16}, \
+ {(base) + 5, 20}, \
+ {(base) + 6, 24}, \
+ {(base) + 7, 28}, \
+ {(base) + 8, 32}, \
+ {(base) + 9, 36}, \
+ {(base) + 10, 40}, \
+ {(base) + 11, 44}, \
+ {(base) + 12, 48}, \
+ {(base) + 13, 52}, \
+ {(base) + 14, 56}, \
+ {(base) + 15, 60}
+
+/* Convert an FPU register number into an offset into a ptrace
+ register structure. */
+static const struct sh_corefile_regmap fpregs_table[] =
+{
+ REGSx16 (FR0_REGNUM),
+ /* XXX: REGSx16(XF0_REGNUM) omitted. */
+ {FPSCR_REGNUM, 128},
+ {FPUL_REGNUM, 132},
+ {-1 /* Terminator. */, 0}
+};
+
+
+/* From <machine/mcontext.h>. */
+static const int shnbsd_mc_reg_offset[] =
+{
+ (20 * 4), /* r0 */
+ (19 * 4), /* r1 */
+ (18 * 4), /* r2 */
+ (17 * 4), /* r3 */
+ (16 * 4), /* r4 */
+ (15 * 4), /* r5 */
+ (14 * 4), /* r6 */
+ (13 * 4), /* r7 */
+ (12 * 4), /* r8 */
+ (11 * 4), /* r9 */
+ (10 * 4), /* r10 */
+ ( 9 * 4), /* r11 */
+ ( 8 * 4), /* r12 */
+ ( 7 * 4), /* r13 */
+ ( 6 * 4), /* r14 */
+ (21 * 4), /* r15/sp */
+ ( 1 * 4), /* pc */
+ ( 5 * 4), /* pr */
+ ( 0 * 4), /* gbr */
+ -1,
+ ( 4 * 4), /* mach */
+ ( 3 * 4), /* macl */
+ ( 2 * 4), /* sr */
+};
+
+/* SH register sets. */
+
+static void
+shnbsd_sigtramp_cache_init (const struct tramp_frame *,
+ struct frame_info *,
+ struct trad_frame_cache *,
+ CORE_ADDR);
+
+/* The siginfo signal trampoline for NetBSD/sh3 versions 2.0 and later */
+static const struct tramp_frame shnbsd_sigtramp_si2 =
+{
+ SIGTRAMP_FRAME,
+ 2,
+ {
+ { 0x64f3, ULONGEST_MAX }, /* mov r15,r4 */
+ { 0xd002, ULONGEST_MAX }, /* mov.l .LSYS_setcontext */
+ { 0xc380, ULONGEST_MAX }, /* trapa #-128 */
+ { 0xa003, ULONGEST_MAX }, /* bra .Lskip1 */
+ { 0x0009, ULONGEST_MAX }, /* nop */
+ { 0x0009, ULONGEST_MAX }, /* nop */
+ /* .LSYS_setcontext */
+ { 0x0134, ULONGEST_MAX }, { 0x0000, ULONGEST_MAX }, /* 0x134 */
+ /* .Lskip1 */
+ { 0x6403, ULONGEST_MAX }, /* mov r0,r4 */
+ { 0xd002, ULONGEST_MAX }, /* mov.l .LSYS_exit */
+ { 0xc380, ULONGEST_MAX }, /* trapa #-128 */
+ { 0xa003, ULONGEST_MAX }, /* bra .Lskip2 */
+ { 0x0009, ULONGEST_MAX }, /* nop */
+ { 0x0009, ULONGEST_MAX }, /* nop */
+ /* .LSYS_exit */
+ { 0x0001, ULONGEST_MAX }, { 0x0000, ULONGEST_MAX }, /* 0x1 */
+/* .Lskip2 */
+ { TRAMP_SENTINEL_INSN, ULONGEST_MAX }
+ },
+ shnbsd_sigtramp_cache_init
+};
+
+static void
+shnbsd_sigtramp_cache_init (const struct tramp_frame *self,
+ struct frame_info *next_frame,
+ struct trad_frame_cache *this_cache,
+ CORE_ADDR func)
+{
+ struct gdbarch *gdbarch = get_frame_arch (next_frame);
+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ int sp_regnum = gdbarch_sp_regnum (gdbarch);
+ CORE_ADDR sp = get_frame_register_unsigned (next_frame, sp_regnum);
+ CORE_ADDR base;
+ const int *reg_offset;
+ int num_regs;
+ int i;
+
+ reg_offset = shnbsd_mc_reg_offset;
+ num_regs = ARRAY_SIZE (shnbsd_mc_reg_offset);
+ /* SP already points at the ucontext. */
+ base = sp;
+ /* offsetof(ucontext_t, uc_mcontext) == 36 */
+ base += 36;
+
+ for (i = 0; i < num_regs; i++)
+ if (reg_offset[i] != -1)
+ trad_frame_set_reg_addr (this_cache, i, base + reg_offset[i]);
+
+ /* Construct the frame ID using the function start. */
+ trad_frame_set_id (this_cache, frame_id_build (sp, func));
+}
static void
shnbsd_init_abi (struct gdbarch_info info,
@@ -64,11 +200,16 @@ shnbsd_init_abi (struct gdbarch_info inf
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
- tdep->core_gregmap = (struct sh_corefile_regmap *)regmap;
- tdep->sizeof_gregset = 84;
+ tdep->core_gregmap = (struct sh_corefile_regmap *)gregs_table;
+ tdep->sizeof_gregset = 88;
+
+ tdep->core_fpregmap = (struct sh_corefile_regmap *)fpregs_table;
+ tdep->sizeof_fpregset = 0; /* XXX */
set_solib_svr4_fetch_link_map_offsets
- (gdbarch, svr4_ilp32_fetch_link_map_offsets);
+ (gdbarch, nbsd_ilp32_solib_svr4_fetch_link_map_offsets);
+
+ tramp_frame_prepend_unwinder (gdbarch, &shnbsd_sigtramp_si2);
}
void
@@ -76,6 +217,4 @@ _initialize_shnbsd_tdep (void)
{
gdbarch_register_osabi (bfd_arch_sh, 0, GDB_OSABI_NETBSD,
shnbsd_init_abi);
- gdbarch_register_osabi (bfd_arch_sh, 0, GDB_OSABI_OPENBSD,
- shnbsd_init_abi);
}

View File

@ -0,0 +1,33 @@
$NetBSD$
--- gdb/sh-nbsd-tdep.h.orig 2019-09-02 20:02:23.509331057 +0000
+++ gdb/sh-nbsd-tdep.h
@@ -0,0 +1,28 @@
+/* Target-dependent definitions for SuperH running NetBSD, for GDB.
+ Copyright (C) 2002 Free Software Foundation, Inc.
+ Contributed by Wasabi Systems, Inc.
+
+ This file is part of GDB.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA. */
+
+#ifndef SH_NBSD_TDEP_H
+#define SH_NBSD_TDEP_H
+
+void shnbsd_supply_reg (struct regcache *, const char *, int);
+void shnbsd_fill_reg (const struct regcache *, char *, int);
+
+#endif /* SH_NBSD_TDEP_H */

View File

@ -0,0 +1,80 @@
$NetBSD$
--- gdb/sparc-nat.c.orig 2019-07-16 00:00:27.000000000 +0000
+++ gdb/sparc-nat.c
@@ -138,6 +138,7 @@ sparc_fetch_inferior_registers (struct r
{
struct gdbarch *gdbarch = regcache->arch ();
pid_t pid;
+ int lwp = regcache->ptid ().lwp ();
/* NOTE: cagney/2002-12-03: This code assumes that the currently
selected light weight processes' registers can be written
@@ -166,7 +167,7 @@ sparc_fetch_inferior_registers (struct r
{
gregset_t regs;
- if (ptrace (PTRACE_GETREGS, pid, (PTRACE_TYPE_ARG3) &regs, 0) == -1)
+ if (ptrace (PTRACE_GETREGS, pid, (PTRACE_TYPE_ARG3) &regs, lwp) == -1)
perror_with_name (_("Couldn't get registers"));
sparc_supply_gregset (sparc_gregmap, regcache, -1, &regs);
@@ -178,7 +179,7 @@ sparc_fetch_inferior_registers (struct r
{
fpregset_t fpregs;
- if (ptrace (PTRACE_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
+ if (ptrace (PTRACE_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, lwp) == -1)
perror_with_name (_("Couldn't get floating point status"));
sparc_supply_fpregset (sparc_fpregmap, regcache, -1, &fpregs);
@@ -190,6 +191,7 @@ sparc_store_inferior_registers (struct r
{
struct gdbarch *gdbarch = regcache->arch ();
pid_t pid;
+ int lwp = regcache->ptid ().lwp ();
/* NOTE: cagney/2002-12-02: See comment in fetch_inferior_registers
about threaded assumptions. */
@@ -199,12 +201,12 @@ sparc_store_inferior_registers (struct r
{
gregset_t regs;
- if (ptrace (PTRACE_GETREGS, pid, (PTRACE_TYPE_ARG3) &regs, 0) == -1)
+ if (ptrace (PTRACE_GETREGS, pid, (PTRACE_TYPE_ARG3) &regs, lwp) == -1)
perror_with_name (_("Couldn't get registers"));
sparc_collect_gregset (sparc_gregmap, regcache, regnum, &regs);
- if (ptrace (PTRACE_SETREGS, pid, (PTRACE_TYPE_ARG3) &regs, 0) == -1)
+ if (ptrace (PTRACE_SETREGS, pid, (PTRACE_TYPE_ARG3) &regs, inferior_ptid.lwp ()) == -1)
perror_with_name (_("Couldn't write registers"));
/* Deal with the stack regs. */
@@ -225,7 +227,7 @@ sparc_store_inferior_registers (struct r
{
fpregset_t fpregs, saved_fpregs;
- if (ptrace (PTRACE_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
+ if (ptrace (PTRACE_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, lwp) == -1)
perror_with_name (_("Couldn't get floating-point registers"));
memcpy (&saved_fpregs, &fpregs, sizeof (fpregs));
@@ -238,7 +240,7 @@ sparc_store_inferior_registers (struct r
if (memcmp (&saved_fpregs, &fpregs, sizeof (fpregs)) != 0)
{
if (ptrace (PTRACE_SETFPREGS, pid,
- (PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
+ (PTRACE_TYPE_ARG3) &fpregs, lwp) == -1)
perror_with_name (_("Couldn't write floating-point registers"));
}
@@ -252,7 +254,7 @@ sparc_store_inferior_registers (struct r
TARGET_OBJECT_WCOOKIE. Fetch StackGhost Per-Process XOR cookie. */
enum target_xfer_status
-sparc_xfer_wcookie (struct target_ops *ops, enum target_object object,
+sparc_xfer_wcookie (enum target_object object,
const char *annex, gdb_byte *readbuf,
const gdb_byte *writebuf, ULONGEST offset, ULONGEST len,
ULONGEST *xfered_len)

View File

@ -0,0 +1,13 @@
$NetBSD$
--- gdb/sparc-nat.h.orig 2019-07-16 00:00:27.000000000 +0000
+++ gdb/sparc-nat.h
@@ -75,7 +75,7 @@ struct sparc_target : public BaseTarget
return sparc_xfer_wcookie (object, annex, readbuf, writebuf,
offset, len, xfered_len);
- return BaseTarget (object, annex, readbuf, writebuf,
+ return BaseTarget::xfer_partial (object, annex, readbuf, writebuf,
offset, len, xfered_len);
}
};

View File

@ -0,0 +1,39 @@
$NetBSD$
--- gdb/sparc-nbsd-nat.c.orig 2019-07-16 00:00:27.000000000 +0000
+++ gdb/sparc-nbsd-nat.c
@@ -21,13 +21,16 @@
#include "regcache.h"
#include "target.h"
+#include "nbsd-nat.h"
#include "sparc-tdep.h"
+#include "sparc-nbsd-tdep.h"
#include "sparc-nat.h"
/* Support for debugging kernel virtual memory images. */
#include <sys/types.h>
#include <machine/pcb.h>
+#include <machine/reg.h>
#include "bsd-kvm.h"
@@ -55,7 +58,7 @@ sparc32nbsd_supply_pcb (struct regcache
return 1;
}
-static sparc_target<inf_ptrace_target> the_sparc_nbsd_nat_target;
+static sparc_target<nbsd_nat_target> the_sparc_nbsd_nat_target;
void
_initialize_sparcnbsd_nat (void)
@@ -63,7 +66,7 @@ _initialize_sparcnbsd_nat (void)
sparc_gregmap = &sparc32nbsd_gregmap;
sparc_fpregmap = &sparc32_bsd_fpregmap;
- add_inf_child_target (&sparc_nbsd_nat_target);
+ add_inf_child_target (&the_sparc_nbsd_nat_target);
/* Support debugging kernel virtual memory images. */
bsd_kvm_add_target (sparc32nbsd_supply_pcb);

View File

@ -0,0 +1,41 @@
$NetBSD$
--- gdb/sparc-nbsd-tdep.c.orig 2019-07-16 00:00:27.000000000 +0000
+++ gdb/sparc-nbsd-tdep.c
@@ -32,6 +32,7 @@
#include "gdbarch.h"
#include "sparc-tdep.h"
+#include "sparc-nbsd-tdep.h"
#include "nbsd-tdep.h"
/* Macros to extract fields from SPARC instructions. */
@@ -291,7 +292,7 @@ static const struct regset sparc32nbsd_f
NULL, sparc32nbsd_supply_fpregset, NULL
};
-void
+static void
sparc32nbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
@@ -310,6 +311,12 @@ sparc32nbsd_init_abi (struct gdbarch_inf
tdep->step_trap = sparcnbsd_step_trap;
frame_unwind_append_unwinder (gdbarch, &sparc32nbsd_sigcontext_frame_unwind);
+}
+
+void
+sparc32nbsd_elf_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
+{
+ sparc32nbsd_init_abi (info, gdbarch);
set_solib_svr4_fetch_link_map_offsets
(gdbarch, svr4_ilp32_fetch_link_map_offsets);
@@ -319,5 +326,5 @@ void
_initialize_sparcnbsd_tdep (void)
{
gdbarch_register_osabi (bfd_arch_sparc, 0, GDB_OSABI_NETBSD,
- sparc32nbsd_init_abi);
+ sparc32nbsd_elf_init_abi);
}

View File

@ -0,0 +1,40 @@
$NetBSD$
--- gdb/sparc-nbsd-tdep.h.orig 2019-09-02 20:02:23.510217820 +0000
+++ gdb/sparc-nbsd-tdep.h
@@ -0,0 +1,35 @@
+/* Target-dependent definitions for sparc running NetBSD, for GDB.
+ Copyright (C) 2017 Free Software Foundation, Inc.
+
+ This file is part of GDB.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA. */
+
+#ifndef SPARC_NBSD_TDEP_H
+#define SPARC_NBSD_TDEP_H
+
+/* Register offsets for NetBSD. */
+extern const struct sparc_gregmap sparc32nbsd_gregmap;
+
+/* Return the address of a system call's alternative return
+ address. */
+extern CORE_ADDR sparcnbsd_step_trap (struct frame_info *frame,
+ unsigned long insn);
+
+extern struct trad_frame_saved_reg *
+ sparc32nbsd_sigcontext_saved_regs (struct frame_info *next_frame);
+
+#endif /* SPARC_NBSD_TDEP_H */

View File

@ -0,0 +1,25 @@
$NetBSD$
--- gdb/sparc-tdep.h.orig 2019-07-16 00:00:27.000000000 +0000
+++ gdb/sparc-tdep.h
@@ -252,20 +252,4 @@ extern const char *sparc_sol2_static_tra
extern void sparc32_sol2_init_abi (struct gdbarch_info info,
struct gdbarch *gdbarch);
-/* Functions and variables exported from sparcnbsd-tdep.c. */
-
-/* Register offsets for NetBSD. */
-extern const struct sparc_gregmap sparc32nbsd_gregmap;
-
-/* Return the address of a system call's alternative return
- address. */
-extern CORE_ADDR sparcnbsd_step_trap (struct frame_info *frame,
- unsigned long insn);
-
-extern void sparc32nbsd_init_abi (struct gdbarch_info info,
- struct gdbarch *gdbarch);
-
-extern struct trad_frame_saved_reg *
- sparc32nbsd_sigcontext_saved_regs (struct frame_info *next_frame);
-
#endif /* sparc-tdep.h */

View File

@ -0,0 +1,36 @@
$NetBSD$
--- gdb/sparc64-nbsd-nat.c.orig 2019-07-16 00:00:27.000000000 +0000
+++ gdb/sparc64-nbsd-nat.c
@@ -20,9 +20,13 @@
#include "defs.h"
#include "gdbcore.h"
#include "regcache.h"
+#include "inferior.h"
+#include "inf-ptrace.h"
#include "target.h"
+#include "nbsd-nat.h"
#include "sparc64-tdep.h"
+#include "sparc-nbsd-tdep.h"
#include "sparc-nat.h"
/* NetBSD is different from the other OSes that support both SPARC and
@@ -106,8 +110,6 @@ sparc64nbsd_gregset_supplies_p (struct g
return 0;
}
-/* Determine whether `fpregset_t' contains register REGNUM. */
-
static int
sparc64nbsd_fpregset_supplies_p (struct gdbarch *gdbarch, int regnum)
{
@@ -168,7 +170,7 @@ sparc64nbsd_supply_pcb (struct regcache
}
/* We've got nothing to add to the generic SPARC target. */
-static sparc_target<inf_ptrace_target> the_sparc64_nbsd_nat_target;
+static sparc_target<nbsd_nat_target> the_sparc64_nbsd_nat_target;
void
_initialize_sparc64nbsd_nat (void)

View File

@ -0,0 +1,12 @@
$NetBSD$
--- gdb/sparc64-nbsd-tdep.c.orig 2019-07-16 00:00:27.000000000 +0000
+++ gdb/sparc64-nbsd-tdep.c
@@ -31,6 +31,7 @@
#include "trad-frame.h"
#include "sparc64-tdep.h"
+#include "sparc-nbsd-tdep.h"
#include "nbsd-tdep.h"
/* From <machine/reg.h>. */

View File

@ -0,0 +1,14 @@
$NetBSD$
--- gdb/tui/tui-winsource.c.orig 2019-07-16 00:00:27.000000000 +0000
+++ gdb/tui/tui-winsource.c
@@ -545,6 +545,9 @@ tui_erase_exec_info_content (struct tui_
{
struct tui_gen_win_info *exec_info = win_info->execution_info;
+ if (exec_info->handle == NULL)
+ return;
+
werase (exec_info->handle);
exec_info->refresh_window ();
}

View File

@ -0,0 +1,79 @@
$NetBSD$
--- gdb/user-regs.c.orig 2019-07-16 00:00:27.000000000 +0000
+++ gdb/user-regs.c
@@ -41,7 +41,7 @@
struct user_reg
{
const char *name;
- struct value *(*read) (struct frame_info * frame, const void *baton);
+ struct value *(*xread) (struct frame_info * frame, const void *baton);
const void *baton;
struct user_reg *next;
};
@@ -60,7 +60,7 @@ struct gdb_user_regs
static void
append_user_reg (struct gdb_user_regs *regs, const char *name,
- user_reg_read_ftype *read, const void *baton,
+ user_reg_read_ftype *xread, const void *baton,
struct user_reg *reg)
{
/* The caller is responsible for allocating memory needed to store
@@ -68,7 +68,7 @@ append_user_reg (struct gdb_user_regs *r
register list stored in the common heap or a specific obstack. */
gdb_assert (reg != NULL);
reg->name = name;
- reg->read = read;
+ reg->xread = xread;
reg->baton = baton;
reg->next = NULL;
(*regs->last) = reg;
@@ -82,10 +82,10 @@ static struct gdb_user_regs builtin_user
};
void
-user_reg_add_builtin (const char *name, user_reg_read_ftype *read,
+user_reg_add_builtin (const char *name, user_reg_read_ftype *xread,
const void *baton)
{
- append_user_reg (&builtin_user_regs, name, read, baton,
+ append_user_reg (&builtin_user_regs, name, xread, baton,
XNEW (struct user_reg));
}
@@ -103,14 +103,14 @@ user_regs_init (struct gdbarch *gdbarch)
regs->last = &regs->first;
for (reg = builtin_user_regs.first; reg != NULL; reg = reg->next)
- append_user_reg (regs, reg->name, reg->read, reg->baton,
+ append_user_reg (regs, reg->name, reg->xread, reg->baton,
GDBARCH_OBSTACK_ZALLOC (gdbarch, struct user_reg));
return regs;
}
void
user_reg_add (struct gdbarch *gdbarch, const char *name,
- user_reg_read_ftype *read, const void *baton)
+ user_reg_read_ftype *xread, const void *baton)
{
struct gdb_user_regs *regs
= (struct gdb_user_regs *) gdbarch_data (gdbarch, user_regs_data);
@@ -122,7 +122,7 @@ user_reg_add (struct gdbarch *gdbarch, c
regs = (struct gdb_user_regs *) user_regs_init (gdbarch);
deprecated_set_gdbarch_data (gdbarch, user_regs_data, regs);
}
- append_user_reg (regs, name, read, baton,
+ append_user_reg (regs, name, xread, baton,
GDBARCH_OBSTACK_ZALLOC (gdbarch, struct user_reg));
}
@@ -214,7 +214,7 @@ value_of_user_reg (int regnum, struct fr
struct user_reg *reg = usernum_to_user_reg (gdbarch, regnum - maxregs);
gdb_assert (reg != NULL);
- return reg->read (frame, reg->baton);
+ return reg->xread (frame, reg->baton);
}
static void

View File

@ -0,0 +1,80 @@
$NetBSD$
--- gdb/vax-bsd-nat.c.orig 2019-07-16 00:00:27.000000000 +0000
+++ gdb/vax-bsd-nat.c
@@ -17,6 +17,9 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
+#ifndef _KERNTYPES
+#define _KERNTYPES
+#endif
#include "defs.h"
#include "inferior.h"
#include "regcache.h"
@@ -29,7 +32,13 @@
#include "vax-tdep.h"
#include "inf-ptrace.h"
+#ifdef __NetBSD__
+#include "nbsd-nat.h"
+struct vax_bsd_nat_target final : public nbsd_nat_target
+#else
struct vax_bsd_nat_target final : public inf_ptrace_target
+#endif
+
{
void fetch_registers (struct regcache *, int) override;
void store_registers (struct regcache *, int) override;
@@ -42,7 +51,7 @@ static vax_bsd_nat_target the_vax_bsd_na
static void
vaxbsd_supply_gregset (struct regcache *regcache, const void *gregs)
{
- const gdb_byte *regs = gregs;
+ const gdb_byte *regs = (const gdb_byte *)gregs;
int regnum;
for (regnum = 0; regnum < VAX_NUM_REGS; regnum++)
@@ -56,7 +65,7 @@ static void
vaxbsd_collect_gregset (const struct regcache *regcache,
void *gregs, int regnum)
{
- gdb_byte *regs = gregs;
+ gdb_byte *regs = (gdb_byte *)gregs;
int i;
for (i = 0; i <= VAX_NUM_REGS; i++)
@@ -74,9 +83,11 @@ void
vax_bsd_nat_target::fetch_registers (struct regcache *regcache, int regnum)
{
struct reg regs;
- pid_t pid = regcache->ptid ().pid ();
+ ptid_t ptid = regcache->ptid ();
+ pid_t pid = ptid.pid ();
+ int lwp = ptid.lwp ();
- if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) &regs, 0) == -1)
+ if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) &regs, lwp) == -1)
perror_with_name (_("Couldn't get registers"));
vaxbsd_supply_gregset (regcache, &regs);
@@ -89,14 +100,16 @@ void
vax_bsd_nat_target::store_registers (struct regcache *regcache, int regnum)
{
struct reg regs;
- pid_t pid = regcache->ptid ().pid ();
+ ptid_t ptid = regcache->ptid ();
+ pid_t pid = ptid.pid ();
+ int lwp = ptid.lwp ();
- if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) &regs, 0) == -1)
+ if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) &regs, lwp) == -1)
perror_with_name (_("Couldn't get registers"));
vaxbsd_collect_gregset (regcache, &regs, regnum);
- if (ptrace (PT_SETREGS, pid, (PTRACE_TYPE_ARG3) &regs, 0) == -1)
+ if (ptrace (PT_SETREGS, pid, (PTRACE_TYPE_ARG3) &regs, lwp) == -1)
perror_with_name (_("Couldn't write registers"));
}

View File

@ -0,0 +1,31 @@
$NetBSD$
--- gdb/x86-bsd-nat.c.orig 2019-07-16 00:00:27.000000000 +0000
+++ gdb/x86-bsd-nat.c
@@ -58,7 +58,7 @@ x86bsd_dr_get (ptid_t ptid, int regnum)
struct dbreg dbregs;
if (ptrace (PT_GETDBREGS, get_ptrace_pid (inferior_ptid),
- (PTRACE_TYPE_ARG3) &dbregs, 0) == -1)
+ (PTRACE_TYPE_ARG3) &dbregs, inferior_ptid.lwp ()) == -1)
perror_with_name (_("Couldn't read debug registers"));
return DBREG_DRX ((&dbregs), regnum);
@@ -70,7 +70,7 @@ x86bsd_dr_set (int regnum, unsigned long
struct dbreg dbregs;
if (ptrace (PT_GETDBREGS, get_ptrace_pid (inferior_ptid),
- (PTRACE_TYPE_ARG3) &dbregs, 0) == -1)
+ (PTRACE_TYPE_ARG3) &dbregs, inferior_ptid.lwp ()) == -1)
perror_with_name (_("Couldn't get debug registers"));
/* For some mysterious reason, some of the reserved bits in the
@@ -83,7 +83,7 @@ x86bsd_dr_set (int regnum, unsigned long
for (thread_info *thread : current_inferior ()->non_exited_threads ())
{
if (ptrace (PT_SETDBREGS, get_ptrace_pid (thread->ptid),
- (PTRACE_TYPE_ARG3) &dbregs, 0) == -1)
+ (PTRACE_TYPE_ARG3) &dbregs, thread->ptid.lwp ()) == -1)
perror_with_name (_("Couldn't write debug registers"));
}
}

View File

@ -0,0 +1,12 @@
$NetBSD$
--- include/elf/common.h.orig 2019-07-16 00:00:27.000000000 +0000
+++ include/elf/common.h
@@ -686,6 +686,7 @@
must start with "NetBSD-CORE". */
#define NT_NETBSDCORE_PROCINFO 1 /* Has a struct procinfo */
+#define NT_NETBSDCORE_AUXV 2 /* Has a copy of Elfxx_auxv_t */
#define NT_NETBSDCORE_FIRSTMACH 32 /* start of machdep note types */

View File

@ -0,0 +1,17 @@
$NetBSD$
--- intl/Makefile.in.orig 2019-07-16 00:00:27.000000000 +0000
+++ intl/Makefile.in
@@ -133,8 +133,10 @@ libintl.h: $(srcdir)/libgnuintl.h
$(COMPILE) $<
.y.c:
- $(YACC) $(YFLAGS) --output $@ $<
- rm -f $*.h
+ @echo "Not rebuilding yacc output"
+ cp -p $(srcdir)/$@ $@
+# $(YACC) $(YFLAGS) --output $@ $<
+# rm -f $*.h
INCLUDES = -I. -I$(srcdir)

View File

@ -0,0 +1,17 @@
$NetBSD$
--- libiberty/make-temp-file.c.orig 2019-07-16 00:00:27.000000000 +0000
+++ libiberty/make-temp-file.c
@@ -129,10 +129,10 @@ choose_tmpdir (void)
base = try_dir (P_tmpdir, base);
#endif
- /* Try /var/tmp, /usr/tmp, then /tmp. */
+ /* Try /tmp, /var/tmp, then /usr/tmp. */
+ base = try_dir (tmp, base);
base = try_dir (vartmp, base);
base = try_dir (usrtmp, base);
- base = try_dir (tmp, base);
/* If all else fails, use the current directory! */
if (base == 0)

View File

@ -0,0 +1,13 @@
$NetBSD$
--- libiberty/strerror.c.orig 2019-07-16 00:00:27.000000000 +0000
+++ libiberty/strerror.c
@@ -347,7 +347,7 @@ static const struct error_info error_tab
ENTRY(EPROTOTYPE, "EPROTOTYPE", "Protocol wrong type for socket"),
#endif
#if defined (ENOPROTOOPT)
- ENTRY(ENOPROTOOPT, "ENOPROTOOPT", "Protocol not available"),
+ ENTRY(ENOPROTOOPT, "ENOPROTOOPT", "Protocol option not available"),
#endif
#if defined (EPROTONOSUPPORT)
ENTRY(EPROTONOSUPPORT, "EPROTONOSUPPORT", "Protocol not supported"),

View File

@ -0,0 +1,12 @@
$NetBSD$
--- opcodes/cgen.sh.orig 2019-07-16 00:00:27.000000000 +0000
+++ opcodes/cgen.sh
@@ -61,6 +61,7 @@ shift ; options=$9
shift ; extrafiles=$9
rootdir=${srcdir}/..
+move_if_change="${CONFIG_SHELL:-/bin/sh} ${rootdir}/move-if-change"
# $arch is $6, as passed on the command line.
# $ARCH is the same argument but in all uppercase.

View File

@ -0,0 +1,12 @@
$NetBSD$
--- readline/display.c.orig 2019-07-16 00:00:27.000000000 +0000
+++ readline/display.c
@@ -47,6 +47,7 @@
/* System-specific feature definitions and include files. */
#include "rldefs.h"
+#include "rltty.h"
#include "rlmbutil.h"
/* Termcap library stuff. */

View File

@ -0,0 +1,6 @@
Cannot strip away RCS IDs, please handle manually!
These are the matching lines:
-# $Id$
-rcs_revision='$Revision$'
Setting PKGDIFF_FMT might help.
Otherwise you may need to run diff by hand.

View File

@ -0,0 +1,7 @@
Cannot strip away RCS IDs, please handle manually!
These are the matching lines:
-# $Id$
-# $Id$
-# $Id$
Setting PKGDIFF_FMT might help.
Otherwise you may need to run diff by hand.

View File

@ -0,0 +1,7 @@
Cannot strip away RCS IDs, please handle manually!
These are the matching lines:
- * $Revision$
- * $Date$
- * $Author$
Setting PKGDIFF_FMT might help.
Otherwise you may need to run diff by hand.

View File

@ -0,0 +1,5 @@
Cannot strip away RCS IDs, please handle manually!
These are the matching lines:
- * $Id$ FAU
Setting PKGDIFF_FMT might help.
Otherwise you may need to run diff by hand.

View File

@ -0,0 +1,5 @@
Cannot strip away RCS IDs, please handle manually!
These are the matching lines:
- * $Id$ FAU
Setting PKGDIFF_FMT might help.
Otherwise you may need to run diff by hand.

View File

@ -0,0 +1,5 @@
Cannot strip away RCS IDs, please handle manually!
These are the matching lines:
- * $Id$ FAU
Setting PKGDIFF_FMT might help.
Otherwise you may need to run diff by hand.

View File

@ -0,0 +1,16 @@
$NetBSD$
--- readline/rltty.c.orig 2019-07-16 00:00:27.000000000 +0000
+++ readline/rltty.c
@@ -37,9 +37,9 @@
#include "rldefs.h"
-#if defined (GWINSZ_IN_SYS_IOCTL)
+#if defined (HAVE_SYS_IOCTL_H)
# include <sys/ioctl.h>
-#endif /* GWINSZ_IN_SYS_IOCTL */
+#endif /* HAVE_SYS_IOCTL_H */
#include "rltty.h"
#include "readline.h"

View File

@ -0,0 +1,24 @@
$NetBSD$
--- readline/support/config.guess.orig 2019-07-16 00:00:27.000000000 +0000
+++ readline/support/config.guess
@@ -1297,6 +1297,9 @@ EOF
x86_64:Haiku:*:*)
echo x86_64-unknown-haiku
exit ;;
+ x86_64:Haiku:*:*)
+ echo x86_64-unknown-haiku
+ exit ;;
SX-4:SUPER-UX:*:*)
echo sx4-nec-superux"$UNAME_RELEASE"
exit ;;
@@ -1318,6 +1321,9 @@ EOF
SX-ACE:SUPER-UX:*:*)
echo sxace-nec-superux"$UNAME_RELEASE"
exit ;;
+ SX-ACE:SUPER-UX:*:*)
+ echo sxace-nec-superux${UNAME_RELEASE}
+ exit ;;
Power*:Rhapsody:*:*)
echo powerpc-apple-rhapsody"$UNAME_RELEASE"
exit ;;

View File

@ -0,0 +1,35 @@
$NetBSD$
--- readline/support/config.sub.orig 2019-07-16 00:00:27.000000000 +0000
+++ readline/support/config.sub
@@ -1125,6 +1125,9 @@ case $cpu-$vendor in
cpu=neo
vendor=tandem
;;
+ neo-tandem)
+ basic_machine=neo-tandem
+ ;;
nse-tandem)
cpu=nse
vendor=tandem
@@ -1512,6 +1515,10 @@ case $os in
;;
ios)
;;
+ z80-*-coff)
+ basic_machine=z80-unknown
+ os=-sim
+ ;;
none)
;;
*-eabi)
@@ -1613,6 +1620,9 @@ case $cpu-$vendor in
pru-*)
os=elf
;;
+ pru-*)
+ os=-elf
+ ;;
*-be)
os=beos
;;

View File

@ -0,0 +1,15 @@
$NetBSD$
--- readline/terminal.c.orig 2019-07-16 00:00:27.000000000 +0000
+++ readline/terminal.c
@@ -32,6 +32,10 @@
# include <sys/file.h>
#endif /* HAVE_SYS_FILE_H */
+#if defined (HAVE_SYS_IOCTL_H)
+#include <sys/ioctl.h>
+#endif /* HAVE_SYS_IOCTL_H */
+
#if defined (HAVE_UNISTD_H)
# include <unistd.h>
#endif /* HAVE_UNISTD_H */

Some files were not shown because too many files have changed in this diff Show More