diff --git a/repos/libports/lib/symbols/stdcxx b/repos/libports/lib/symbols/stdcxx index 97510cec71..95a15be136 100644 --- a/repos/libports/lib/symbols/stdcxx +++ b/repos/libports/lib/symbols/stdcxx @@ -1120,6 +1120,7 @@ _ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE7compareEmmPKc W _ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE7compareEmmPKcm W _ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE7compareEmmRKS4_ W _ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE7compareEmmRKS4_mm W +_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE8capacityEv W _ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm W _ZNKSt7__cxx1112basic_stringIwSt11char_traitsIwESaIwEE12find_last_ofEPKwmm W _ZNKSt7__cxx1112basic_stringIwSt11char_traitsIwESaIwEE13find_first_ofEPKwmm W @@ -1498,6 +1499,7 @@ _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6appendEmc W _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6assignEOS4_ W _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6assignEPKc W _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6assignEPKcm W +_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6assignERKS4_ W _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6assignERKS4_mm W _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6assignEmc W _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6insertEN9__gnu_cxx17__normal_iteratorIPKcS4_EEc W diff --git a/repos/ports/lib/mk/gdbserver_platform.inc b/repos/ports/lib/mk/gdbserver_platform.inc index 28c91ff825..479b9ef7d9 100644 --- a/repos/ports/lib/mk/gdbserver_platform.inc +++ b/repos/ports/lib/mk/gdbserver_platform.inc @@ -3,13 +3,15 @@ GDB_CONTRIB_DIR = $(call select_from_ports,gdb)/src/noux-pkg/gdb INC_DIR += $(REP_DIR)/src/lib/gdbserver_libc_support \ $(REP_DIR)/src/lib/gdbserver_platform \ $(REP_DIR)/src/app/gdb_monitor \ + $(REP_DIR)/src/app/gdb_monitor/gdbserver \ + $(REP_DIR)/src/app/gdb_monitor/gdbsupport \ $(GDB_CONTRIB_DIR)/include \ + $(GDB_CONTRIB_DIR) \ $(GDB_CONTRIB_DIR)/gdb \ $(GDB_CONTRIB_DIR)/gdb/common \ - $(GDB_CONTRIB_DIR)/gdb/gdbserver \ - $(GDB_CONTRIB_DIR)/gdb/gnulib/import \ $(GDB_CONTRIB_DIR)/gdb/regformats \ - $(REP_DIR)/src/app/gdb_monitor/gdbserver + $(GDB_CONTRIB_DIR)/gdbserver \ + $(GDB_CONTRIB_DIR)/gnulib/import SRC_CC += gdbserver_platform_helper.cc @@ -22,3 +24,4 @@ LIBS += stdcxx libc vpath %.cc $(REP_DIR)/src/lib/gdbserver_platform vpath %.cc $(GDB_CONTRIB_DIR)/gdb +vpath %.cc $(GDB_CONTRIB_DIR)/gdbserver diff --git a/repos/ports/lib/mk/spec/x86_32/gdbserver_platform-x86_32.inc b/repos/ports/lib/mk/spec/x86_32/gdbserver_platform-x86_32.inc index a340a18b6e..26cb1e47e3 100644 --- a/repos/ports/lib/mk/spec/x86_32/gdbserver_platform-x86_32.inc +++ b/repos/ports/lib/mk/spec/x86_32/gdbserver_platform-x86_32.inc @@ -1,8 +1,8 @@ INC_DIR += $(REP_DIR)/src/lib/gdbserver_platform/spec/x86_32 SRC_CC += arch/i386.cc \ - gdbserver/linux-x86-low.cc \ - gdbserver/linux-x86-tdesc.cc \ + linux-x86-low.cc \ + linux-x86-tdesc.cc \ nat/x86-linux.cc \ nat/x86-linux-dregs.cc diff --git a/repos/ports/lib/mk/spec/x86_64/gdbserver_platform-x86_64.inc b/repos/ports/lib/mk/spec/x86_64/gdbserver_platform-x86_64.inc index 1fdf54781a..d8f24f7e27 100644 --- a/repos/ports/lib/mk/spec/x86_64/gdbserver_platform-x86_64.inc +++ b/repos/ports/lib/mk/spec/x86_64/gdbserver_platform-x86_64.inc @@ -2,10 +2,10 @@ INC_DIR += $(REP_DIR)/src/lib/gdbserver_platform/spec/x86_64 SRC_CC += arch/i386.cc \ arch/amd64.cc \ - gdbserver/linux-x86-low.cc \ - gdbserver/linux-x86-tdesc.cc \ nat/x86-linux.cc \ - nat/x86-linux-dregs.cc + nat/x86-linux-dregs.cc \ + linux-x86-low.cc \ + linux-x86-tdesc.cc CC_OPT += -fpermissive -Wno-unused-function diff --git a/repos/ports/lib/symbols/gdbserver_platform b/repos/ports/lib/symbols/gdbserver_platform index 1ca7b4f66f..065d474903 100644 --- a/repos/ports/lib/symbols/gdbserver_platform +++ b/repos/ports/lib/symbols/gdbserver_platform @@ -22,30 +22,18 @@ _Z16perror_with_namePKc U _Z16regcache_releasev U _Z16tdesc_create_regP13tdesc_featurePKciiS2_iS2_ U _Z16tdesc_named_typePK13tdesc_featurePKc U -_Z17i386_emit_eq_gotoPiS_ T -_Z17i386_emit_ge_gotoPiS_ T -_Z17i386_emit_gt_gotoPiS_ T -_Z17i386_emit_le_gotoPiS_ T -_Z17i386_emit_lt_gotoPiS_ T -_Z17i386_emit_ne_gotoPiS_ T -_Z17iterate_over_lwps6ptid_tPFiP8lwp_infoPvES2_ U -_Z18amd64_emit_eq_gotoPiS_ T -_Z18amd64_emit_ge_gotoPiS_ T -_Z18amd64_emit_gt_gotoPiS_ T -_Z18amd64_emit_le_gotoPiS_ T -_Z18amd64_emit_lt_gotoPiS_ T -_Z18amd64_emit_ne_gotoPiS_ T +_Z17iterate_over_lwps6ptid_tN3gdb13function_viewIFiP8lwp_infoEEE U _Z18tdesc_add_bitfieldP22tdesc_type_with_fieldsPKcii U _Z18tdesc_create_flagsP13tdesc_featurePKci U _Z18tdesc_create_unionP13tdesc_featurePKc U _Z18x86_low_init_dregsP19x86_debug_reg_state U _Z19get_thread_regcacheP11thread_infoi U _Z19initialize_low_archv T +_Z19target_write_memorymPKhl U _Z19tdesc_create_structP13tdesc_featurePKc U _Z19tdesc_create_vectorP13tdesc_featurePKcP10tdesc_typei U _Z19x86_debug_reg_statei T -_Z19x86_linux_regs_infov T -_Z20relocate_instructionPyy U +_Z20relocate_instructionPmm U _Z20tdesc_create_featureP11target_descPKc U _Z20x86_linux_new_threadP8lwp_info T _Z21cannot_fetch_registerPKc T @@ -55,16 +43,16 @@ _Z21genode_store_registerim T _Z21get_raw_reg_func_addrv U _Z21lwp_arch_private_infoP8lwp_info U _Z21tdesc_set_struct_sizeP22tdesc_type_with_fieldsi U -_Z21write_inferior_memoryyPKhi U _Z21x86_linux_dr_get_addri T -_Z21x86_linux_dr_set_addriy T -_Z22claim_trampoline_spaceyPy U +_Z21x86_linux_dr_set_addrim T +_Z22claim_trampoline_spacemPm U _Z22find_any_thread_of_pidi U _Z22genode_child_resourcesv U _Z22i386_get_ipa_tdesc_idxPK11target_desc T _Z22set_tdesc_architectureP11target_descPKc U _Z23amd64_get_ipa_tdesc_idxPK11target_desc T _Z23copy_target_descriptionP11target_descPKS_ U +_Z23genode_stop_all_threadsv U _Z23initialize_regsets_infoP12regsets_info U _Z23supply_register_by_nameP8regcachePKcPKv U _Z23x86_linux_delete_threadP13arch_lwp_info T @@ -72,30 +60,148 @@ _Z23x86_linux_dr_get_statusv T _Z24collect_register_by_nameP8regcachePKcPv U _Z24get_current_thread_statev T _Z24set_current_thread_stateN6Genode12Thread_stateE T -_Z24x86_dr_insert_watchpointP19x86_debug_reg_state17target_hw_bp_typeyi U -_Z24x86_dr_remove_watchpointP19x86_debug_reg_state17target_hw_bp_typeyi U +_Z24x86_dr_insert_watchpointP19x86_debug_reg_state17target_hw_bp_typemi U +_Z24x86_dr_remove_watchpointP19x86_debug_reg_state17target_hw_bp_typemi U _Z24x86_linux_dr_get_controlv T _Z24x86_linux_dr_set_controlm T _Z25lwp_set_arch_private_infoP8lwp_infoP13arch_lwp_info U _Z27allocate_target_descriptionv U _Z27i386_linux_read_descriptionm T _Z27lwp_debug_registers_changedP8lwp_info T -_Z27x86_dr_stopped_data_addressP19x86_debug_reg_statePy U +_Z27x86_dr_stopped_data_addressP19x86_debug_reg_statePm U _Z27x86_linux_prepare_to_resumeP8lwp_info T _Z28amd64_linux_read_descriptionmb T -_Z30i386_create_target_descriptionmb T +_Z30i386_create_target_descriptionmbb T _Z31amd64_create_target_descriptionmbbb T _Z31lwp_set_debug_registers_changedP8lwp_infoi T _Z32x86_linux_update_debug_registersP8lwp_info T _Z34raw_bkpt_type_to_target_hw_bp_type13raw_bkpt_type U _Z38have_fast_tracepoint_trampoline_bufferPc U _Z7warningPKcz U -_Z8paddressy U +_Z8paddressm U +_ZN10x86_target10low_get_pcEP8regcache T +_ZN10x86_target10low_set_pcEP8regcachem T +_ZN10x86_target12low_new_forkEP12process_infoS1_ T +_ZN10x86_target13get_regs_infoEv T +_ZN10x86_target14low_arch_setupEv T +_ZN10x86_target14low_new_threadEP8lwp_info T +_ZN10x86_target15low_new_processEv T +_ZN10x86_target16low_insert_pointE13raw_bkpt_typemiP14raw_breakpoint T +_ZN10x86_target16low_remove_pointE13raw_bkpt_typemiP14raw_breakpoint T +_ZN10x86_target16update_xmltargetEv T +_ZN10x86_target17get_ipa_tdesc_idxEv T +_ZN10x86_target17low_breakpoint_atEm T +_ZN10x86_target17low_delete_threadEP13arch_lwp_info T +_ZN10x86_target17low_siginfo_fixupEP9__siginfoPhi T +_ZN10x86_target18low_delete_processEP17arch_process_info T +_ZN10x86_target18process_qsupportedEN3gdb10array_viewIKPKcEE T +_ZN10x86_target19low_get_thread_areaEiPm T +_ZN10x86_target20supports_tracepointsEv T +_ZN10x86_target21low_prepare_to_resumeEP8lwp_info T +_ZN10x86_target21supports_z_point_typeEc T +_ZN10x86_target23low_decr_pc_after_breakEv T +_ZN10x86_target23sw_breakpoint_from_kindEiPi T +_ZN10x86_target24low_get_syscall_trapinfoEP8regcachePi T +_ZN10x86_target24low_stopped_data_addressEv T +_ZN10x86_target24low_supports_breakpointsEv T +_ZN10x86_target25low_cannot_fetch_registerEi T +_ZN10x86_target25low_cannot_store_registerEi T +_ZN10x86_target25low_stopped_by_watchpointEv T +_ZN10x86_target25supports_fast_tracepointsEv T +_ZN10x86_target26low_supports_catch_syscallEv T +_ZN10x86_target27low_supports_range_steppingEv T +_ZN10x86_target32get_min_fast_tracepoint_insn_lenEv T +_ZN10x86_target32install_fast_tracepoint_jump_padEmmmmmPmS0_S0_PhS0_S0_S0_Pc T +_ZN10x86_target8emit_opsEv T _ZN11Gdb_monitor21Cpu_session_component10thread_capEm U _ZN11Gdb_monitor21Cpu_session_component17_setup_native_cpuEv T _ZN11Gdb_monitor21Cpu_session_component18parent_cpu_sessionEv U _ZN11Gdb_monitor21Cpu_session_component19_cleanup_native_cpuEv T _ZN11Gdb_monitor21Cpu_session_component9thread_epEv U +_ZN20linux_process_target11read_memoryEmPhi U +_ZN20linux_process_target11thread_nameE6ptid_t U +_ZN20linux_process_target11unpause_allEb U +_ZN20linux_process_target12insert_pointE13raw_bkpt_typemiP14raw_breakpoint U +_ZN20linux_process_target12multifs_openEiPKcit U +_ZN20linux_process_target12qxfer_osdataEPKcPhPKhmi U +_ZN20linux_process_target12read_offsetsEPmS0_ U +_ZN20linux_process_target12remove_pointE13raw_bkpt_typemiP14raw_breakpoint U +_ZN20linux_process_target12thread_aliveE6ptid_t U +_ZN20linux_process_target12write_memoryEmPKhi U +_ZN20linux_process_target13qxfer_siginfoEPKcPhPKhmi U +_ZN20linux_process_target14core_of_threadE6ptid_t U +_ZN20linux_process_target14multifs_unlinkEiPKc U +_ZN20linux_process_target14start_non_stopEb U +_ZN20linux_process_target14supports_agentEv U +_ZN20linux_process_target14thread_stoppedEP11thread_info U +_ZN20linux_process_target15create_inferiorEPKcRKSt6vectorIPcSaIS3_EE U +_ZN20linux_process_target15fetch_registersEP8regcachei U +_ZN20linux_process_target15get_tls_addressEP11thread_infommPm U +_ZN20linux_process_target15look_up_symbolsEv U +_ZN20linux_process_target15store_registersEP8regcachei U +_ZN20linux_process_target16low_get_next_pcsEP8regcache U +_ZN20linux_process_target16multifs_readlinkEiPKcPcm U +_ZN20linux_process_target16pid_to_exec_fileEi U +_ZN20linux_process_target16supports_multifsEv U +_ZN20linux_process_target17request_interruptEv U +_ZN20linux_process_target17stabilize_threadsEv U +_ZN20linux_process_target17supports_non_stopEv U +_ZN20linux_process_target18low_fetch_registerEP8regcachei U +_ZN20linux_process_target18supports_read_auxvEv U +_ZN20linux_process_target20post_create_inferiorEv U +_ZN20linux_process_target20qxfer_libraries_svr4EPKcPhPKhmi U +_ZN20linux_process_target20stopped_data_addressEv U +_ZN20linux_process_target20supports_exec_eventsEv U +_ZN20linux_process_target20supports_fork_eventsEv U +_ZN20linux_process_target21done_accessing_memoryEv U +_ZN20linux_process_target21stopped_by_watchpointEv U +_ZN20linux_process_target21supports_qxfer_osdataEv U +_ZN20linux_process_target21supports_read_offsetsEv U +_ZN20linux_process_target21supports_vfork_eventsEv U +_ZN20linux_process_target22handle_monitor_commandEPc U +_ZN20linux_process_target22supports_catch_syscallEv U +_ZN20linux_process_target22supports_multi_processEv U +_ZN20linux_process_target22supports_qxfer_siginfoEv U +_ZN20linux_process_target23supports_range_steppingEv U +_ZN20linux_process_target23supports_thread_stoppedEv U +_ZN20linux_process_target24prepare_to_access_memoryEv U +_ZN20linux_process_target24stopped_by_hw_breakpointEv U +_ZN20linux_process_target24stopped_by_sw_breakpointEv U +_ZN20linux_process_target24supports_get_tls_addressEv U +_ZN20linux_process_target25handle_new_gdb_connectionEv U +_ZN20linux_process_target25supports_pid_to_exec_fileEv U +_ZN20linux_process_target26low_supply_ptrace_registerEP8regcacheiPKc U +_ZN20linux_process_target27low_collect_ptrace_registerEP8regcacheiPc U +_ZN20linux_process_target29supports_hardware_single_stepEv U +_ZN20linux_process_target29supports_qxfer_libraries_svr4Ev U +_ZN20linux_process_target30supports_disable_randomizationEv U +_ZN20linux_process_target33supports_stopped_by_hw_breakpointEv U +_ZN20linux_process_target33supports_stopped_by_sw_breakpointEv U +_ZN20linux_process_target4joinEi U +_ZN20linux_process_target4killEP12process_info U +_ZN20linux_process_target4waitE6ptid_tP17target_waitstatusi U +_ZN20linux_process_target5asyncEb U +_ZN20linux_process_target5mournEP12process_info U +_ZN20linux_process_target6attachEm U +_ZN20linux_process_target6detachEP12process_info U +_ZN20linux_process_target6resumeEP13thread_resumem U +_ZN20linux_process_target7read_pcEP8regcache U +_ZN20linux_process_target8write_pcEP8regcachem U +_ZN20linux_process_target9pause_allEb U +_ZN20linux_process_target9read_auxvEmPhj U +_ZN22process_stratum_target11read_btraceEP18btrace_target_infoP6buffer16btrace_read_type U +_ZN22process_stratum_target12read_loadmapEPKcmPhj U +_ZN22process_stratum_target13enable_btraceE6ptid_tPK13btrace_config U +_ZN22process_stratum_target13thread_handleE6ptid_tPPhPi U +_ZN22process_stratum_target14disable_btraceEP18btrace_target_info U +_ZN22process_stratum_target15get_tib_addressE6ptid_tPm U +_ZN22process_stratum_target16read_btrace_confEPK18btrace_target_infoP6buffer U +_ZN22process_stratum_target17hostio_last_errorEPc U +_ZN22process_stratum_target21supports_read_loadmapEv U +_ZN22process_stratum_target23breakpoint_kind_from_pcEPm U +_ZN22process_stratum_target24supports_get_tib_addressEv U +_ZN22process_stratum_target29supports_software_single_stepEv U +_ZN22process_stratum_target34breakpoint_kind_from_current_stateEPm U _ZN6Genode13Avl_node_baseC2Ev U _ZN6Genode14Rpc_entrypoint7_manageEPNS_15Rpc_object_baseE U _ZN6Genode14Rpc_entrypoint9_dissolveEPNS_15Rpc_object_baseE U @@ -105,6 +211,11 @@ _ZN6Genode17Native_capabilityC1Ev U _ZN6Genode3Log3logEv U _ZN6Genode3Log8_acquireENS0_4TypeE U _ZN6Genode3Log8_releaseEv U +_ZN6Genode4Lock4lockEv U +_ZN6Genode4Lock6unlockEv U +_ZN6Genode4LockC1ENS0_5StateE U +_ZN6Genode5Mutex7acquireEv U +_ZN6Genode5Mutex7releaseEv U _ZN6Genode5Trace6Logger17_evaluate_controlEv U _ZN6Genode5printERNS_6OutputEPKc U _ZN6Genode5printERNS_6OutputEPKv U @@ -113,14 +224,16 @@ _ZN6Genode6Thread7_loggerEv U _ZN6Genode8ipc_callENS_17Native_capabilityERNS_11Msgbuf_baseES2_m U _ZNK6Genode17Native_capability10local_nameEv U _ZSt9terminatev U +_ZTI20linux_process_target U _ZTIN11Gdb_monitor20Cpu_thread_componentE U _ZTVN10__cxxabiv117__class_type_infoE U _ZTVN10__cxxabiv120__si_class_type_infoE U _ZTVN10__cxxabiv121__vmi_class_type_infoE U -_ZdlPv U _ZdlPvRN6Genode11DeallocatorE U +_ZdlPvm U _ZnwmRN6Genode9AllocatorE U __cxa_allocate_exception U +__cxa_atexit U __cxa_begin_catch U __cxa_end_catch U __cxa_get_exception_ptr U @@ -128,22 +241,23 @@ __cxa_pure_virtual U __cxa_throw U __dynamic_cast U __error U +__gnu_Unwind_Find_exidx T __gxx_personality_v0 U abort U amd64_emit_ops D 296 current_insn_ptr U current_thread U debug_threads U +dl_unwind_find_exidx W emit_error U free U have_ptrace_getfpxregs B 4 i386_emit_ops D 296 ptrace U sprintf U -strtok U +strtok_r U strtoul U -the_low_target D 296 -the_target U +the_linux_target D 8 x86_dr_low D 48 xcalloc U xstrdup U diff --git a/repos/ports/ports/gdb.hash b/repos/ports/ports/gdb.hash index 614248f958..1c9065c1d3 100644 --- a/repos/ports/ports/gdb.hash +++ b/repos/ports/ports/gdb.hash @@ -1 +1 @@ -8eddf0d249a22993e57b3242112fb62f503101c9 +601cdd5711839f85cd2d151f51d989b678a02efc diff --git a/repos/ports/ports/gdb.port b/repos/ports/ports/gdb.port index 766a65e907..cae30f5b52 100644 --- a/repos/ports/ports/gdb.port +++ b/repos/ports/ports/gdb.port @@ -1,9 +1,9 @@ LICENSE := GPLv3 -VERSION := 8.2.1 +VERSION := 10.2 DOWNLOADS := gdb.archive URL(gdb) := ftp://ftp.fu-berlin.de/gnu/gdb/gdb-$(VERSION).tar.xz -SHA(gdb) := 0a6a432907a03c5c8eaad3c3cffd50c00a40c3a5e3c4039440624bae703f2202 +SHA(gdb) := aaa1223d534c9b700a8bec952d9748ee1977513f178727e1bee520ee000b4f29 SIG(gdb) := ${URL(gdb)}.sig KEY(gdb) := GNU DIR(gdb) := src/noux-pkg/gdb @@ -20,53 +20,10 @@ default: symlinks symlinks: $(DOWNLOADS) $(VERBOSE)ln -s amd64.c ${DIR(gdb)}/gdb/arch/amd64.cc $(VERBOSE)ln -s i386.c ${DIR(gdb)}/gdb/arch/i386.cc - $(VERBOSE)ln -s agent.c ${DIR(gdb)}/gdb/common/agent.cc - $(VERBOSE)ln -s buffer.c ${DIR(gdb)}/gdb/common/buffer.cc - $(VERBOSE)ln -s cleanups.c ${DIR(gdb)}/gdb/common/cleanups.cc - $(VERBOSE)ln -s common-debug.c ${DIR(gdb)}/gdb/common/common-debug.cc - $(VERBOSE)ln -s common-exceptions.c ${DIR(gdb)}/gdb/common/common-exceptions.cc - $(VERBOSE)ln -s common-utils.c ${DIR(gdb)}/gdb/common/common-utils.cc - $(VERBOSE)ln -s environ.c ${DIR(gdb)}/gdb/common/environ.cc - $(VERBOSE)ln -s errors.c ${DIR(gdb)}/gdb/common/errors.cc - $(VERBOSE)ln -s filestuff.c ${DIR(gdb)}/gdb/common/filestuff.cc - $(VERBOSE)ln -s format.c ${DIR(gdb)}/gdb/common/format.cc - $(VERBOSE)ln -s gdb_tilde_expand.c ${DIR(gdb)}/gdb/common/gdb_tilde_expand.cc - $(VERBOSE)ln -s gdb_vecs.c ${DIR(gdb)}/gdb/common/gdb_vecs.cc - $(VERBOSE)ln -s job-control.c ${DIR(gdb)}/gdb/common/job-control.cc - $(VERBOSE)ln -s pathstuff.c ${DIR(gdb)}/gdb/common/pathstuff.cc - $(VERBOSE)ln -s posix-strerror.c ${DIR(gdb)}/gdb/common/posix-strerror.cc - $(VERBOSE)ln -s print-utils.c ${DIR(gdb)}/gdb/common/print-utils.cc - $(VERBOSE)ln -s ptid.c ${DIR(gdb)}/gdb/common/ptid.cc - $(VERBOSE)ln -s rsp-low.c ${DIR(gdb)}/gdb/common/rsp-low.cc - $(VERBOSE)ln -s signals.c ${DIR(gdb)}/gdb/common/signals.cc - $(VERBOSE)ln -s tdesc.c ${DIR(gdb)}/gdb/common/tdesc.cc - $(VERBOSE)ln -s vec.c ${DIR(gdb)}/gdb/common/vec.cc - $(VERBOSE)ln -s xml-utils.c ${DIR(gdb)}/gdb/common/xml-utils.cc - $(VERBOSE)ln -s ax.c ${DIR(gdb)}/gdb/gdbserver/ax.cc - $(VERBOSE)ln -s debug.c ${DIR(gdb)}/gdb/gdbserver/debug.cc - $(VERBOSE)ln -s dll.c ${DIR(gdb)}/gdb/gdbserver/dll.cc - $(VERBOSE)ln -s event-loop.c ${DIR(gdb)}/gdb/gdbserver/event-loop.cc - $(VERBOSE)ln -s fork-child.c ${DIR(gdb)}/gdb/gdbserver/fork-child.cc - $(VERBOSE)ln -s hostio.c ${DIR(gdb)}/gdb/gdbserver/hostio.cc - $(VERBOSE)ln -s i387-fp.c ${DIR(gdb)}/gdb/gdbserver/i387-fp.cc - $(VERBOSE)ln -s inferiors.c ${DIR(gdb)}/gdb/gdbserver/inferiors.cc - $(VERBOSE)ln -s linux-low.c ${DIR(gdb)}/gdb/gdbserver/linux-low.cc - $(VERBOSE)ln -s linux-x86-low.c ${DIR(gdb)}/gdb/gdbserver/linux-x86-low.cc - $(VERBOSE)ln -s linux-x86-tdesc.c ${DIR(gdb)}/gdb/gdbserver/linux-x86-tdesc.cc - $(VERBOSE)ln -s mem-break.c ${DIR(gdb)}/gdb/gdbserver/mem-break.cc - $(VERBOSE)ln -s notif.c ${DIR(gdb)}/gdb/gdbserver/notif.cc - $(VERBOSE)ln -s regcache.c ${DIR(gdb)}/gdb/gdbserver/regcache.cc - $(VERBOSE)ln -s remote-utils.c ${DIR(gdb)}/gdb/gdbserver/remote-utils.cc - $(VERBOSE)ln -s server.c ${DIR(gdb)}/gdb/gdbserver/server.cc - $(VERBOSE)ln -s symbol.c ${DIR(gdb)}/gdb/gdbserver/symbol.cc - $(VERBOSE)ln -s target.c ${DIR(gdb)}/gdb/gdbserver/target.cc - $(VERBOSE)ln -s tdesc.c ${DIR(gdb)}/gdb/gdbserver/tdesc.cc - $(VERBOSE)ln -s tracepoint.c ${DIR(gdb)}/gdb/gdbserver/tracepoint.cc - $(VERBOSE)ln -s utils.c ${DIR(gdb)}/gdb/gdbserver/utils.cc - $(VERBOSE)ln -s x86-low.c ${DIR(gdb)}/gdb/gdbserver/x86-low.cc $(VERBOSE)ln -s fork-inferior.c ${DIR(gdb)}/gdb/nat/fork-inferior.cc $(VERBOSE)ln -s linux-ptrace.c ${DIR(gdb)}/gdb/nat/linux-ptrace.cc $(VERBOSE)ln -s x86-dregs.c ${DIR(gdb)}/gdb/nat/x86-dregs.cc $(VERBOSE)ln -s x86-linux.c ${DIR(gdb)}/gdb/nat/x86-linux.cc $(VERBOSE)ln -s x86-linux-dregs.c ${DIR(gdb)}/gdb/nat/x86-linux-dregs.cc $(VERBOSE)ln -s waitstatus.c ${DIR(gdb)}/gdb/target/waitstatus.cc + $(VERBOSE)ln -s alloc.c ${DIR(gdb)}/gdb/alloc.cc diff --git a/repos/ports/run/debug_nitpicker.run b/repos/ports/run/debug_nitpicker.run index 4bc00a0c30..2e11ad9b16 100644 --- a/repos/ports/run/debug_nitpicker.run +++ b/repos/ports/run/debug_nitpicker.run @@ -20,7 +20,6 @@ if {![have_include "power_on/qemu"] || create_boot_directory import_from_depot [depot_user]/src/[base_src] \ [depot_user]/pkg/[drivers_interactive_pkg] \ - [depot_user]/src/nitpicker \ [depot_user]/src/demo \ [depot_user]/src/init \ [depot_user]/src/vfs_pipe @@ -29,6 +28,7 @@ set build_components { drivers/uart app/gdb_monitor test/gdb_monitor + lib/ld server/nitpicker } lappend build_components "lib/gdbserver_platform-$::env(KERNEL)" build $build_components @@ -97,10 +97,14 @@ install_config { - + + + + 2021-01-01 00:01 + - + @@ -124,6 +128,7 @@ build_boot_image { stdcxx.lib.so libc.lib.so libm.lib.so vfs.lib.so pc_uart_drv gdb_monitor gdbserver_platform.lib.so + ld.lib.so nitpicker } # @@ -168,7 +173,7 @@ append gdb_cmds {-ex "set interactive-mode auto" } puts "command: [gdb] debug/ld.lib.so $gdb_cmds" -exec [terminal] -e "bash -lc \"[gdb] debug/ld.lib.so $gdb_cmds\"" & +exec [terminal] -e "bash -lc \'[gdb] debug/ld.lib.so $gdb_cmds\'" & interact -i [output_spawn_id] diff --git a/repos/ports/run/gdb_monitor.run b/repos/ports/run/gdb_monitor.run index 19163f8599..28686f7b33 100644 --- a/repos/ports/run/gdb_monitor.run +++ b/repos/ports/run/gdb_monitor.run @@ -77,10 +77,14 @@ set config { - + + + + 2021-01-01 00:01 + - + @@ -140,6 +144,7 @@ set gdb_target_binary "test-gdb_monitor" # sequence of GDB commands to execute at startup set gdb_cmds "" append gdb_cmds {-ex "target remote localhost:$local_port" } +append gdb_cmds {-ex "set style enabled off" } append gdb_cmds [gdb_initial_breakpoint_cmds $gdb_target_binary] # run GDB @@ -248,10 +253,10 @@ if {![regexp {Breakpoint 4, test_thread_start} $output]} { send "info threads\n" run_genode_until {\(gdb\)} 20 $gdb_id -if {![regexp {\* 4 Thread 4 test_thread_start} $output] || - ![regexp { 3 Thread 3} $output] || - ![regexp { 2 Thread 2} $output] || - ![regexp { 1 Thread 1} $output]} { +if {![regexp {\* 4 Thread 1.4 test_thread_start} $output] || + ![regexp { 3 Thread 1.3} $output] || + ![regexp { 2 Thread 1.2} $output] || + ![regexp { 1 Thread 1.1} $output]} { puts stderr "*** Error: Thread info is not as expected" exit -1 } diff --git a/repos/ports/run/gdb_monitor_interactive.run b/repos/ports/run/gdb_monitor_interactive.run index 5551aee813..8b608b80ad 100644 --- a/repos/ports/run/gdb_monitor_interactive.run +++ b/repos/ports/run/gdb_monitor_interactive.run @@ -73,10 +73,14 @@ set config { - + + + + 2021-01-01 00:01 + - + diff --git a/repos/ports/run/gdb_monitor_target_config.run b/repos/ports/run/gdb_monitor_target_config.run index 0e6ba40db2..2bff522aac 100644 --- a/repos/ports/run/gdb_monitor_target_config.run +++ b/repos/ports/run/gdb_monitor_target_config.run @@ -73,10 +73,14 @@ set config { - + + + + 2021-01-01 00:01 + - + diff --git a/repos/ports/src/app/gdb_monitor/gdbserver/genode-low.cc b/repos/ports/src/app/gdb_monitor/gdbserver/genode-low.cc index f260f2c697..748ed40c6c 100644 --- a/repos/ports/src/app/gdb_monitor/gdbserver/genode-low.cc +++ b/repos/ports/src/app/gdb_monitor/gdbserver/genode-low.cc @@ -6,7 +6,7 @@ */ /* - * Copyright (C) 2011-2017 Genode Labs GmbH + * Copyright (C) 2011-2021 Genode Labs GmbH * * This file is part of the Genode OS framework, which is distributed * under the terms of the GNU Affero General Public License version 3. @@ -31,8 +31,6 @@ #include "server.h" #include "linux-low.h" -void linux_detach_one_lwp (struct lwp_info *lwp); - static bool verbose = false; Genode::Env *genode_env; @@ -302,7 +300,7 @@ pid_t my_waitpid(pid_t pid, int *status, int flags) if (cc == 1 && c == '\003' && current_thread != NULL) { /* this causes a SIGINT to be delivered to one of the threads */ - (*the_target->request_interrupt)(); + the_target->request_interrupt(); continue; } else { if (verbose) @@ -591,8 +589,8 @@ void genode_remove_thread(unsigned long lwpid) { struct thread_info *thread_info = find_thread_ptid(ptid_t(GENODE_MAIN_LWPID, lwpid, 0)); - struct lwp_info *lwp = get_thread_lwp(thread_info); - linux_detach_one_lwp(lwp); + lwp_info *lwp = get_thread_lwp(thread_info); + the_linux_target->detach_one_lwp(lwp); } @@ -610,7 +608,7 @@ void genode_resume_all_threads() } -int genode_detach(int pid) +static int genode_detach(int) { genode_resume_all_threads(); @@ -618,12 +616,18 @@ int genode_detach(int pid) } -int genode_kill(int pid) +int linux_process_target::detach(process_info *process) +{ + return genode_detach(process->pid); +} + + +int linux_process_target::kill(process_info *process) { /* TODO */ if (verbose) warning(__func__, " not implemented, just detaching instead..."); - return genode_detach(pid); + return genode_detach(process->pid); } @@ -643,9 +647,9 @@ void genode_continue_thread(unsigned long lwpid, int single_step) } -void genode_fetch_registers(struct regcache *regcache, int regno) +void linux_process_target::fetch_registers(regcache *regcache, int regno) { - const struct regs_info *regs_info = (*the_low_target.regs_info) (); + const struct regs_info *regs_info = get_regs_info(); unsigned long reg_content = 0; @@ -665,11 +669,11 @@ void genode_fetch_registers(struct regcache *regcache, int regno) } -void genode_store_registers(struct regcache *regcache, int regno) +void linux_process_target::store_registers(regcache *regcache, int regno) { if (verbose) log(__func__, ": regno=", regno); - const struct regs_info *regs_info = (*the_low_target.regs_info) (); + const struct regs_info *regs_info = get_regs_info(); unsigned long reg_content = 0; @@ -714,13 +718,20 @@ int genode_read_memory(CORE_ADDR memaddr, unsigned char *myaddr, int len) } +int linux_process_target::read_memory(CORE_ADDR memaddr, + unsigned char *myaddr, int len) +{ + return genode_read_memory(memaddr, myaddr, len); +} + + void genode_write_memory_byte(void *addr, unsigned char value) { memory_model().write(addr, value); } -int genode_write_memory (CORE_ADDR memaddr, const unsigned char *myaddr, int len) +int genode_write_memory(CORE_ADDR memaddr, const unsigned char *myaddr, int len) { if (verbose) log(__func__, "(", Hex(memaddr), ", ", myaddr, ", ", len, ")"); @@ -749,3 +760,72 @@ int genode_write_memory (CORE_ADDR memaddr, const unsigned char *myaddr, int len return 0; } + + +int linux_process_target::write_memory(CORE_ADDR memaddr, + const unsigned char *myaddr, int len) +{ + return genode_write_memory(memaddr, myaddr, len); +} + + +LONGEST linux_common_xfer_osdata(char const*, gdb_byte*, ULONGEST, ULONGEST) +{ + Genode::error(__func__, " called, not implemented"); + return -1; +} + + +int linux_common_core_of_thread(ptid_t) +{ + return 0; +} + + +bool linux_process_target::supports_qxfer_libraries_svr4() +{ + return false; +} + + +int linux_process_target::qxfer_libraries_svr4(const char *, + unsigned char *, + unsigned const char *, + CORE_ADDR, int) +{ + Genode::error(__func__, " called, not implemented"); + return -1; +} + + +char *linux_proc_pid_to_exec_file(int) +{ + return nullptr; +} + + +ssize_t linux_mntns_readlink(pid_t, const char *, char *, size_t) +{ + Genode::error(__func__, " called, not implemented"); + return -1; +} + + +int linux_mntns_unlink (pid_t, const char *) +{ + Genode::error(__func__, " called, not implemented"); + return -1; +} + + +int linux_mntns_open_cloexec(pid_t, const char *, int, mode_t) +{ + Genode::error(__func__, " called, not implemented"); + return -1; +} + + +const char *linux_proc_tid_get_name(ptid_t) +{ + return ""; +} diff --git a/repos/ports/src/app/gdb_monitor/gdbserver/genode-low.h b/repos/ports/src/app/gdb_monitor/gdbserver/genode-low.h index d6d38d88c0..7da9e39a49 100644 --- a/repos/ports/src/app/gdb_monitor/gdbserver/genode-low.h +++ b/repos/ports/src/app/gdb_monitor/gdbserver/genode-low.h @@ -5,7 +5,7 @@ */ /* - * Copyright (C) 2011-2017 Genode Labs GmbH + * Copyright (C) 2011-2021 Genode Labs GmbH * * This file is part of the Genode OS framework, which is distributed * under the terms of the GNU Affero General Public License version 3. @@ -32,8 +32,6 @@ void genode_continue_thread(unsigned long lwpid, int single_step); int genode_kill(int pid); int genode_detach(int pid); -void genode_fetch_registers(struct regcache *regcache, int regno); -void genode_store_registers(struct regcache *regcache, int regno); int genode_read_memory(CORE_ADDR memaddr, unsigned char *myaddr, int len); int genode_write_memory (CORE_ADDR memaddr, const unsigned char *myaddr, int len); diff --git a/repos/ports/src/app/gdb_monitor/gdbserver/config.h b/repos/ports/src/app/gdb_monitor/gdbsupport/config.h similarity index 91% rename from repos/ports/src/app/gdb_monitor/gdbserver/config.h rename to repos/ports/src/app/gdb_monitor/gdbsupport/config.h index 404ed7a45f..45934f6f1c 100644 --- a/repos/ports/src/app/gdb_monitor/gdbserver/config.h +++ b/repos/ports/src/app/gdb_monitor/gdbsupport/config.h @@ -5,7 +5,7 @@ */ /* - * Copyright (C) 2011-2017 Genode Labs GmbH + * Copyright (C) 2011-2021 Genode Labs GmbH * * This file is part of the Genode OS framework, which is distributed * under the terms of the GNU Affero General Public License version 3. @@ -17,6 +17,7 @@ #define HAVE_ARPA_INET_H 1 #define HAVE_ERRNO_H 1 #define HAVE_FCNTL_H 1 +#define HAVE_NETDB_H 1 #define HAVE_NETINET_IN_H 1 #define HAVE_NETINET_TCP_H 1 #define HAVE_SIGNAL_H 1 diff --git a/repos/ports/src/app/gdb_monitor/target.mk b/repos/ports/src/app/gdb_monitor/target.mk index 4f6c85aec7..7a4cd722b0 100644 --- a/repos/ports/src/app/gdb_monitor/target.mk +++ b/repos/ports/src/app/gdb_monitor/target.mk @@ -3,13 +3,14 @@ TARGET = gdb_monitor GDB_CONTRIB_DIR = $(call select_from_ports,gdb)/src/noux-pkg/gdb INC_DIR += $(GDB_CONTRIB_DIR)/include \ + $(GDB_CONTRIB_DIR) \ $(GDB_CONTRIB_DIR)/gdb \ - $(GDB_CONTRIB_DIR)/gdb/common \ - $(GDB_CONTRIB_DIR)/gdb/gdbserver \ - $(GDB_CONTRIB_DIR)/gdb/gnulib/import \ $(GDB_CONTRIB_DIR)/gdb/regformats \ + $(GDB_CONTRIB_DIR)/gdbserver \ + $(GDB_CONTRIB_DIR)/gnulib/import \ $(REP_DIR)/src/lib/gdbserver_libc_support \ $(PRG_DIR)/gdbserver \ + $(PRG_DIR)/gdbsupport \ $(PRG_DIR) LIBS = stdcxx libc \ @@ -18,41 +19,20 @@ LIBS = stdcxx libc \ # libiberty SRC_C = argv.c \ concat.c \ - crc32.c + crc32.c \ + xstrdup.c # gnulib SRC_C += rawmemchr.c \ strchrnul.c -# gdb -SRC_CC += common/agent.cc \ - common/buffer.cc \ - common/cleanups.cc \ - common/common-debug.cc \ - common/common-exceptions.cc \ - common/common-utils.cc \ - common/environ.cc \ - common/errors.cc \ - common/filestuff.cc \ - common/format.cc \ - common/gdb_tilde_expand.cc \ - common/gdb_vecs.cc \ - common/job-control.cc \ - common/pathstuff.cc \ - common/posix-strerror.cc \ - common/print-utils.cc \ - common/ptid.cc \ - common/rsp-low.cc \ - common/signals.cc \ - common/tdesc.cc \ - common/vec.cc \ - common/xml-utils.cc \ - gdbserver/ax.cc \ +# gdbserver +SRC_CC += gdbserver/ax.cc \ gdbserver/debug.cc \ gdbserver/dll.cc \ - gdbserver/event-loop.cc \ gdbserver/fork-child.cc \ gdbserver/hostio.cc \ + gdbserver/hostio-errno.cc \ gdbserver/i387-fp.cc \ gdbserver/inferiors.cc \ gdbserver/linux-low.cc \ @@ -66,11 +46,41 @@ SRC_CC += common/agent.cc \ gdbserver/tdesc.cc \ gdbserver/tracepoint.cc \ gdbserver/utils.cc \ - gdbserver/x86-low.cc \ - nat/fork-inferior.cc \ + gdbserver/x86-low.cc + +# gdbsupport +SRC_CC += gdbsupport/agent.cc \ + gdbsupport/buffer.cc \ + gdbsupport/cleanups.cc \ + gdbsupport/common-debug.cc \ + gdbsupport/common-exceptions.cc \ + gdbsupport/common-inferior.cc \ + gdbsupport/common-utils.cc \ + gdbsupport/environ.cc \ + gdbsupport/errors.cc \ + gdbsupport/event-loop.cc \ + gdbsupport/fileio.cc \ + gdbsupport/filestuff.cc \ + gdbsupport/format.cc \ + gdbsupport/gdb_tilde_expand.cc \ + gdbsupport/gdb_vecs.cc \ + gdbsupport/job-control.cc \ + gdbsupport/netstuff.cc \ + gdbsupport/pathstuff.cc \ + gdbsupport/print-utils.cc \ + gdbsupport/ptid.cc \ + gdbsupport/rsp-low.cc \ + gdbsupport/safe-strerror.cc \ + gdbsupport/signals.cc \ + gdbsupport/tdesc.cc \ + gdbsupport/xml-utils.cc + +# gdb +SRC_CC += nat/fork-inferior.cc \ nat/linux-ptrace.cc \ nat/x86-dregs.cc \ - target/waitstatus.cc + target/waitstatus.cc \ + alloc.cc # genode SRC_CC += genode-low.cc \ @@ -80,13 +90,14 @@ SRC_CC += genode-low.cc \ signal_handler_thread.cc \ main.cc -CC_OPT += -DGDBSERVER -DPKGVERSION="\"8.1.1\"" -DREPORT_BUGS_TO="\"\"" +CC_OPT += -DGDBSERVER -DPKGVERSION="\"10.2\"" -DREPORT_BUGS_TO="\"\"" CC_OPT += -DHAVE_SYS_WAIT_H -DHAVE_SYS_PTRACE_H -DHAVE_DECL_PTRACE -DHAVE_TERMIOS CC_OPT += -fpermissive -Wno-unused-function -vpath %.c $(GDB_CONTRIB_DIR)/gdb/gnulib/import +vpath %.c $(GDB_CONTRIB_DIR)/gnulib/import vpath %.c $(GDB_CONTRIB_DIR)/libiberty vpath %.cc $(GDB_CONTRIB_DIR)/gdb +vpath %.cc $(GDB_CONTRIB_DIR) vpath %.cc $(PRG_DIR)/gdbserver # diff --git a/repos/ports/src/noux-pkg/gdb/patches/arm_single_step.patch b/repos/ports/src/noux-pkg/gdb/patches/arm_single_step.patch index 705c89c1b3..cef875f826 100644 --- a/repos/ports/src/noux-pkg/gdb/patches/arm_single_step.patch +++ b/repos/ports/src/noux-pkg/gdb/patches/arm_single_step.patch @@ -8,10 +8,10 @@ Enable software single-stepping on ARM. 1 file changed, 2 insertions(+) diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c -index cfdfb0b..3afe712 100644 +index be342117..8c87f098 100644 --- a/gdb/arm-tdep.c +++ b/gdb/arm-tdep.c -@@ -9289,6 +9289,8 @@ arm_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) +@@ -9339,6 +9339,8 @@ arm_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) tdep = XCNEW (struct gdbarch_tdep); gdbarch = gdbarch_alloc (&info, tdep); diff --git a/repos/ports/src/noux-pkg/gdb/patches/call_dummy_location.patch b/repos/ports/src/noux-pkg/gdb/patches/call_dummy_location.patch index 0bf65ce052..c73846abcf 100644 --- a/repos/ports/src/noux-pkg/gdb/patches/call_dummy_location.patch +++ b/repos/ports/src/noux-pkg/gdb/patches/call_dummy_location.patch @@ -8,10 +8,10 @@ From: Christian Prochaska 1 file changed, 2 insertions(+) diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c -index fe2453c..6c9fdf8 100644 +index d97c5629..a6df6fe3 100644 --- a/gdb/i386-tdep.c +++ b/gdb/i386-tdep.c -@@ -8479,7 +8479,9 @@ i386_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) +@@ -8573,7 +8573,9 @@ i386_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_get_longjmp_target (gdbarch, i386_get_longjmp_target); /* Call dummy code. */ diff --git a/repos/ports/src/noux-pkg/gdb/patches/gdb_x86_64.patch b/repos/ports/src/noux-pkg/gdb/patches/gdb_x86_64.patch index 8b78239f12..baa1243583 100644 --- a/repos/ports/src/noux-pkg/gdb/patches/gdb_x86_64.patch +++ b/repos/ports/src/noux-pkg/gdb/patches/gdb_x86_64.patch @@ -4,14 +4,14 @@ From: Christian Prochaska --- - gdb/amd64-tdep.c | 13 +++++++++++++ - gdb/defs.h | 1 + + gdb/amd64-tdep.c | 14 ++++++++++++++ gdb/i386-tdep.c | 5 +++++ gdb/osabi.c | 6 ++++++ - 4 files changed, 25 insertions(+) + gdb/osabi.h | 1 + + 4 files changed, 26 insertions(+) diff --git a/gdb/amd64-tdep.c b/gdb/amd64-tdep.c -index e1f8862..314bf77 100644 +index 1d8cfd0b..55eb6f60 100644 --- a/gdb/amd64-tdep.c +++ b/gdb/amd64-tdep.c @@ -50,6 +50,7 @@ @@ -22,7 +22,7 @@ index e1f8862..314bf77 100644 #include "solib-svr4.h" /* Note that the AMD64 architecture was previously known as x86-64. -@@ -3296,6 +3297,13 @@ amd64_target_description (uint64_t xcr0, bool segments) +@@ -3359,7 +3360,15 @@ amd64_target_description (uint64_t xcr0, bool segments) return *tdesc; } @@ -32,14 +32,16 @@ index e1f8862..314bf77 100644 + amd64_init_abi (info, gdbarch, + amd64_target_description (X86_XSTATE_SSE_MASK, false)); +} ++ + void _initialize_amd64_tdep (); + void - _initialize_amd64_tdep (void) + _initialize_amd64_tdep () { -@@ -3326,6 +3334,11 @@ _initialize_amd64_tdep (void) - selftests::record_xml_tdesc (a.xml, tdesc); - } - #endif /* GDB_SELF_TEST */ +@@ -3367,6 +3376,11 @@ _initialize_amd64_tdep () + amd64_none_init_abi); + gdbarch_register_osabi (bfd_arch_i386, bfd_mach_x64_32, GDB_OSABI_NONE, + amd64_x32_none_init_abi); + + /* Genode */ + gdbarch_register_osabi(bfd_arch_i386, bfd_mach_x86_64, @@ -48,23 +50,11 @@ index e1f8862..314bf77 100644 } -diff --git a/gdb/defs.h b/gdb/defs.h -index fc42170..6a43bf4 100644 ---- a/gdb/defs.h -+++ b/gdb/defs.h -@@ -495,6 +495,7 @@ enum gdb_osabi - GDB_OSABI_LYNXOS178, - GDB_OSABI_NEWLIB, - GDB_OSABI_SDE, -+ GDB_OSABI_GENODE, - - GDB_OSABI_INVALID /* keep this last */ - }; diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c -index 18e6e77..fe2453c 100644 +index 057f3e3c..d97c5629 100644 --- a/gdb/i386-tdep.c +++ b/gdb/i386-tdep.c -@@ -9051,6 +9051,11 @@ Show Intel Memory Protection Extensions specific variables."), +@@ -9134,6 +9134,11 @@ Show Intel Memory Protection Extensions specific variables."), gdbarch_register_osabi (bfd_arch_i386, 0, GDB_OSABI_SVR4, i386_svr4_init_abi); @@ -77,18 +67,18 @@ index 18e6e77..fe2453c 100644 i386_init_reggroups (); diff --git a/gdb/osabi.c b/gdb/osabi.c -index 7d0540b..a68eea6 100644 +index 1a9cdc82..5e7e7731 100644 --- a/gdb/osabi.c +++ b/gdb/osabi.c -@@ -80,6 +80,7 @@ static const struct osabi_names gdb_osabi_names[] = - { "LynxOS178", NULL }, +@@ -82,6 +82,7 @@ static const struct osabi_names gdb_osabi_names[] = { "Newlib", NULL }, { "SDE", NULL }, + { "PikeOS", NULL }, + { "Genode", NULL }, { "", NULL } }; -@@ -562,6 +563,11 @@ generic_elf_osabi_sniffer (bfd *abfd) +@@ -564,6 +565,11 @@ generic_elf_osabi_sniffer (bfd *abfd) bfd_map_over_sections (abfd, generic_elf_osabi_sniff_abi_tag_sections, &osabi); @@ -100,3 +90,15 @@ index 7d0540b..a68eea6 100644 break; case ELFOSABI_FREEBSD: +diff --git a/gdb/osabi.h b/gdb/osabi.h +index c510f99f..06a4eb99 100644 +--- a/gdb/osabi.h ++++ b/gdb/osabi.h +@@ -47,6 +47,7 @@ enum gdb_osabi + GDB_OSABI_NEWLIB, + GDB_OSABI_SDE, + GDB_OSABI_PIKEOS, ++ GDB_OSABI_GENODE, + + GDB_OSABI_INVALID /* keep this last */ + }; diff --git a/repos/ports/src/noux-pkg/gdb/patches/gdbserver_genode.patch b/repos/ports/src/noux-pkg/gdb/patches/gdbserver_genode.patch index 508b2ebf03..3f33bc5dcd 100644 --- a/repos/ports/src/noux-pkg/gdb/patches/gdbserver_genode.patch +++ b/repos/ports/src/noux-pkg/gdb/patches/gdbserver_genode.patch @@ -4,65 +4,1222 @@ From: Christian Prochaska --- - gdb/common/common-defs.h | 8 + - gdb/common/gdb_tilde_expand.c | 10 ++ - gdb/common/pathstuff.c | 2 - gdb/gdbserver/linux-aarch32-low.c | 4 + - gdb/gdbserver/linux-arm-low.c | 8 + - gdb/gdbserver/linux-low.c | 168 ++++++++++++++++++++++++++++++ - gdb/gdbserver/linux-low.h | 5 + - gdb/gdbserver/linux-x86-low.c | 111 +++++++++++++++++++- - gdb/gdbserver/linux-x86-tdesc-selftest.c | 31 ++++++ - gdb/gdbserver/linux-x86-tdesc.c | 8 + - gdb/gdbserver/remote-utils.c | 15 +++ - gdb/gdbserver/server.c | 36 ++++++ - gdb/gdbserver/server.h | 4 + - gdb/nat/fork-inferior.c | 4 - - gdb/nat/gdb_ptrace.h | 2 - gdb/nat/linux-ptrace.c | 17 +++ - gdb/nat/linux-ptrace.h | 4 + - 17 files changed, 422 insertions(+), 15 deletions(-) + gdb/nat/fork-inferior.c | 4 + + gdb/nat/gdb_ptrace.h | 2 + + gdb/nat/linux-ptrace.c | 28 +++++++++ + gdb/nat/linux-ptrace.h | 4 + + gdbserver/linux-aarch32-low.cc | 4 + + gdbserver/linux-arm-low.cc | 8 +++ + gdbserver/linux-low.cc | 73 ++++++++++++++++++++++++ + gdbserver/linux-low.h | 8 ++- + gdbserver/linux-x86-low.cc | 120 +++++++++++++++++++++++++++++++++++++++- + gdbserver/linux-x86-tdesc.cc | 8 +++ + gdbserver/remote-utils.cc | 15 +++++ + gdbserver/server.cc | 32 ++++++++++- + gdbsupport/common-defs.h | 4 + + gdbsupport/common-inferior.cc | 4 + + gdbsupport/common-types.h | 17 ++++++ + gdbsupport/gdb-sigmask.h | 4 + + gdbsupport/gdb_tilde_expand.cc | 10 +++ + gdbsupport/pathstuff.cc | 2 + + 18 files changed, 333 insertions(+), 14 deletions(-) -diff --git a/gdb/common/common-defs.h b/gdb/common/common-defs.h -index eb0ec21..4dc07ce 100644 ---- a/gdb/common/common-defs.h -+++ b/gdb/common/common-defs.h -@@ -28,7 +28,9 @@ - #undef PACKAGE_TARNAME - - #ifdef GDBSERVER +diff --git a/gdb/nat/fork-inferior.c b/gdb/nat/fork-inferior.c +index 559773f7..bab829fb 100644 +--- a/gdb/nat/fork-inferior.c ++++ b/gdb/nat/fork-inferior.c +@@ -402,9 +402,9 @@ fork_inferior (const char *exec_file_arg, const std::string &allargs, + undebuggable. Indeed, you probably got an error message + saying "not parent". Sorry; you'll have to use print + statements! */ +- +#ifndef __GENODE__ - #include "build-gnulib-gdbserver/config.h" -+#endif /* __GENODE__ */ - #else - #include "build-gnulib/config.h" - #endif -@@ -69,9 +71,11 @@ - #include /* for strcasecmp and strncasecmp */ - #endif - #include -+#ifndef __GENODE__ - #include + restore_original_signals_state (); - +#endif /* __GENODE__ */ + /* There is no execlpe call, so we have to set the environment + for our child in the global variable. If we've vforked, this + clobbers the parent, but environ is restored a few lines down +diff --git a/gdb/nat/gdb_ptrace.h b/gdb/nat/gdb_ptrace.h +index f7bdd113..8f148d10 100644 +--- a/gdb/nat/gdb_ptrace.h ++++ b/gdb/nat/gdb_ptrace.h +@@ -121,6 +121,7 @@ + # endif + #endif + ++#ifndef __GENODE__ + /* Some systems, at least AIX and HP-UX have a ptrace with five + arguments. Since we never use the fifth argument, define a ptrace + macro that calls the real ptrace with the last argument set to +@@ -141,5 +142,6 @@ + # define ptrace(request, pid, addr, data) \ + ptrace ((PTRACE_TYPE_ARG1) request, pid, addr, data) + #endif ++#endif /* __GENODE__ */ + + #endif /* NAT_GDB_PTRACE_H */ +diff --git a/gdb/nat/linux-ptrace.c b/gdb/nat/linux-ptrace.c +index 17f43154..842b8077 100644 +--- a/gdb/nat/linux-ptrace.c ++++ b/gdb/nat/linux-ptrace.c +@@ -36,6 +36,7 @@ static int supported_ptrace_options = -1; + std::string + linux_ptrace_attach_fail_reason (pid_t pid) + { ++#ifndef __GENODE__ + pid_t tracerpid = linux_proc_get_tracerpid_nowarn (pid); + std::string result; + +@@ -51,6 +52,7 @@ linux_ptrace_attach_fail_reason (pid_t pid) + (int) pid); + + return result; ++#endif + } + + /* See linux-ptrace.h. */ +@@ -73,10 +75,13 @@ linux_ptrace_attach_fail_reason_string (ptid_t ptid, int err) + /* Address of the 'ret' instruction in asm code block below. */ + EXTERN_C void linux_ptrace_test_ret_to_nx_instr (void); + ++#ifndef __GENODE__ + #include ++#endif + #include + #include +- ++#else ++#include + #endif /* defined __i386__ || defined __x86_64__ */ + + /* Kill CHILD. WHO is used to report warnings. */ +@@ -112,6 +117,7 @@ kill_child (pid_t child, const char *who) + } + } + ++#ifndef __GENODE__ + /* Test broken off-trunk Linux kernel patchset for NX support on i386. It was + removed in Fedora kernel 88fa1f0332d188795ed73d7ac2b1564e11a0b4cd. + +@@ -256,6 +262,7 @@ linux_ptrace_test_ret_to_nx (void) + "support detected!")); + #endif /* defined __i386__ || defined __x86_64__ */ + } ++#endif /* __GENODE__ */ + + /* Helper function to fork a process and make the child process call + the function FUNCTION, passing CHILD_STACK as parameter. +@@ -341,6 +348,7 @@ static void linux_test_for_exitkill (int child_pid); + void + linux_check_ptrace_features (void) + { ++#ifndef __GENODE__ + int child_pid, ret, status; + + /* Initialize the options. */ +@@ -370,6 +378,18 @@ linux_check_ptrace_features (void) + + /* Kill child_pid. */ + kill_child (child_pid, "linux_check_ptrace_features"); ++ ++ /* Clean things up and kill any pending children. */ ++ do ++ { ++ ret = ptrace (PTRACE_KILL, child_pid, (PTRACE_TYPE_ARG3) 0, ++ (PTRACE_TYPE_ARG4) 0); ++ if (ret != 0) ++ warning (_("linux_check_ptrace_features: failed to kill child")); ++ my_waitpid (child_pid, &status, 0); ++ } ++ while (WIFSTOPPED (status)); ++#endif + } + + /* Determine if PTRACE_O_TRACESYSGOOD can be used to catch +@@ -482,6 +502,7 @@ linux_test_for_exitkill (int child_pid) + void + linux_enable_event_reporting (pid_t pid, int options) + { ++#ifndef __GENODE__ + /* Check if we have initialized the ptrace features for this + target. If not, do it now. */ + if (supported_ptrace_options == -1) +@@ -496,6 +517,7 @@ linux_enable_event_reporting (pid_t pid, int options) + /* Set the options. */ + ptrace (PTRACE_SETOPTIONS, pid, (PTRACE_TYPE_ARG3) 0, + (PTRACE_TYPE_ARG4) (uintptr_t) options); ++#endif /* __GENODE__ */ + } + + /* Disable reporting of all currently supported ptrace events. */ +@@ -503,8 +525,10 @@ linux_enable_event_reporting (pid_t pid, int options) + void + linux_disable_event_reporting (pid_t pid) + { ++#ifndef __GENODE__ + /* Set the options. */ + ptrace (PTRACE_SETOPTIONS, pid, (PTRACE_TYPE_ARG3) 0, 0); ++#endif /* __GENODE__ */ + } + + /* Returns non-zero if PTRACE_OPTIONS is contained within +@@ -583,7 +607,9 @@ linux_ptrace_init_warnings (void) + return; + warned = 1; + ++#ifndef __GENODE__ + linux_ptrace_test_ret_to_nx (); ++#endif + } + + /* Extract extended ptrace event from wait status. */ +diff --git a/gdb/nat/linux-ptrace.h b/gdb/nat/linux-ptrace.h +index 6e973dc5..16ba731f 100644 +--- a/gdb/nat/linux-ptrace.h ++++ b/gdb/nat/linux-ptrace.h +@@ -115,7 +115,11 @@ struct buffer; + way to go. That said, some architecture may get the si_code wrong, + and as such we're leaving fallback code in place. We'll remove + this after a while if no problem is reported. */ ++#ifdef __GENODE__ ++#define USE_SIGTRAP_SIGINFO 0 ++#else + #define USE_SIGTRAP_SIGINFO 1 ++#endif + + /* The x86 kernel gets some of the si_code values backwards, like + this: +diff --git a/gdbserver/linux-aarch32-low.cc b/gdbserver/linux-aarch32-low.cc +index 8f733e7d..c621ec30 100644 +--- a/gdbserver/linux-aarch32-low.cc ++++ b/gdbserver/linux-aarch32-low.cc +@@ -35,7 +35,11 @@ + is used for gdbserver, so single threaded debugging should work + OK, but for multi-threaded debugging we only insert the current + ABI's breakpoint instruction. For now at least. */ ++#ifdef __GENODE__ ++#define arm_eabi_breakpoint 0xe7ffdefeUL ++#else + #define arm_eabi_breakpoint 0xe7f001f0UL ++#endif + + #if (defined __ARM_EABI__ || defined __aarch64__) + static const unsigned long arm_breakpoint = arm_eabi_breakpoint; +diff --git a/gdbserver/linux-arm-low.cc b/gdbserver/linux-arm-low.cc +index cba0f078..521e07c0 100644 +--- a/gdbserver/linux-arm-low.cc ++++ b/gdbserver/linux-arm-low.cc +@@ -32,6 +32,9 @@ + #include + #endif + #include "nat/gdb_ptrace.h" ++#ifdef __GENODE__ ++#include ++#endif + #include + #include + +@@ -960,6 +963,10 @@ arm_read_description (void) + { + unsigned long arm_hwcap = linux_get_hwcap (4); + ++ /* Query hardware watchpoint/breakpoint capabilities. */ ++ arm_linux_init_hwbp_cap (pid); ++ ++#ifndef __GENODE__ + if (arm_hwcap & HWCAP_IWMMXT) + return arm_linux_read_description (ARM_FP_TYPE_IWMMXT); + +@@ -982,6 +989,7 @@ arm_read_description (void) + else + return arm_linux_read_description (ARM_FP_TYPE_VFPV2); + } ++#endif + + /* The default configuration uses legacy FPA registers, probably + simulated. */ +diff --git a/gdbserver/linux-low.cc b/gdbserver/linux-low.cc +index b1f997ae..823c5e56 100644 +--- a/gdbserver/linux-low.cc ++++ b/gdbserver/linux-low.cc +@@ -27,6 +27,11 @@ + #include "nat/linux-waitpid.h" + #include "gdbsupport/gdb_wait.h" + #include "nat/gdb_ptrace.h" ++ ++#ifdef __GENODE__ ++#include "genode-low.h" ++#endif ++ + #include "nat/linux-ptrace.h" + #include "nat/linux-procfs.h" + #include "nat/linux-personality.h" +@@ -694,7 +699,11 @@ linux_process_target::handle_extended_wait (lwp_info **orig_event_lwp, + /* Set the event status. */ + event_lwp->waitstatus.kind = TARGET_WAITKIND_EXECD; + event_lwp->waitstatus.value.execd_pathname ++#ifdef __GENODE__ ++ = xstrdup ("target"); ++#else + = xstrdup (linux_proc_pid_to_exec_file (lwpid_of (event_thr))); ++#endif + + /* Mark the exec status as pending. */ + event_lwp->stopped = 1; +@@ -970,8 +979,10 @@ linux_process_target::create_inferior (const char *program, + ptid_t ptid; + + { ++#ifndef __GENODE__ + maybe_disable_address_space_randomization restore_personality + (cs.disable_randomization); ++#endif /* __GENODE__ */ + std::string str_program_args = construct_inferior_arguments (program_args); + + pid = fork_inferior (program, +@@ -1016,12 +1027,17 @@ linux_process_target::attach_lwp (ptid_t ptid) + struct lwp_info *new_lwp; + int lwpid = ptid.lwp (); + ++#ifndef __GENODE__ + if (ptrace (PTRACE_ATTACH, lwpid, (PTRACE_TYPE_ARG3) 0, (PTRACE_TYPE_ARG4) 0) + != 0) + return errno; ++#endif + + new_lwp = add_lwp (ptid); + ++#ifdef __GENODE__ ++ new_lwp->stopped = 1; ++#else + /* We need to wait for SIGSTOP before being able to make the next + ptrace call on this LWP. */ + new_lwp->must_set_ptrace_flags = 1; +@@ -1088,6 +1104,7 @@ linux_process_target::attach_lwp (ptid_t ptid) + end of the list, and so the new thread has not yet reached + wait_for_sigstop (but will). */ + new_lwp->stop_expected = 1; ++#endif + + return 0; + } +@@ -1163,6 +1180,7 @@ linux_process_target::attach (unsigned long pid) + error ("Cannot attach to process %ld: %s", pid, reason.c_str ()); + } + ++#ifndef __GENODE__ + /* Don't ignore the initial SIGSTOP if we just attached to this + process. It will be collected by wait shortly. */ + initial_thread = find_thread_ptid (ptid_t (pid, pid, 0)); +@@ -1209,6 +1227,7 @@ linux_process_target::attach (unsigned long pid) + gdb_assert (proc->tdesc != NULL); + } + ++#endif + return 0; + } + +@@ -1346,6 +1365,7 @@ kill_one_lwp_callback (thread_info *thread, int pid) + kill_wait_lwp (lwp); + } + ++#ifndef __GENODE__ + int + linux_process_target::kill (process_info *process) + { +@@ -1380,6 +1400,7 @@ linux_process_target::kill (process_info *process) + unstop_all_lwps (0, NULL); + return 0; + } ++#endif /* __GENODE__ */ + + /* Get pending signal of THREAD, for detaching purposes. This is the + signal the thread last stopped for, which we need to deliver to the +@@ -1466,10 +1487,13 @@ void + linux_process_target::detach_one_lwp (lwp_info *lwp) + { + struct thread_info *thread = get_lwp_thread (lwp); ++#ifndef __GENODE__ + int sig; ++#endif /* __GENODE__ */ + int lwpid; + + /* If there is a pending SIGSTOP, get rid of it. */ ++#ifndef __GENODE__ + if (lwp->stop_expected) + { + if (debug_threads) +@@ -1479,7 +1503,9 @@ linux_process_target::detach_one_lwp (lwp_info *lwp) + kill_lwp (lwpid_of (thread), SIGCONT); + lwp->stop_expected = 0; + } ++#endif + ++#ifndef __GENODE__ + /* Pass on any pending signal for this thread. */ + sig = get_detach_signal (thread); + +@@ -1540,10 +1566,12 @@ linux_process_target::detach_one_lwp (lwp_info *lwp) + target_pid_to_str (ptid_of (thread)), + strsignal (sig)); + } ++#endif + + delete_lwp (lwp); + } + ++#ifndef __GENODE__ + int + linux_process_target::detach (process_info *process) + { +@@ -1592,6 +1620,7 @@ linux_process_target::detach (process_info *process) + unstop_all_lwps (0, NULL); + return 0; + } ++#endif /* __GENODE__ */ + + /* Remove all LWPs that belong to process PROC from the lwp list. */ + +@@ -1806,6 +1835,7 @@ iterate_over_lwps (ptid_t filter, + void + linux_process_target::check_zombie_leaders () + { ++#ifndef __GENODE__ + for_each_process ([this] (process_info *proc) { + pid_t leader_pid = pid_of (proc); + struct lwp_info *leader_lp; +@@ -1860,6 +1890,7 @@ linux_process_target::check_zombie_leaders () + delete_lwp (leader_lp); + } + }); ++#endif /* __GENODE__ */ + } + + /* Callback for `find_thread'. Returns the first LWP that is not +@@ -2606,11 +2637,13 @@ linux_process_target::wait_for_event_filtered (ptid_t wait_ptid, + + if (ret > 0) + { ++#ifndef __GENODE__ + if (debug_threads) + { + debug_printf ("LLW: waitpid %ld received %s\n", + (long) ret, status_to_str (*wstatp)); + } ++#endif /* __GENODE__ */ + + /* Filter all events. IOW, leave all events pending. We'll + randomly select an event LWP out of all that have events +@@ -2884,11 +2917,12 @@ linux_process_target::stabilize_threads () + static ptid_t + ignore_event (struct target_waitstatus *ourstatus) + { ++#ifndef __GENODE__ + /* If we got an event, there may still be others, as a single + SIGCHLD can indicate more than one child stopped. This forces + another target_wait call. */ + async_file_mark (); +- ++#endif /* __GENODE__ */ + ourstatus->kind = TARGET_WAITKIND_IGNORE; + return null_ptid; + } +@@ -3714,9 +3748,11 @@ linux_process_target::wait (ptid_t ptid, + { + ptid_t event_ptid; + ++#ifndef __GENODE__ + /* Flush the async file first. */ + if (target_is_async_p ()) + async_file_flush (); ++#endif + + do + { +@@ -3726,12 +3762,14 @@ linux_process_target::wait (ptid_t ptid, + && event_ptid == null_ptid + && ourstatus->kind == TARGET_WAITKIND_IGNORE); + ++#ifndef __GENODE__ + /* If at least one stop was reported, there may be more. A single + SIGCHLD can signal more than one child stop. */ + if (target_is_async_p () + && (target_options & TARGET_WNOHANG) != 0 + && event_ptid != null_ptid) + async_file_mark (); ++#endif + + return event_ptid; + } +@@ -3741,6 +3779,9 @@ linux_process_target::wait (ptid_t ptid, + static int + kill_lwp (unsigned long lwpid, int signo) + { ++#ifdef __GENODE__ ++ return kill (lwpid, signo); ++#else + int ret; + + errno = 0; +@@ -3752,6 +3793,7 @@ kill_lwp (unsigned long lwpid, int signo) + perror_with_name (("tkill")); + } + return ret; ++#endif + } + + void +@@ -4253,6 +4295,21 @@ linux_process_target::resume_one_lwp_throw (lwp_info *lwp, int step, + regcache_invalidate_thread (thread); + errno = 0; + lwp->stepping = step; ++ ++#ifdef __GENODE__ ++ ++ /* ++ * On Linux, the thread would get stopped immediately after resuming ++ * if a SIGSTOP is pending. This is not the case on Genode, so we ++ * just keep the thread stopped. ++ */ ++ if (lwp->stop_expected) ++ return; ++ ++ genode_continue_thread(lwpid_of(thread), step); ++ ++#else ++ + if (step) + ptrace_request = PTRACE_SINGLESTEP; + else if (gdb_catching_syscalls_p (lwp)) +@@ -4265,6 +4322,7 @@ linux_process_target::resume_one_lwp_throw (lwp_info *lwp, int step, + /* Coerce to a uintptr_t first to avoid potential gcc warning + of coercing an 8 byte integer to a 4 byte pointer. */ + (PTRACE_TYPE_ARG4) (uintptr_t) signal); ++#endif + + current_thread = saved_thread; + if (errno) +@@ -4308,7 +4366,7 @@ check_ptrace_stopped_lwp_gone (struct lwp_info *lp) + (observed in Linux 3.18). See also the note on ESRCH in the + ptrace(2) man page. Instead, check whether the LWP has any state + other than ptrace-stopped. */ +- ++#ifndef __GENODE__ + /* Don't assume anything if /proc/PID/status can't be read. */ + if (linux_proc_pid_is_trace_stopped_nowarn (lwpid_of (thread)) == 0) + { +@@ -4316,6 +4374,7 @@ check_ptrace_stopped_lwp_gone (struct lwp_info *lp) + lp->status_pending_p = 0; + return 1; + } ++#endif /* __GENODE__ */ + return 0; + } + +@@ -5135,6 +5194,7 @@ regsets_fetch_inferior_registers (struct regsets_info *regsets_info, + optional, do not try it again for this process mode. */ + disable_regset (regsets_info, regset); + } ++#ifndef __GENODE__ + else if (errno == ENODATA) + { + /* ENODATA may be returned if the regset is currently +@@ -5147,6 +5207,7 @@ regsets_fetch_inferior_registers (struct regsets_info *regsets_info, + already gone, in which case we simply ignore attempts + to read its registers. */ + } ++#endif + else + { + char s[256]; +@@ -5445,6 +5506,7 @@ linux_process_target::usr_store_inferior_registers (const regs_info *regs_info, + #endif + } + ++#ifndef __GENODE__ + void + linux_process_target::fetch_registers (regcache *regcache, int regno) + { +@@ -5500,6 +5562,7 @@ linux_process_target::store_registers (regcache *regcache, int regno) + usr_store_inferior_registers (regs_info, regcache, regno, 1); + } + } ++#endif /* __GENODE__ */ + + bool + linux_process_target::low_fetch_register (regcache *regcache, int regno) +@@ -5515,6 +5578,7 @@ linux_read_memory (CORE_ADDR memaddr, unsigned char *myaddr, int len) + return the_target->read_memory (memaddr, myaddr, len); + } + ++#ifndef __GENODE__ + /* Copy LEN bytes from inferior's memory starting at MEMADDR + to debugger memory starting at MYADDR. */ + +@@ -5695,6 +5759,7 @@ linux_process_target::write_memory (CORE_ADDR memaddr, + + return 0; + } ++#endif /* __GENODE__ */ + + void + linux_process_target::look_up_symbols () +@@ -6430,6 +6495,7 @@ linux_process_target::done_accessing_memory () + target_unpause_all (true); + } + ++#ifndef __GENODE__ + /* Extract &phdr and num_phdr in the inferior. Return 0 on success. */ + + static int +@@ -6922,6 +6988,7 @@ linux_process_target::qxfer_libraries_svr4 (const char *annex, + + return len; + } ++#endif /* __GENODE__ */ + + #ifdef HAVE_LINUX_BTRACE + +@@ -7239,8 +7306,10 @@ initialize_low (void) + memset (&sigchld_action, 0, sizeof (sigchld_action)); + set_target_ops (the_linux_target); + ++#ifndef __GENODE__ + linux_ptrace_init_warnings (); + linux_proc_init_warnings (); ++#endif + + sigchld_action.sa_handler = sigchld_handler; + sigemptyset (&sigchld_action.sa_mask); +diff --git a/gdbserver/linux-low.h b/gdbserver/linux-low.h +index 0200e9e5..0e738698 100644 +--- a/gdbserver/linux-low.h ++++ b/gdbserver/linux-low.h +@@ -20,11 +20,16 @@ + #define GDBSERVER_LINUX_LOW_H + + #include "nat/linux-nat.h" ++#ifndef __GENODE__ + #include "nat/gdb_thread_db.h" ++#endif + #include + + #include "gdbthread.h" ++ ++#ifndef __GENODE__ + #include "gdb_proc_service.h" ++#endif + + /* Included for ptrace type definitions. */ + #include "nat/linux-ptrace.h" +@@ -552,10 +557,11 @@ class linux_process_target : public process_stratum_target + error. */ + int attach_lwp (ptid_t ptid); + +-private: /* Back to private. */ + /* Detach from LWP. */ + void detach_one_lwp (lwp_info *lwp); + ++private: /* Back to private. */ ++ + /* Detect zombie thread group leaders, and "exit" them. We can't + reap their exits until all other threads in the group have + exited. */ +diff --git a/gdbserver/linux-x86-low.cc b/gdbserver/linux-x86-low.cc +index 79284473..56555d30 100644 +--- a/gdbserver/linux-x86-low.cc ++++ b/gdbserver/linux-x86-low.cc +@@ -31,13 +31,19 @@ + #include "nat/amd64-linux-siginfo.h" + #endif + ++#ifndef __GENODE__ + #include "gdb_proc_service.h" ++#endif + /* Don't include elf/common.h if linux/elf.h got included by + gdb_proc_service.h. */ + #ifndef ELFMAG0 + #include "elf/common.h" + #endif + ++#ifdef __GENODE__ ++#include "genode-low.h" ++#endif ++ + #include "gdbsupport/agent.h" + #include "tdesc.h" + #include "tracepoint.h" +@@ -52,11 +58,23 @@ static struct target_desc *tdesc_amd64_linux_no_xml; + #endif + static struct target_desc *tdesc_i386_linux_no_xml; + +- + static unsigned char jump_insn[] = { 0xe9, 0, 0, 0, 0 }; + static unsigned char small_jump_insn[] = { 0x66, 0xe9, 0, 0 }; + + /* Backward compatibility for gdb without XML support. */ ++#ifdef __GENODE__ ++ ++static const char *xmltarget_i386_linux_no_xml = "@\ ++i386\ ++"; ++ ++#ifdef __x86_64__ ++static const char *xmltarget_amd64_linux_no_xml = "@\ ++i386:x86-64\ ++"; ++#endif ++ ++#else + + static const char *xmltarget_i386_linux_no_xml = "@\ + i386\ +@@ -70,7 +88,17 @@ static const char *xmltarget_amd64_linux_no_xml = "@\ + "; + #endif + ++#endif /* __GENODE__ */ ++ ++#ifdef __GENODE__ ++#ifdef __x86_64__ ++#include "amd64.h" ++#else ++#include "i386.h" ++#endif /* __x86_64__ */ ++#else + #include ++#endif + #include + #include + +@@ -219,7 +247,11 @@ static /*const*/ int i386_regmap[] = + #define ORIG_EAX ORIG_RAX + #define REGSIZE 8 + +-static const int x86_64_regmap[] = ++static ++#ifndef __GENODE__ ++const ++#endif ++int x86_64_regmap[] = + { + RAX * 8, RBX * 8, RCX * 8, RDX * 8, + RSI * 8, RDI * 8, RBP * 8, RSP * 8, +@@ -232,6 +264,7 @@ static const int x86_64_regmap[] = + -1, -1, -1, -1, -1, -1, -1, -1, + -1, + -1, -1, -1, -1, -1, -1, -1, -1, ++#ifndef __GENODE__ + ORIG_RAX * 8, + 21 * 8, 22 * 8, + -1, -1, -1, -1, /* MPX registers BND0 ... BND3. */ +@@ -246,6 +279,7 @@ static const int x86_64_regmap[] = + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + -1 /* pkru */ ++#endif + }; + + #define X86_64_NUM_REGS (sizeof (x86_64_regmap) / sizeof (x86_64_regmap[0])) +@@ -287,6 +321,7 @@ is_64bit_tdesc (void) + + /* Called by libthread_db. */ + ++#ifndef __GENODE__ + ps_err_e + ps_get_thread_area (struct ps_prochandle *ph, + lwpid_t lwpid, int idx, void **base) +@@ -325,6 +360,7 @@ ps_get_thread_area (struct ps_prochandle *ph, + return PS_OK; + } + } ++#endif + + /* Get the thread area address. This is used to recognize which + thread is which when tracing with the in-process agent library. We +@@ -380,7 +416,11 @@ x86_target::low_cannot_store_register (int regno) + { + #ifdef __x86_64__ + if (is_64bit_tdesc ()) ++#ifdef __GENODE__ ++ return regno >= X86_64_NUM_REGS; ++#else + return false; ++#endif /* GENODE */ + #endif + + return regno >= I386_NUM_REGS; +@@ -391,12 +431,30 @@ x86_target::low_cannot_fetch_register (int regno) + { + #ifdef __x86_64__ + if (is_64bit_tdesc ()) ++#ifdef __GENODE__ ++ return regno >= X86_64_NUM_REGS; ++#else + return false; ++#endif /* GENODE */ + #endif + + return regno >= I386_NUM_REGS; + } + ++#ifdef __x86_64__ ++static int ++x86_64_cannot_store_register (int regno) ++{ ++ return regno >= X86_64_NUM_REGS; ++} ++ ++static int ++x86_64_cannot_fetch_register (int regno) ++{ ++ return regno >= X86_64_NUM_REGS; ++} ++#endif /* __x86_64__ */ ++ + static void + x86_fill_gregset (struct regcache *regcache, void *buf) + { +@@ -420,8 +478,10 @@ x86_fill_gregset (struct regcache *regcache, void *buf) + for (i = 0; i < I386_NUM_REGS; i++) + collect_register (regcache, i, ((char *) buf) + i386_regmap[i]); + ++#ifndef __GENODE__ + collect_register_by_name (regcache, "orig_eax", + ((char *) buf) + ORIG_EAX * REGSIZE); ++#endif /* __GENODE__ */ + + #ifdef __x86_64__ + /* Sign extend EAX value to avoid potential syscall restart +@@ -458,8 +518,10 @@ x86_store_gregset (struct regcache *regcache, const void *buf) + for (i = 0; i < I386_NUM_REGS; i++) + supply_register (regcache, i, ((char *) buf) + i386_regmap[i]); + ++#ifndef __GENODE__ + supply_register_by_name (regcache, "orig_eax", + ((char *) buf) + ORIG_EAX * REGSIZE); ++#endif + } + + static void +@@ -588,11 +650,23 @@ x86_target::low_set_pc (regcache *regcache, CORE_ADDR pc) + int + x86_target::low_decr_pc_after_break () + { ++#ifndef __GENODE__ + return 1; ++#else ++ return 0; /* With the HLT instruction, the PC does not get incremented */ ++#endif + } + + ++#ifdef __GENODE__ ++/* The 'INT3' instruction is used by some kernel debuggers and thus cannot ++ * serve as breakpoint instruction for the GDB monitor. Instead, the 'HLT' ++ * instruction gets used. It's a privileged instruction which triggers an ++ * exception when executed in user mode */ ++static const gdb_byte x86_breakpoint[] = { 0xF4 }; ++#else + static const gdb_byte x86_breakpoint[] = { 0xCC }; ++#endif + #define x86_breakpoint_len 1 + + bool +@@ -601,7 +675,7 @@ x86_target::low_breakpoint_at (CORE_ADDR pc) + unsigned char c; + + read_memory (pc, &c, 1); +- if (c == 0xCC) ++ if (c == x86_breakpoint[0]) + return true; + + return false; +@@ -689,8 +763,12 @@ x86_target::low_remove_point (raw_bkpt_type type, CORE_ADDR addr, + bool + x86_target::low_stopped_by_watchpoint () + { ++#ifndef __GENODE__ + struct process_info *proc = current_process (); + return x86_dr_stopped_by_watchpoint (&proc->priv->arch_private->debug_reg_state); ++#else ++ return false; ++#endif + } + + CORE_ADDR +@@ -769,8 +847,10 @@ x86_target::low_new_fork (process_info *parent, process_info *child) + void + x86_target::low_prepare_to_resume (lwp_info *lwp) + { ++#ifndef __GENODE__ + /* This comes from nat/. */ + x86_linux_prepare_to_resume (lwp); ++#endif /* __GENODE__ */ + } + + /* See nat/x86-dregs.h. */ +@@ -798,6 +878,7 @@ x86_debug_reg_state (pid_t pid) + bool + x86_target::low_siginfo_fixup (siginfo_t *ptrace, gdb_byte *inf, int direction) + { ++#ifndef __GENODE__ + #ifdef __x86_64__ + unsigned int machine; + int tid = lwpid_of (current_thread); +@@ -812,9 +893,11 @@ x86_target::low_siginfo_fixup (siginfo_t *ptrace, gdb_byte *inf, int direction) + return amd64_linux_siginfo_fixup_common (ptrace, inf, direction, + FIXUP_X32); + #endif ++#endif /* __GENODE__ */ + + return false; + } ++ + + static int use_xml; + +@@ -855,6 +938,13 @@ int have_ptrace_getfpxregs = + static const struct target_desc * + x86_linux_read_description (void) + { ++#ifdef __GENODE__ ++#ifdef __x86_64__ ++ return amd64_linux_read_description(X86_XSTATE_SSE_MASK, false); ++#else ++ return i386_linux_read_description(X86_XSTATE_SSE); ++#endif ++#else + unsigned int machine; + int is_elf64; + int xcr0_features; +@@ -970,7 +1060,7 @@ x86_linux_read_description (void) + + return tdesc; + } +- ++#endif /* __GENODE__ */ + gdb_assert_not_reached ("failed to return tdesc"); + } + +@@ -1005,6 +1095,14 @@ x86_target::update_xmltarget () + void + x86_target::process_qsupported (gdb::array_view features) + { ++#ifdef __GENODE__ ++ /* ++ * 'qSupported' is the first command sent by GDB when attaching to the ++ * server, so when at this location, GDB has just (re-)attached itself. ++ */ ++ genode_stop_all_threads(); ++#endif ++ + /* Return if gdb doesn't support XML. If gdb sends "xmlRegisters=" + with "i386" in qSupported query, it supports x86 XML target + descriptions. */ +@@ -1045,13 +1143,24 @@ static struct regsets_info x86_regsets_info = + }; + + #ifdef __x86_64__ ++static struct usrregs_info amd64_linux_usrregs_info = ++ { ++ X86_64_NUM_REGS, ++ x86_64_regmap, ++ }; ++ + static struct regs_info amd64_linux_regs_info = + { + NULL, /* regset_bitmap */ ++#ifdef __GENODE__ ++ &amd64_linux_usrregs_info, ++#else + NULL, /* usrregs_info */ ++#endif + &x86_regsets_info + }; + #endif ++ + static struct usrregs_info i386_linux_usrregs_info = + { + I386_NUM_REGS, +@@ -1113,6 +1222,9 @@ x86_target::low_get_syscall_trapinfo (regcache *regcache, int *sysno) + bool + x86_target::supports_tracepoints () + { ++#ifdef __GENODE__ ++ return false; ++#endif + return true; + } + +diff --git a/gdbserver/linux-x86-tdesc.cc b/gdbserver/linux-x86-tdesc.cc +index 4682eb4c..f0861968 100644 +--- a/gdbserver/linux-x86-tdesc.cc ++++ b/gdbserver/linux-x86-tdesc.cc +@@ -87,7 +87,11 @@ i386_linux_read_description (uint64_t xcr0) + + if (*tdesc == NULL) + { ++#ifdef __GENODE__ ++ *tdesc = i386_create_target_description (xcr0, false, false); ++#else + *tdesc = i386_create_target_description (xcr0, true, false); ++#endif /* __GENODE__ */ + + init_target_desc (*tdesc, i386_expedite_regs); + } +@@ -118,7 +122,11 @@ amd64_linux_read_description (uint64_t xcr0, bool is_x32) + + if (*tdesc == NULL) + { ++#ifdef __GENODE__ ++ *tdesc = amd64_create_target_description (xcr0, is_x32, false, false); ++#else + *tdesc = amd64_create_target_description (xcr0, is_x32, true, true); ++#endif /* __GENODE__ */ + + init_target_desc (*tdesc, amd64_expedite_regs); + } +diff --git a/gdbserver/remote-utils.cc b/gdbserver/remote-utils.cc +index 1195ce87..6e913ea2 100644 +--- a/gdbserver/remote-utils.cc ++++ b/gdbserver/remote-utils.cc +@@ -30,6 +30,12 @@ + #include "gdbsupport/filestuff.h" + #include "gdbsupport/gdb-sigmask.h" + #include ++ ++#ifdef __GENODE__ ++#include ++#include "genode-low.h" ++#endif ++ + #if HAVE_SYS_IOCTL_H + #include + #endif +@@ -98,7 +104,10 @@ struct sym_cache + + static int remote_is_stdio = 0; + +-static int remote_desc = -1; ++#ifndef __GENODE__ ++static ++#endif ++int remote_desc = -1; + static int listen_desc = -1; + + #ifdef USE_WIN32API +@@ -339,7 +348,11 @@ remote_open (const char *name) + struct stat statbuf; + + if (stat (name, &statbuf) == 0 ++#ifndef __GENODE__ + && (S_ISCHR (statbuf.st_mode) || S_ISFIFO (statbuf.st_mode))) ++#else ++ ) ++#endif + remote_desc = open (name, O_RDWR); + else + { +diff --git a/gdbserver/server.cc b/gdbserver/server.cc +index 9c403a64..e0d1dfc1 100644 +--- a/gdbserver/server.cc ++++ b/gdbserver/server.cc +@@ -32,6 +32,14 @@ + #include "gdbsupport/gdb_wait.h" + #include "gdbsupport/btrace-common.h" + #include "gdbsupport/filestuff.h" ++ ++#ifdef __GENODE__ ++#include "genode-low.h" ++#include "linux-low.h" ++/* don't have the generated header with the declaration */ ++extern "C" char *strchrnul(const char *s, int c_in); ++#endif ++ + #include "tracepoint.h" + #include "dll.h" + #include "hostio.h" +@@ -1286,7 +1294,9 @@ handle_detach (char *own_buf) + need to hang around doing nothing, until the child is + gone. */ + join_inferior (pid); ++#ifndef __GENODE__ + exit (0); ++#endif /* __GENODE__ */ + } + } + } +@@ -3156,11 +3166,11 @@ handle_v_requests (char *own_buf, int packet_len, int *new_packet_len) + return; + } + } +- ++#ifndef __GENODE__ + if (startswith (own_buf, "vFile:") + && handle_vFile (own_buf, packet_len, new_packet_len)) + return; +- ++#endif + if (startswith (own_buf, "vAttach;")) + { + if ((!extended_protocol || !cs.multi_process) && target_running ()) +@@ -3785,7 +3795,9 @@ captured_main (int argc, char *argv[]) + opened by remote_prepare. */ + notice_open_fds (); + ++#ifndef __GENODE__ + save_original_signals_state (false); ++#endif /* __GENODE__ */ + + /* We need to know whether the remote connection is stdio before + starting the inferior. Inferiors created in this scenario have +@@ -3987,7 +3999,11 @@ captured_main (int argc, char *argv[]) + /* Main function. */ + + int ++#ifdef __GENODE__ ++gdbserver_main (int argc, char *argv[]) ++#else + main (int argc, char *argv[]) ++#endif + { + + try +@@ -4088,6 +4104,10 @@ process_serial_event (void) + } + response_needed = true; + ++#ifdef __GENODE__ ++ if (debug_threads) printf("GDB command = %s\n", cs.own_buf); ++#endif ++ + char ch = cs.own_buf[0]; + switch (ch) + { +@@ -4335,7 +4355,11 @@ process_serial_event (void) + return 0; + } + else ++#ifndef __GENODE__ + exit (0); ++#else ++ return 0; ++#endif + + case 'T': + { +@@ -4410,7 +4434,9 @@ process_serial_event (void) + cs.own_buf[0] = '\0'; + break; + } +- ++#ifdef __GENODE__ ++ if (debug_threads) printf("GDBserver response = %s\n", cs.own_buf); ++#endif + if (new_packet_len != -1) + putpkt_binary (cs.own_buf, new_packet_len); + else +diff --git a/gdbsupport/common-defs.h b/gdbsupport/common-defs.h +index e5ece3ba..8fc25878 100644 +--- a/gdbsupport/common-defs.h ++++ b/gdbsupport/common-defs.h +@@ -28,7 +28,9 @@ + #undef PACKAGE_STRING + #undef PACKAGE_TARNAME + ++#ifndef __GENODE__ + #include "gnulib/config.h" ++#endif /* __GENODE__ */ + + /* From: + https://www.gnu.org/software/gnulib/manual/html_node/stdint_002eh.html +@@ -102,6 +104,7 @@ + #endif + #include "ansidecl.h" +#ifndef __GENODE__ /* 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 -@@ -79,7 +83,7 @@ +@@ -109,6 +112,7 @@ is compatible with ATTRIBUTE_PRINTF, simply use it. */ #undef ATTRIBUTE_PRINTF #define ATTRIBUTE_PRINTF _GL_ATTRIBUTE_FORMAT_PRINTF -- +#endif /* __GENODE__ */ - #include "libiberty.h" - #include "pathmax.h" - #include "gdb/signals.h" -diff --git a/gdb/common/gdb_tilde_expand.c b/gdb/common/gdb_tilde_expand.c -index fcb9796..bd77a83 100644 ---- a/gdb/common/gdb_tilde_expand.c -+++ b/gdb/common/gdb_tilde_expand.c + + #if GCC_VERSION >= 3004 + #define ATTRIBUTE_UNUSED_RESULT __attribute__ ((__warn_unused_result__)) +diff --git a/gdbsupport/common-inferior.cc b/gdbsupport/common-inferior.cc +index aed88409..2f03118d 100644 +--- a/gdbsupport/common-inferior.cc ++++ b/gdbsupport/common-inferior.cc +@@ -23,7 +23,11 @@ + + /* See common-inferior.h. */ + ++#ifdef __GENODE__ ++bool startup_with_shell = false; ++#else + bool startup_with_shell = true; ++#endif + + /* See common-inferior.h. */ + +diff --git a/gdbsupport/common-types.h b/gdbsupport/common-types.h +index 23f983d8..6c67d21d 100644 +--- a/gdbsupport/common-types.h ++++ b/gdbsupport/common-types.h +@@ -26,12 +26,29 @@ + typedef unsigned char gdb_byte; + + /* * An address in the program being debugged. Host byte order. */ ++#ifdef __GENODE__ ++/* ++ * Genode currently uses a common symbol file for 32-bit and 64-bit platforms, ++ * so the type needs to be the same for both platform types. ++ */ ++typedef unsigned long CORE_ADDR; ++#else + typedef uint64_t CORE_ADDR; ++#endif + + /* LONGEST must be at least as big as CORE_ADDR. */ + ++#ifdef __GENODE__ ++/* ++ * Genode currently uses a common symbol file for 32-bit and 64-bit platforms, ++ * so the type needs to be the same for both platform types. ++ */ ++typedef long LONGEST; ++typedef unsigned long ULONGEST; ++#else + typedef int64_t LONGEST; + typedef uint64_t ULONGEST; ++#endif + + /* * The largest CORE_ADDR value. */ + #define CORE_ADDR_MAX (~(CORE_ADDR) 0) +diff --git a/gdbsupport/gdb-sigmask.h b/gdbsupport/gdb-sigmask.h +index b4988cb4..a15601eb 100644 +--- a/gdbsupport/gdb-sigmask.h ++++ b/gdbsupport/gdb-sigmask.h +@@ -39,6 +39,10 @@ + #error pthread_sigmask available without sigprocmask - please report + #endif + ++#ifdef __GENODE__ ++#define gdb_sigmask(...) ++#endif /* __GENODE__ */ ++ + #endif /* HAVE_SIGPROCMASK */ + + +diff --git a/gdbsupport/gdb_tilde_expand.cc b/gdbsupport/gdb_tilde_expand.cc +index b31fc484..dcb32777 100644 +--- a/gdbsupport/gdb_tilde_expand.cc ++++ b/gdbsupport/gdb_tilde_expand.cc @@ -71,7 +71,12 @@ private: std::string gdb_tilde_expand (const char *dir) @@ -89,10 +1246,10 @@ index fcb9796..bd77a83 100644 gdb_assert (glob.pathc () > 0); /* "glob" may return more than one match to the path provided by the -diff --git a/gdb/common/pathstuff.c b/gdb/common/pathstuff.c -index 8c4093f..db3c23d 100644 ---- a/gdb/common/pathstuff.c -+++ b/gdb/common/pathstuff.c +diff --git a/gdbsupport/pathstuff.cc b/gdbsupport/pathstuff.cc +index 48c477fa..c3065efe 100644 +--- a/gdbsupport/pathstuff.cc ++++ b/gdbsupport/pathstuff.cc @@ -55,6 +55,7 @@ gdb_realpath (const char *filename) does not exist locally), we rely instead on GetFullPathName to perform the canonicalization. */ @@ -108,1283 +1265,4 @@ index 8c4093f..db3c23d 100644 +#endif /* __GENODE__ */ /* This system is a lost cause, just dup the buffer. */ - return gdb::unique_xmalloc_ptr (xstrdup (filename)); -diff --git a/gdb/gdbserver/linux-aarch32-low.c b/gdb/gdbserver/linux-aarch32-low.c -index 12c11a4..c42b5bb 100644 ---- a/gdb/gdbserver/linux-aarch32-low.c -+++ b/gdb/gdbserver/linux-aarch32-low.c -@@ -35,7 +35,11 @@ - is used for gdbserver, so single threaded debugging should work - OK, but for multi-threaded debugging we only insert the current - ABI's breakpoint instruction. For now at least. */ -+#ifdef __GENODE__ -+#define arm_eabi_breakpoint 0xe7ffdefeUL -+#else - #define arm_eabi_breakpoint 0xe7f001f0UL -+#endif - - #if (defined __ARM_EABI__ || defined __aarch64__) - static const unsigned long arm_breakpoint = arm_eabi_breakpoint; -diff --git a/gdb/gdbserver/linux-arm-low.c b/gdb/gdbserver/linux-arm-low.c -index 6c2dcea..b682f96 100644 ---- a/gdb/gdbserver/linux-arm-low.c -+++ b/gdb/gdbserver/linux-arm-low.c -@@ -30,6 +30,9 @@ - #include - #endif - #include "nat/gdb_ptrace.h" -+#ifdef __GENODE__ -+#include -+#endif - #include - #include - -@@ -878,6 +881,10 @@ arm_read_description (void) - /* Query hardware watchpoint/breakpoint capabilities. */ - arm_linux_init_hwbp_cap (pid); - -+#ifndef __GENODE__ -+ -+ /* Genode: 'init_registers_arm_with_*()' functions not generated */ -+ - if (arm_get_hwcap (&arm_hwcap) == 0) - return tdesc_arm; - -@@ -910,6 +917,7 @@ arm_read_description (void) - - return result; - } -+#endif - - /* The default configuration uses legacy FPA registers, probably - simulated. */ -diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c -index 7c396ae..c684d9b 100644 ---- a/gdb/gdbserver/linux-low.c -+++ b/gdb/gdbserver/linux-low.c -@@ -27,6 +27,11 @@ - #include "nat/linux-waitpid.h" - #include "gdb_wait.h" - #include "nat/gdb_ptrace.h" -+ -+#ifdef __GENODE__ -+#include "genode-low.h" -+#endif -+ - #include "nat/linux-ptrace.h" - #include "nat/linux-procfs.h" - #include "nat/linux-personality.h" -@@ -719,7 +724,11 @@ handle_extended_wait (struct lwp_info **orig_event_lwp, int wstat) - /* Set the event status. */ - event_lwp->waitstatus.kind = TARGET_WAITKIND_EXECD; - event_lwp->waitstatus.value.execd_pathname -+#ifdef __GENODE__ -+ = xstrdup ("target"); -+#else - = xstrdup (linux_proc_pid_to_exec_file (lwpid_of (event_thr))); -+#endif - - /* Mark the exec status as pending. */ - event_lwp->stopped = 1; -@@ -1005,8 +1014,10 @@ linux_create_inferior (const char *program, - ptid_t ptid; - - { -+#ifndef __GENODE__ - maybe_disable_address_space_randomization restore_personality - (cs.disable_randomization); -+#endif /* __GENODE__ */ - std::string str_program_args = stringify_argv (program_args); - - pid = fork_inferior (program, -@@ -1054,12 +1065,17 @@ linux_attach_lwp (ptid_t ptid) - struct lwp_info *new_lwp; - int lwpid = ptid.lwp (); - -+#ifndef __GENODE__ - if (ptrace (PTRACE_ATTACH, lwpid, (PTRACE_TYPE_ARG3) 0, (PTRACE_TYPE_ARG4) 0) - != 0) - return errno; -+#endif - - new_lwp = add_lwp (ptid); - -+#ifdef __GENODE__ -+ new_lwp->stopped = 1; -+#else - /* We need to wait for SIGSTOP before being able to make the next - ptrace call on this LWP. */ - new_lwp->must_set_ptrace_flags = 1; -@@ -1126,6 +1142,7 @@ linux_attach_lwp (ptid_t ptid) - end of the list, and so the new thread has not yet reached - wait_for_sigstop (but will). */ - new_lwp->stop_expected = 1; -+#endif - - return 0; - } -@@ -1200,6 +1217,7 @@ linux_attach (unsigned long pid) - - proc = linux_add_process (pid, 1); - -+#ifndef __GENODE__ - /* Don't ignore the initial SIGSTOP if we just attached to this - process. It will be collected by wait shortly. */ - initial_thread = find_thread_ptid (ptid_t (pid, pid, 0)); -@@ -1247,6 +1265,7 @@ linux_attach (unsigned long pid) - gdb_assert (proc->tdesc != NULL); - } - -+#endif - return 0; - } - -@@ -1507,14 +1526,21 @@ get_detach_signal (struct thread_info *thread) - - /* Detach from LWP. */ - -+#ifdef __GENODE__ -+void -+#else - static void -+#endif /* __GENODE__ */ - linux_detach_one_lwp (struct lwp_info *lwp) - { - struct thread_info *thread = get_lwp_thread (lwp); -+#ifndef __GENODE__ - int sig; -+#endif /* __GENODE__ */ - int lwpid; - - /* If there is a pending SIGSTOP, get rid of it. */ -+#ifndef __GENODE__ - if (lwp->stop_expected) - { - if (debug_threads) -@@ -1524,7 +1550,9 @@ linux_detach_one_lwp (struct lwp_info *lwp) - kill_lwp (lwpid_of (thread), SIGCONT); - lwp->stop_expected = 0; - } -+#endif - -+#ifndef __GENODE__ - /* Pass on any pending signal for this thread. */ - sig = get_detach_signal (thread); - -@@ -1587,6 +1615,7 @@ linux_detach_one_lwp (struct lwp_info *lwp) - target_pid_to_str (ptid_of (thread)), - strsignal (sig)); - } -+#endif - - delete_lwp (lwp); - } -@@ -1874,6 +1903,7 @@ iterate_over_lwps (ptid_t filter, - static void - check_zombie_leaders (void) - { -+#ifndef __GENODE__ - for_each_process ([] (process_info *proc) { - pid_t leader_pid = pid_of (proc); - struct lwp_info *leader_lp; -@@ -1928,6 +1958,7 @@ check_zombie_leaders (void) - delete_lwp (leader_lp); - } - }); -+#endif /* __GENODE__ */ - } - - /* Callback for `find_thread'. Returns the first LWP that is not -@@ -2730,11 +2761,13 @@ linux_wait_for_event_filtered (ptid_t wait_ptid, ptid_t filter_ptid, - - if (ret > 0) - { -+#ifndef __GENODE__ - if (debug_threads) - { - debug_printf ("LLW: waitpid %ld received %s\n", - (long) ret, status_to_str (*wstatp)); - } -+#endif /* __GENODE__ */ - - /* Filter all events. IOW, leave all events pending. We'll - randomly select an event LWP out of all that have events -@@ -3036,11 +3069,12 @@ linux_stabilize_threads (void) - static ptid_t - ignore_event (struct target_waitstatus *ourstatus) - { -+#ifndef __GENODE__ - /* If we got an event, there may still be others, as a single - SIGCHLD can indicate more than one child stopped. This forces - another target_wait call. */ - async_file_mark (); -- -+#endif /* __GENODE__ */ - ourstatus->kind = TARGET_WAITKIND_IGNORE; - return null_ptid; - } -@@ -3877,9 +3911,11 @@ linux_wait (ptid_t ptid, - { - ptid_t event_ptid; - -+#ifndef __GENODE__ - /* Flush the async file first. */ - if (target_is_async_p ()) - async_file_flush (); -+#endif - - do - { -@@ -3889,12 +3925,14 @@ linux_wait (ptid_t ptid, - && event_ptid == null_ptid - && ourstatus->kind == TARGET_WAITKIND_IGNORE); - -+#ifndef __GENODE__ - /* If at least one stop was reported, there may be more. A single - SIGCHLD can signal more than one child stop. */ - if (target_is_async_p () - && (target_options & TARGET_WNOHANG) != 0 - && event_ptid != null_ptid) - async_file_mark (); -+#endif - - return event_ptid; - } -@@ -3904,6 +3942,9 @@ linux_wait (ptid_t ptid, - static int - kill_lwp (unsigned long lwpid, int signo) - { -+#ifdef __GENODE__ -+ return kill (lwpid, signo); -+#else - int ret; - - errno = 0; -@@ -3915,6 +3956,7 @@ kill_lwp (unsigned long lwpid, int signo) - perror_with_name (("tkill")); - } - return ret; -+#endif - } - - void -@@ -4447,6 +4489,21 @@ linux_resume_one_lwp_throw (struct lwp_info *lwp, - regcache_invalidate_thread (thread); - errno = 0; - lwp->stepping = step; -+ -+#ifdef __GENODE__ -+ -+ /* -+ * On Linux, the thread would get stopped immediately after resuming -+ * if a SIGSTOP is pending. This is not the case on Genode, so we -+ * just keep the thread stopped. -+ */ -+ if (lwp->stop_expected) -+ return; -+ -+ genode_continue_thread(lwpid_of(thread), step); -+ -+#else -+ - if (step) - ptrace_request = PTRACE_SINGLESTEP; - else if (gdb_catching_syscalls_p (lwp)) -@@ -4459,6 +4516,7 @@ linux_resume_one_lwp_throw (struct lwp_info *lwp, - /* Coerce to a uintptr_t first to avoid potential gcc warning - of coercing an 8 byte integer to a 4 byte pointer. */ - (PTRACE_TYPE_ARG4) (uintptr_t) signal); -+#endif - - current_thread = saved_thread; - if (errno) -@@ -4496,7 +4554,7 @@ check_ptrace_stopped_lwp_gone (struct lwp_info *lp) - (observed in Linux 3.18). See also the note on ESRCH in the - ptrace(2) man page. Instead, check whether the LWP has any state - other than ptrace-stopped. */ -- -+#ifndef __GENODE__ - /* Don't assume anything if /proc/PID/status can't be read. */ - if (linux_proc_pid_is_trace_stopped_nowarn (lwpid_of (thread)) == 0) - { -@@ -4504,6 +4562,7 @@ check_ptrace_stopped_lwp_gone (struct lwp_info *lp) - lp->status_pending_p = 0; - return 1; - } -+#endif /* __GENODE__ */ - return 0; - } - -@@ -5374,6 +5433,7 @@ regsets_fetch_inferior_registers (struct regsets_info *regsets_info, - this process mode. */ - disable_regset (regsets_info, regset); - } -+#ifndef __GENODE__ - else if (errno == ENODATA) - { - /* ENODATA may be returned if the regset is currently -@@ -5386,6 +5446,7 @@ regsets_fetch_inferior_registers (struct regsets_info *regsets_info, - already gone, in which case we simply ignore attempts - to read its registers. */ - } -+#endif - else - { - char s[256]; -@@ -6566,6 +6627,13 @@ linux_read_loadmap (const char *annex, CORE_ADDR offset, - static void - linux_process_qsupported (char **features, int count) - { -+#ifdef __GENODE__ -+ /* -+ * 'qSupported' is the first command sent by GDB when attaching to the -+ * server, so when at this location, GDB has just (re-)attached itself. -+ */ -+ genode_stop_all_threads(); -+#endif - if (the_low_target.process_qsupported != NULL) - the_low_target.process_qsupported (features, count); - } -@@ -6691,6 +6759,7 @@ linux_get_min_fast_tracepoint_insn_len (void) - return (*the_low_target.get_min_fast_tracepoint_insn_len) (); - } - -+#ifndef __GENODE__ - /* Extract &phdr and num_phdr in the inferior. Return 0 on success. */ - - static int -@@ -7176,6 +7245,7 @@ linux_qxfer_libraries_svr4 (const char *annex, unsigned char *readbuf, - - return len; - } -+#endif /* __GENODE__ */ - - #ifdef HAVE_LINUX_BTRACE - -@@ -7436,25 +7506,52 @@ static struct target_ops linux_target_ops = { - linux_create_inferior, - linux_post_create_inferior, - linux_attach, -+#ifndef __GENODE__ - linux_kill, - linux_detach, - linux_mourn, - linux_join, -+#else -+ genode_kill, -+ genode_detach, -+ NULL, -+ NULL, -+#endif - linux_thread_alive, - linux_resume, - linux_wait, -+#ifndef __GENODE__ - linux_fetch_registers, - linux_store_registers, -+#else -+ genode_fetch_registers, -+ genode_store_registers, -+#endif - linux_prepare_to_access_memory, - linux_done_accessing_memory, -+#ifndef __GENODE__ - linux_read_memory, - linux_write_memory, -+#else -+ genode_read_memory, -+ genode_write_memory, -+#endif -+#ifndef __GENODE__ - linux_look_up_symbols, -+#else -+ NULL, -+#endif - linux_request_interrupt, -+#ifndef __GENODE__ - linux_read_auxv, - linux_supports_z_point_type, -+#else -+ NULL, -+ NULL, -+#endif - linux_insert_point, - linux_remove_point, -+#ifndef __GENODE__ - linux_stopped_by_sw_breakpoint, - linux_supports_stopped_by_sw_breakpoint, - linux_stopped_by_hw_breakpoint, -@@ -7462,6 +7559,15 @@ static struct target_ops linux_target_ops = { - linux_supports_hardware_single_step, - linux_stopped_by_watchpoint, - linux_stopped_data_address, -+#else -+ NULL, -+ NULL, -+ NULL, -+ NULL, -+ NULL, -+ NULL, -+ NULL, -+#endif - #if defined(__UCLIBC__) && defined(HAS_NOMMU) \ - && defined(PT_TEXT_ADDR) && defined(PT_DATA_ADDR) \ - && defined(PT_TEXT_END_ADDR) -@@ -7474,6 +7580,7 @@ static struct target_ops linux_target_ops = { - #else - NULL, - #endif -+#ifndef __GENODE__ - linux_qxfer_spu, - hostio_last_error_from_errno, - linux_qxfer_osdata, -@@ -7486,14 +7593,34 @@ static struct target_ops linux_target_ops = { - linux_supports_vfork_events, - linux_supports_exec_events, - linux_handle_new_gdb_connection, -+#else -+ NULL, -+ NULL, -+ NULL, -+ NULL, -+ NULL, -+ NULL, -+ NULL, -+ NULL, -+ NULL, -+ NULL, -+ NULL, -+ NULL, -+#endif - #ifdef USE_THREAD_DB - thread_db_handle_monitor_command, - #else - NULL, - #endif -+#ifndef __GENODE__ - linux_common_core_of_thread, - linux_read_loadmap, -+#else -+ NULL, -+ NULL, -+#endif - linux_process_qsupported, -+#ifndef __GENODE__ - linux_supports_tracepoints, - linux_read_pc, - linux_write_pc, -@@ -7525,7 +7652,34 @@ static struct target_ops linux_target_ops = { - linux_mntns_unlink, - linux_mntns_readlink, - linux_breakpoint_kind_from_pc, -+#else -+ NULL, -+ NULL, -+ NULL, -+ NULL, -+ NULL, -+ NULL, -+ NULL, -+ NULL, -+ NULL, -+ NULL, -+ NULL, -+ NULL, -+ NULL, -+ NULL, -+ NULL, -+ NULL, -+ NULL, -+ NULL, -+ NULL, -+ NULL, -+ NULL, -+ NULL, -+ NULL, -+ NULL, -+#endif - linux_sw_breakpoint_from_kind, -+#ifndef __GENODE__ - linux_proc_tid_get_name, - linux_breakpoint_kind_from_current_state, - linux_supports_software_single_step, -@@ -7536,6 +7690,14 @@ static struct target_ops linux_target_ops = { - #else - NULL, - #endif -+#else -+ NULL, -+ NULL, -+ NULL, -+ NULL, -+ NULL, -+ NULL -+#endif /* __GENODE__ */ - }; - - #ifdef HAVE_LINUX_REGSETS -@@ -7557,8 +7719,10 @@ initialize_low (void) - memset (&sigchld_action, 0, sizeof (sigchld_action)); - set_target_ops (&linux_target_ops); - -+#ifndef __GENODE__ - linux_ptrace_init_warnings (); - linux_proc_init_warnings (); -+#endif - - sigchld_action.sa_handler = sigchld_handler; - sigemptyset (&sigchld_action.sa_mask); -diff --git a/gdb/gdbserver/linux-low.h b/gdb/gdbserver/linux-low.h -index 79b3311..0b7f4ed 100644 ---- a/gdb/gdbserver/linux-low.h -+++ b/gdb/gdbserver/linux-low.h -@@ -17,11 +17,16 @@ - along with this program. If not, see . */ - - #include "nat/linux-nat.h" -+#ifndef __GENODE__ - #include "nat/gdb_thread_db.h" -+#endif - #include - - #include "gdbthread.h" -+ -+#ifndef __GENODE__ - #include "gdb_proc_service.h" -+#endif - - /* Included for ptrace type definitions. */ - #include "nat/linux-ptrace.h" -diff --git a/gdb/gdbserver/linux-x86-low.c b/gdb/gdbserver/linux-x86-low.c -index 80b4380..b8984c9 100644 ---- a/gdb/gdbserver/linux-x86-low.c -+++ b/gdb/gdbserver/linux-x86-low.c -@@ -31,7 +31,9 @@ - #include "nat/amd64-linux-siginfo.h" - #endif - -+#ifndef __GENODE__ - #include "gdb_proc_service.h" -+#endif - /* Don't include elf/common.h if linux/elf.h got included by - gdb_proc_service.h. */ - #ifndef ELFMAG0 -@@ -52,11 +54,23 @@ static struct target_desc *tdesc_amd64_linux_no_xml; - #endif - static struct target_desc *tdesc_i386_linux_no_xml; - -- - static unsigned char jump_insn[] = { 0xe9, 0, 0, 0, 0 }; - static unsigned char small_jump_insn[] = { 0x66, 0xe9, 0, 0 }; - - /* Backward compatibility for gdb without XML support. */ -+#ifdef __GENODE__ -+ -+static const char *xmltarget_i386_linux_no_xml = "@\ -+i386\ -+"; -+ -+#ifdef __x86_64__ -+static const char *xmltarget_amd64_linux_no_xml = "@\ -+i386:x86-64\ -+"; -+#endif -+ -+#else - - static const char *xmltarget_i386_linux_no_xml = "@\ - i386\ -@@ -70,7 +84,17 @@ static const char *xmltarget_amd64_linux_no_xml = "@\ - "; - #endif - -+#endif /* __GENODE__ */ -+ -+#ifdef __GENODE__ -+#ifdef __x86_64__ -+#include "amd64.h" -+#else -+#include "i386.h" -+#endif /* __x86_64__ */ -+#else - #include -+#endif - #include - #include "nat/gdb_ptrace.h" - #include -@@ -119,7 +143,11 @@ static /*const*/ int i386_regmap[] = - #define ORIG_EAX ORIG_RAX - #define REGSIZE 8 - --static const int x86_64_regmap[] = -+static -+#ifndef __GENODE__ -+const -+#endif -+int x86_64_regmap[] = - { - RAX * 8, RBX * 8, RCX * 8, RDX * 8, - RSI * 8, RDI * 8, RBP * 8, RSP * 8, -@@ -132,6 +160,7 @@ static const int x86_64_regmap[] = - -1, -1, -1, -1, -1, -1, -1, -1, - -1, - -1, -1, -1, -1, -1, -1, -1, -1, -+#ifndef __GENODE__ - ORIG_RAX * 8, - #ifdef HAVE_STRUCT_USER_REGS_STRUCT_FS_BASE - 21 * 8, 22 * 8, -@@ -150,6 +179,7 @@ static const int x86_64_regmap[] = - -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, - -1 /* pkru */ -+#endif - }; - - #define X86_64_NUM_REGS (sizeof (x86_64_regmap) / sizeof (x86_64_regmap[0])) -@@ -191,6 +221,7 @@ is_64bit_tdesc (void) - - /* Called by libthread_db. */ - -+#ifndef __GENODE__ - ps_err_e - ps_get_thread_area (struct ps_prochandle *ph, - lwpid_t lwpid, int idx, void **base) -@@ -229,6 +260,7 @@ ps_get_thread_area (struct ps_prochandle *ph, - return PS_OK; - } - } -+#endif - - /* Get the thread area address. This is used to recognize which - thread is which when tracing with the in-process agent library. We -@@ -284,7 +316,11 @@ x86_cannot_store_register (int regno) - { - #ifdef __x86_64__ - if (is_64bit_tdesc ()) -+#ifdef __GENODE__ -+ return regno >= X86_64_NUM_REGS; -+#else - return 0; -+#endif /* GENODE */ - #endif - - return regno >= I386_NUM_REGS; -@@ -295,12 +331,30 @@ x86_cannot_fetch_register (int regno) - { - #ifdef __x86_64__ - if (is_64bit_tdesc ()) -+#ifdef __GENODE__ -+ return regno >= X86_64_NUM_REGS; -+#else - return 0; -+#endif /* GENODE */ - #endif - - return regno >= I386_NUM_REGS; - } - -+#ifdef __x86_64__ -+static int -+x86_64_cannot_store_register (int regno) -+{ -+ return regno >= X86_64_NUM_REGS; -+} -+ -+static int -+x86_64_cannot_fetch_register (int regno) -+{ -+ return regno >= X86_64_NUM_REGS; -+} -+#endif /* __x86_64__ */ -+ - static void - x86_fill_gregset (struct regcache *regcache, void *buf) - { -@@ -337,8 +391,10 @@ x86_fill_gregset (struct regcache *regcache, void *buf) - for (i = 0; i < I386_NUM_REGS; i++) - collect_register (regcache, i, ((char *) buf) + i386_regmap[i]); - -+#ifndef __GENODE__ - collect_register_by_name (regcache, "orig_eax", - ((char *) buf) + ORIG_EAX * REGSIZE); -+#endif - } - - static void -@@ -372,8 +428,10 @@ x86_store_gregset (struct regcache *regcache, const void *buf) - for (i = 0; i < I386_NUM_REGS; i++) - supply_register (regcache, i, ((char *) buf) + i386_regmap[i]); - -+#ifndef __GENODE__ - supply_register_by_name (regcache, "orig_eax", - ((char *) buf) + ORIG_EAX * REGSIZE); -+#endif - } - - static void -@@ -493,7 +551,15 @@ x86_set_pc (struct regcache *regcache, CORE_ADDR pc) - } - } - -+#ifdef __GENODE__ -+/* The 'INT3' instruction is used by some kernel debuggers and thus cannot -+ * serve as breakpoint instruction for the GDB monitor. Instead, the 'HLT' -+ * instruction gets used. It's a privileged instruction which triggers an -+ * exception when executed in user mode */ -+static const gdb_byte x86_breakpoint[] = { 0xF4 }; -+#else - static const gdb_byte x86_breakpoint[] = { 0xCC }; -+#endif - #define x86_breakpoint_len 1 - - static int -@@ -502,7 +568,7 @@ x86_breakpoint_at (CORE_ADDR pc) - unsigned char c; - - (*the_target->read_memory) (pc, &c, 1); -- if (c == 0xCC) -+ if (c == x86_breakpoint[0]) - return 1; - - return 0; -@@ -669,6 +735,7 @@ x86_debug_reg_state (pid_t pid) - as debugging it with a 32-bit GDBSERVER, we do the 32-bit <-> 64-bit - conversion in-place ourselves. */ - -+#ifndef __GENODE__ - /* Convert a ptrace/host siginfo object, into/from the siginfo in the - layout of the inferiors' architecture. Returns true if any - conversion was done; false otherwise. If DIRECTION is 1, then copy -@@ -695,6 +762,7 @@ x86_siginfo_fixup (siginfo_t *ptrace, gdb_byte *inf, int direction) - - return 0; - } -+#endif - - static int use_xml; - -@@ -735,6 +803,13 @@ int have_ptrace_getfpxregs = - static const struct target_desc * - x86_linux_read_description (void) - { -+#ifdef __GENODE__ -+#ifdef __x86_64__ -+ return amd64_linux_read_description(X86_XSTATE_SSE_MASK, false); -+#else -+ return i386_linux_read_description(X86_XSTATE_SSE); -+#endif -+#else - unsigned int machine; - int is_elf64; - int xcr0_features; -@@ -850,7 +925,7 @@ x86_linux_read_description (void) - - return tdesc; - } -- -+#endif /* __GENODE__ */ - gdb_assert_not_reached ("failed to return tdesc"); - } - -@@ -925,13 +1000,24 @@ static struct regsets_info x86_regsets_info = - }; - - #ifdef __x86_64__ -+static struct usrregs_info amd64_linux_usrregs_info = -+ { -+ X86_64_NUM_REGS, -+ x86_64_regmap, -+ }; -+ - static struct regs_info amd64_linux_regs_info = - { - NULL, /* regset_bitmap */ -+#ifdef __GENODE__ -+ &amd64_linux_usrregs_info, -+#else - NULL, /* usrregs_info */ -+#endif - &x86_regsets_info - }; - #endif -+ - static struct usrregs_info i386_linux_usrregs_info = - { - I386_NUM_REGS, -@@ -2852,12 +2938,20 @@ struct linux_target_ops the_low_target = - NULL, /* breakpoint_kind_from_pc */ - x86_sw_breakpoint_from_kind, - NULL, -+#ifndef __GENODE__ - 1, -+#else -+ 0, /* With the HLT instruction, the PC does not get incremented */ -+#endif - x86_breakpoint_at, - x86_supports_z_point_type, - x86_insert_point, - x86_remove_point, -+#ifndef __GENODE__ - x86_stopped_by_watchpoint, -+#else -+ NULL, -+#endif - x86_stopped_data_address, - /* collect_ptrace_register/supply_ptrace_register are not needed in the - native i386 case (no registers smaller than an xfer unit), and are not -@@ -2865,13 +2959,22 @@ struct linux_target_ops the_low_target = - NULL, - NULL, - /* need to fix up i386 siginfo if host is amd64 */ -+#ifdef __GENODE__ -+ NULL, -+#else - x86_siginfo_fixup, -+#endif - x86_linux_new_process, - x86_linux_delete_process, - x86_linux_new_thread, - x86_linux_delete_thread, -+#ifndef __GENODE__ - x86_linux_new_fork, - x86_linux_prepare_to_resume, -+#else -+ NULL, -+ NULL, -+#endif - x86_linux_process_qsupported, - x86_supports_tracepoints, - x86_get_thread_area, -diff --git a/gdb/gdbserver/linux-x86-tdesc-selftest.c b/gdb/gdbserver/linux-x86-tdesc-selftest.c -index e840b77..c7d1e34 100644 ---- a/gdb/gdbserver/linux-x86-tdesc-selftest.c -+++ b/gdb/gdbserver/linux-x86-tdesc-selftest.c -@@ -21,6 +21,17 @@ - #include "common/selftest.h" - #include "x86-xstate.h" - -+#ifdef __GENODE__ -+/* Defined in auto-generated file i386.c. */ -+void init_registers_i386 (void); -+static inline void init_registers_i386_linux(void) { init_registers_i386(); } -+extern const struct target_desc *tdesc_i386_linux; -+ -+void init_registers_i386_avx (void); -+static inline void init_registers_i386_avx_linux(void) { init_registers_i386_avx(); } -+extern const struct target_desc *tdesc_i386_avx_linux; -+#else -+ - /* Defined in auto-generated file i386-linux.c. */ - void init_registers_i386_linux (void); - extern const struct target_desc *tdesc_i386_linux; -@@ -48,9 +59,20 @@ extern const struct target_desc *tdesc_i386_avx_mpx_avx512_pku_linux; - /* Defined in auto-generated file i386-mpx-linux.c. */ - void init_registers_i386_mpx_linux (void); - extern const struct target_desc *tdesc_i386_mpx_linux; -+#endif /* __GENODE__ */ - - #ifdef __x86_64__ - -+#ifdef __GENODE__ -+void init_registers_amd64 (void); -+static inline void init_registers_amd64_linux(void) { init_registers_amd64(); } -+extern const struct target_desc *tdesc_amd64_linux; -+ -+void init_registers_amd64_avx (void); -+static inline void init_registers_amd64_avx_linux(void) { init_registers_amd64_avx(); } -+extern const struct target_desc *tdesc_amd64_avx_linux; -+#else -+ - /* Defined in auto-generated file amd64-linux.c. */ - void init_registers_amd64_linux (void); - extern const struct target_desc *tdesc_amd64_linux; -@@ -87,6 +109,7 @@ extern const struct target_desc *tdesc_x32_avx_linux; - void init_registers_x32_avx_avx512_linux (void); - extern const struct target_desc *tdesc_x32_avx_avx512_linux; - -+#endif /* __GENODE__ */ - #endif - - namespace selftests { -@@ -157,27 +180,35 @@ void - initialize_low_tdesc () - { - init_registers_i386_linux (); -+#ifndef __GENODE__ - init_registers_i386_mmx_linux (); -+#endif /* __GENODE__ */ - init_registers_i386_avx_linux (); -+#ifndef __GENODE - init_registers_i386_mpx_linux (); - init_registers_i386_avx_mpx_linux (); - init_registers_i386_avx_avx512_linux (); - init_registers_i386_avx_mpx_avx512_pku_linux (); - - selftests::register_test ("i386-tdesc", selftests::tdesc::i386_tdesc_test); -+#endif /* __GENODE__ */ - - #ifdef __x86_64__ -+#ifndef __GENODE__ - init_registers_x32_linux (); - init_registers_x32_avx_linux (); - init_registers_x32_avx_avx512_linux (); -+#endif /* __GENODE__ */ - - init_registers_amd64_linux (); - init_registers_amd64_avx_linux (); -+#ifndef __GENODE__ - init_registers_amd64_mpx_linux (); - init_registers_amd64_avx_mpx_linux (); - init_registers_amd64_avx_avx512_linux (); - init_registers_amd64_avx_mpx_avx512_pku_linux (); - - selftests::register_test ("amd64-tdesc", selftests::tdesc::amd64_tdesc_test); -+#endif /* __GENODE__ */ - #endif - } -diff --git a/gdb/gdbserver/linux-x86-tdesc.c b/gdb/gdbserver/linux-x86-tdesc.c -index c3aa20c..e5a57c0 100644 ---- a/gdb/gdbserver/linux-x86-tdesc.c -+++ b/gdb/gdbserver/linux-x86-tdesc.c -@@ -87,7 +87,11 @@ i386_linux_read_description (uint64_t xcr0) - - if (*tdesc == NULL) - { -+#ifdef __GENODE__ -+ *tdesc = i386_create_target_description (xcr0, false); -+#else - *tdesc = i386_create_target_description (xcr0, true); -+#endif /* __GENODE__ */ - - init_target_desc (*tdesc, i386_expedite_regs); - } -@@ -118,7 +122,11 @@ amd64_linux_read_description (uint64_t xcr0, bool is_x32) - - if (*tdesc == NULL) - { -+#ifdef __GENODE__ -+ *tdesc = amd64_create_target_description (xcr0, is_x32, false, false); -+#else - *tdesc = amd64_create_target_description (xcr0, is_x32, true, true); -+#endif /* __GENODE__ */ - - init_target_desc (*tdesc, amd64_expedite_regs); - } -diff --git a/gdb/gdbserver/remote-utils.c b/gdb/gdbserver/remote-utils.c -index 45d5c8d..b246402 100644 ---- a/gdb/gdbserver/remote-utils.c -+++ b/gdb/gdbserver/remote-utils.c -@@ -27,6 +27,12 @@ - #include "rsp-low.h" - #include "gdbthread.h" - #include -+ -+#ifdef __GENODE__ -+#include -+#include "genode-low.h" -+#endif -+ - #if HAVE_SYS_IOCTL_H - #include - #endif -@@ -108,7 +114,10 @@ struct ui_file *gdb_stdlog; - - static int remote_is_stdio = 0; - --static gdb_fildes_t remote_desc = INVALID_DESCRIPTOR; -+#ifndef __GENODE__ -+static -+#endif -+gdb_fildes_t remote_desc = INVALID_DESCRIPTOR; - static gdb_fildes_t listen_desc = INVALID_DESCRIPTOR; - - /* FIXME headerize? */ -@@ -312,7 +321,11 @@ remote_open (const char *name) - struct stat statbuf; - - if (stat (name, &statbuf) == 0 -+#ifndef __GENODE__ - && (S_ISCHR (statbuf.st_mode) || S_ISFIFO (statbuf.st_mode))) -+#else -+ ) -+#endif - remote_desc = open (name, O_RDWR); - else - { -diff --git a/gdb/gdbserver/server.c b/gdb/gdbserver/server.c -index bf6302b..b6a9494 100644 ---- a/gdb/gdbserver/server.c -+++ b/gdb/gdbserver/server.c -@@ -28,6 +28,14 @@ - #if HAVE_SIGNAL_H - #include - #endif -+ -+#ifdef __GENODE__ -+#include "genode-low.h" -+#include "linux-low.h" -+/* don't have the generated header with the declaration */ -+extern "C" char *strchrnul(const char *s, int c_in); -+#endif -+ - #include "gdb_vecs.h" - #include "gdb_wait.h" - #include "btrace-common.h" -@@ -70,7 +78,11 @@ static gdb_environ our_environ; - - /* We always try to start the inferior using a shell. */ - -+#ifdef __GENODE__ -+int startup_with_shell = 0; -+#else - int startup_with_shell = 1; -+#endif - - int server_waiting; - -@@ -1282,7 +1294,9 @@ handle_detach (char *own_buf) - need to hang around doing nothing, until the child is - gone. */ - join_inferior (process->pid); -+#ifndef __GENODE__ - exit (0); -+#endif /* __GENODE__ */ - } - } - } -@@ -3141,11 +3155,11 @@ handle_v_requests (char *own_buf, int packet_len, int *new_packet_len) - return; - } - } -- -+#ifndef __GENODE__ - if (startswith (own_buf, "vFile:") - && handle_vFile (own_buf, packet_len, new_packet_len)) - return; -- -+#endif - if (startswith (own_buf, "vAttach;")) - { - if ((!extended_protocol || !cs.multi_process) && target_running ()) -@@ -3737,7 +3751,9 @@ captured_main (int argc, char *argv[]) - opened by remote_prepare. */ - notice_open_fds (); - -+#ifndef __GENODE__ - save_original_signals_state (false); -+#endif /* __GENODE__ */ - - /* We need to know whether the remote connection is stdio before - starting the inferior. Inferiors created in this scenario have -@@ -3942,7 +3958,11 @@ captured_main (int argc, char *argv[]) - /* Main function. */ - - int -+#ifdef __GENODE__ -+gdbserver_main (int argc, char *argv[]) -+#else - main (int argc, char *argv[]) -+#endif - { - - TRY -@@ -4045,6 +4065,10 @@ process_serial_event (void) - } - response_needed = 1; - -+#ifdef __GENODE__ -+ if (debug_threads) printf("GDB command = %s\n", cs.own_buf); -+#endif -+ - char ch = cs.own_buf[0]; - switch (ch) - { -@@ -4290,7 +4314,11 @@ process_serial_event (void) - return 0; - } - else -+#ifndef __GENODE__ - exit (0); -+#else -+ return 0; -+#endif - - case 'T': - { -@@ -4365,7 +4393,9 @@ process_serial_event (void) - cs.own_buf[0] = '\0'; - break; - } -- -+#ifdef __GENODE__ -+ if (debug_threads) printf("GDBserver response = %s\n", cs.own_buf); -+#endif - if (new_packet_len != -1) - putpkt_binary (cs.own_buf, new_packet_len); - else -diff --git a/gdb/gdbserver/server.h b/gdb/gdbserver/server.h -index 5e41e2f..fcffe77 100644 ---- a/gdb/gdbserver/server.h -+++ b/gdb/gdbserver/server.h -@@ -60,7 +60,11 @@ int vsnprintf(char *str, size_t size, const char *format, va_list ap); - #include "gdb_signals.h" - #include "target.h" - #include "mem-break.h" -+#ifdef __GENODE__ -+#include "common/environ.h" -+#else - #include "environ.h" -+#endif /* __GENODE__ */ - - /* Target-specific functions */ - -diff --git a/gdb/nat/fork-inferior.c b/gdb/nat/fork-inferior.c -index ea71aad..9b789e7 100644 ---- a/gdb/nat/fork-inferior.c -+++ b/gdb/nat/fork-inferior.c -@@ -420,9 +420,9 @@ fork_inferior (const char *exec_file_arg, const std::string &allargs, - undebuggable. Indeed, you probably got an error message - saying "not parent". Sorry; you'll have to use print - statements! */ -- -+#ifndef __GENODE__ - restore_original_signals_state (); -- -+#endif /* __GENODE__ */ - /* There is no execlpe call, so we have to set the environment - for our child in the global variable. If we've vforked, this - clobbers the parent, but environ is restored a few lines down -diff --git a/gdb/nat/gdb_ptrace.h b/gdb/nat/gdb_ptrace.h -index bdd7621..45caf22 100644 ---- a/gdb/nat/gdb_ptrace.h -+++ b/gdb/nat/gdb_ptrace.h -@@ -129,6 +129,7 @@ - extern PTRACE_TYPE_RET ptrace(); - #endif - -+#ifndef __GENODE__ - /* Some systems, at least AIX and HP-UX have a ptrace with five - arguments. Since we never use the fifth argument, define a ptrace - macro that calls the real ptrace with the last argument set to -@@ -149,5 +150,6 @@ extern PTRACE_TYPE_RET ptrace(); - # define ptrace(request, pid, addr, data) \ - ptrace ((PTRACE_TYPE_ARG1) request, pid, addr, data) - #endif -+#endif /* __GENODE__ */ - - #endif /* gdb_ptrace.h */ -diff --git a/gdb/nat/linux-ptrace.c b/gdb/nat/linux-ptrace.c -index 1f21ef0..4538dc0 100644 ---- a/gdb/nat/linux-ptrace.c -+++ b/gdb/nat/linux-ptrace.c -@@ -36,6 +36,7 @@ static int supported_ptrace_options = -1; - std::string - linux_ptrace_attach_fail_reason (pid_t pid) - { -+#ifndef __GENODE__ - pid_t tracerpid = linux_proc_get_tracerpid_nowarn (pid); - std::string result; - -@@ -51,6 +52,7 @@ linux_ptrace_attach_fail_reason (pid_t pid) - (int) pid); - - return result; -+#endif - } - - /* See linux-ptrace.h. */ -@@ -73,12 +75,16 @@ linux_ptrace_attach_fail_reason_string (ptid_t ptid, int err) - /* Address of the 'ret' instruction in asm code block below. */ - EXTERN_C void linux_ptrace_test_ret_to_nx_instr (void); - -+#ifndef __GENODE__ - #include -+#endif - #include - #include -- -+#else -+#include - #endif /* defined __i386__ || defined __x86_64__ */ - -+#ifndef __GENODE__ - /* Test broken off-trunk Linux kernel patchset for NX support on i386. It was - removed in Fedora kernel 88fa1f0332d188795ed73d7ac2b1564e11a0b4cd. - -@@ -240,6 +246,7 @@ linux_ptrace_test_ret_to_nx (void) - "support detected!")); - #endif /* defined __i386__ || defined __x86_64__ */ - } -+#endif /* __GENODE__ */ - - /* Helper function to fork a process and make the child process call - the function FUNCTION, passing CHILD_STACK as parameter. -@@ -325,6 +332,7 @@ static void linux_test_for_exitkill (int child_pid); - void - linux_check_ptrace_features (void) - { -+#ifndef __GENODE__ - int child_pid, ret, status; - - /* Initialize the options. */ -@@ -362,6 +370,7 @@ linux_check_ptrace_features (void) - my_waitpid (child_pid, &status, 0); - } - while (WIFSTOPPED (status)); -+#endif - } - - /* Determine if PTRACE_O_TRACESYSGOOD can be used to catch -@@ -479,6 +488,7 @@ linux_test_for_exitkill (int child_pid) - void - linux_enable_event_reporting (pid_t pid, int options) - { -+#ifndef __GENODE__ - /* Check if we have initialized the ptrace features for this - target. If not, do it now. */ - if (supported_ptrace_options == -1) -@@ -493,6 +503,7 @@ linux_enable_event_reporting (pid_t pid, int options) - /* Set the options. */ - ptrace (PTRACE_SETOPTIONS, pid, (PTRACE_TYPE_ARG3) 0, - (PTRACE_TYPE_ARG4) (uintptr_t) options); -+#endif /* __GENODE__ */ - } - - /* Disable reporting of all currently supported ptrace events. */ -@@ -500,8 +511,10 @@ linux_enable_event_reporting (pid_t pid, int options) - void - linux_disable_event_reporting (pid_t pid) - { -+#ifndef __GENODE__ - /* Set the options. */ - ptrace (PTRACE_SETOPTIONS, pid, (PTRACE_TYPE_ARG3) 0, 0); -+#endif /* __GENODE__ */ - } - - /* Returns non-zero if PTRACE_OPTIONS is contained within -@@ -580,7 +593,9 @@ linux_ptrace_init_warnings (void) - return; - warned = 1; - -+#ifndef __GENODE__ - linux_ptrace_test_ret_to_nx (); -+#endif - } - - /* Extract extended ptrace event from wait status. */ -diff --git a/gdb/nat/linux-ptrace.h b/gdb/nat/linux-ptrace.h -index 98b44a8..178310e 100644 ---- a/gdb/nat/linux-ptrace.h -+++ b/gdb/nat/linux-ptrace.h -@@ -115,7 +115,11 @@ struct buffer; - way to go. That said, some architecture may get the si_code wrong, - and as such we're leaving fallback code in place. We'll remove - this after a while if no problem is reported. */ -+#ifdef __GENODE__ -+#define USE_SIGTRAP_SIGINFO 0 -+#else - #define USE_SIGTRAP_SIGINFO 1 -+#endif - - /* The x86 kernel gets some of the si_code values backwards, like - this: + return make_unique_xstrdup (filename); diff --git a/repos/ports/src/noux-pkg/gdb/patches/noux_build.patch b/repos/ports/src/noux-pkg/gdb/patches/noux_build.patch index 20d8498d8d..f70f8904ab 100644 --- a/repos/ports/src/noux-pkg/gdb/patches/noux_build.patch +++ b/repos/ports/src/noux-pkg/gdb/patches/noux_build.patch @@ -5,15 +5,16 @@ From: Christian Prochaska --- gdb/configure | 10 +++++----- - gdb/dwarf-index-write.c | 2 +- + gdb/dwarf2/index-write.c | 2 +- + gnulib/config.in | 2 ++ sim/common/Make-common.in | 2 +- - 3 files changed, 7 insertions(+), 7 deletions(-) + 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/gdb/configure b/gdb/configure -index 28756ed..a3d6fc2 100755 +index 03464ae5..6f705fc7 100755 --- a/gdb/configure +++ b/gdb/configure -@@ -6608,11 +6608,11 @@ fi +@@ -6699,11 +6699,11 @@ fi # configuration. gdb_host_obs=posix-hdep.o @@ -29,7 +30,7 @@ index 28756ed..a3d6fc2 100755 . $srcdir/configure.host -@@ -13785,7 +13785,7 @@ sigjmp_buf env; while (! sigsetjmp (env, 1)) siglongjmp (env, 1); +@@ -14353,7 +14353,7 @@ sigjmp_buf env; while (! sigsetjmp (env, 1)) siglongjmp (env, 1); return 0; } _ACEOF @@ -38,11 +39,11 @@ index 28756ed..a3d6fc2 100755 gdb_cv_func_sigsetjmp=yes else gdb_cv_func_sigsetjmp=no -diff --git a/gdb/dwarf-index-write.c b/gdb/dwarf-index-write.c -index d283146..55bef80 100644 ---- a/gdb/dwarf-index-write.c -+++ b/gdb/dwarf-index-write.c -@@ -705,7 +705,7 @@ public: +diff --git a/gdb/dwarf2/index-write.c b/gdb/dwarf2/index-write.c +index 0079c0fe..376a9151 100644 +--- a/gdb/dwarf2/index-write.c ++++ b/gdb/dwarf2/index-write.c +@@ -777,7 +777,7 @@ class debug_names gdb_assert (m_abbrev_table.empty ()); const size_t name_count = m_name_to_value_set.size (); m_bucket_table.resize @@ -51,8 +52,28 @@ index d283146..55bef80 100644 m_hash_table.reserve (name_count); m_name_table_string_offs.reserve (name_count); m_name_table_entry_offs.reserve (name_count); +diff --git a/gnulib/config.in b/gnulib/config.in +index d8a5e8be..cc1cc9fc 100644 +--- a/gnulib/config.in ++++ b/gnulib/config.in +@@ -1192,6 +1192,7 @@ + /* Define to 1 to make NetBSD features available. MINIX 3 needs this. */ + #undef _NETBSD_SOURCE + ++#if 0 + /* The _Noreturn keyword of C11. */ + #ifndef _Noreturn + # if (defined __cplusplus \ +@@ -1220,6 +1221,7 @@ + # define _Noreturn + # endif + #endif ++#endif + + + /* Define to 2 if the system does not provide POSIX.1 features except with diff --git a/sim/common/Make-common.in b/sim/common/Make-common.in -index 1e61927..6263ece 100644 +index 21e1d991..2ea1ab60 100644 --- a/sim/common/Make-common.in +++ b/sim/common/Make-common.in @@ -236,7 +236,7 @@ CSEARCH = -I. -I$(srcdir) -I../common -I$(srccom) \ diff --git a/repos/ports/src/noux-pkg/gdb/patches/shared_library.patch b/repos/ports/src/noux-pkg/gdb/patches/shared_library.patch index 353ec0ab6b..a660faf93d 100644 --- a/repos/ports/src/noux-pkg/gdb/patches/shared_library.patch +++ b/repos/ports/src/noux-pkg/gdb/patches/shared_library.patch @@ -6,12 +6,12 @@ Enable shared library support. --- gdb/amd64-tdep.c | 4 ++++ gdb/arm-tdep.c | 4 ++++ - gdb/configure.tgt | 6 +++++- + gdb/configure.tgt | 7 +++++-- gdb/i386-tdep.c | 4 ++++ - 4 files changed, 17 insertions(+), 1 deletion(-) + 4 files changed, 17 insertions(+), 2 deletions(-) diff --git a/gdb/amd64-tdep.c b/gdb/amd64-tdep.c -index 190e086..e1f8862 100644 +index 3a24b0d9..1d8cfd0b 100644 --- a/gdb/amd64-tdep.c +++ b/gdb/amd64-tdep.c @@ -50,6 +50,8 @@ @@ -23,7 +23,7 @@ index 190e086..e1f8862 100644 /* Note that the AMD64 architecture was previously known as x86-64. The latter is (forever) engraved into the canonical system name as returned by config.guess, and used as the name for the AMD64 port -@@ -3056,6 +3058,8 @@ amd64_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch, +@@ -3127,6 +3129,8 @@ amd64_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch, static const char *const stap_register_indirection_suffixes[] = { ")", NULL }; @@ -33,19 +33,19 @@ index 190e086..e1f8862 100644 floating-point registers. */ tdep->sizeof_fpregset = I387_SIZEOF_FXSAVE; diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c -index fdfb360..cfdfb0b 100644 +index 415f11e1..be342117 100644 --- a/gdb/arm-tdep.c +++ b/gdb/arm-tdep.c -@@ -73,6 +73,8 @@ - #include "selftest.h" +@@ -66,6 +66,8 @@ + #include "gdbsupport/selftest.h" #endif +#include "solib-svr4.h" + - static int arm_debug; + static bool arm_debug; /* Macros for setting and testing a bit in a minimal symbol that marks -@@ -9287,6 +9289,8 @@ arm_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) +@@ -9337,6 +9339,8 @@ arm_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) tdep = XCNEW (struct gdbarch_tdep); gdbarch = gdbarch_alloc (&info, tdep); @@ -55,18 +55,19 @@ index fdfb360..cfdfb0b 100644 These are gdbarch discriminators, like the OSABI. */ tdep->arm_abi = arm_abi; diff --git a/gdb/configure.tgt b/gdb/configure.tgt -index f197160..cbdd010 100644 +index a3e11c4b..3756809c 100644 --- a/gdb/configure.tgt +++ b/gdb/configure.tgt -@@ -180,6 +180,7 @@ arm*-*-symbianelf*) +@@ -189,7 +189,7 @@ arm*-*-symbianelf*) ;; arm*-*-*) # Target: ARM embedded system +- gdb_target_obs="arm-pikeos-tdep.o" + gdb_target_obs="solib-svr4.o" gdb_sim=../sim/arm/libsim.a ;; -@@ -698,8 +699,11 @@ x86_64-*-dicos*) +@@ -725,8 +725,11 @@ x86_64-*-dicos*) dicos-tdep.o i386-dicos-tdep.o amd64-dicos-tdep.o" ;; x86_64-*-elf*) @@ -80,19 +81,19 @@ index f197160..cbdd010 100644 # Target: GNU/Linux x86-64 gdb_target_obs="amd64-linux-tdep.o ${i386_tobjs} \ diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c -index a6994aa..18e6e77 100644 +index c33983b6..057f3e3c 100644 --- a/gdb/i386-tdep.c +++ b/gdb/i386-tdep.c -@@ -65,6 +65,8 @@ - #include - #include +@@ -67,6 +67,8 @@ + #include + #include "producer.h" +#include "solib-svr4.h" + /* Register names. */ static const char *i386_register_names[] = -@@ -8374,6 +8376,8 @@ i386_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) +@@ -8465,6 +8467,8 @@ i386_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) tdep = XCNEW (struct gdbarch_tdep); gdbarch = gdbarch_alloc (&info, tdep); diff --git a/repos/ports/src/noux-pkg/gdb/target.inc b/repos/ports/src/noux-pkg/gdb/target.inc index 25fb8e5983..cd8e64724e 100644 --- a/repos/ports/src/noux-pkg/gdb/target.inc +++ b/repos/ports/src/noux-pkg/gdb/target.inc @@ -7,7 +7,9 @@ CONFIGURE_ARGS += --program-prefix=$(PROGRAM_PREFIX) \ # the configure script calls the linker with "-lexpat", which fails CONFIGURE_ARGS += --without-expat CPPFLAGS += -DHAVE_LIBEXPAT=1 -CFLAGS += -Wno-error=sizeof-pointer-memaccess -Wno-error=unused-value +CFLAGS += -Wno-error=sizeof-pointer-memaccess \ + -Wno-error=unused-value \ + -Wno-error=overflow LIBS += stdcxx ncurses expat