tool_chain: update GDB to version 8.2.1

Issue #3307
This commit is contained in:
Christian Prochaska 2019-04-29 16:53:44 +02:00 committed by Christian Helmuth
parent 1720d2d86d
commit f369da741d
37 changed files with 1657 additions and 1176 deletions

View File

@ -4,33 +4,21 @@ INC_DIR += $(REP_DIR)/src/lib/gdbserver_libc_support \
$(REP_DIR)/src/lib/gdbserver_platform \ $(REP_DIR)/src/lib/gdbserver_platform \
$(REP_DIR)/src/app/gdb_monitor \ $(REP_DIR)/src/app/gdb_monitor \
$(GDB_CONTRIB_DIR)/include \ $(GDB_CONTRIB_DIR)/include \
$(GDB_CONTRIB_DIR)/gdb \
$(GDB_CONTRIB_DIR)/gdb/common \ $(GDB_CONTRIB_DIR)/gdb/common \
$(GDB_CONTRIB_DIR)/gdb/gdbserver \ $(GDB_CONTRIB_DIR)/gdb/gdbserver \
$(GDB_CONTRIB_DIR)/gdb/gnulib/import \
$(GDB_CONTRIB_DIR)/gdb/regformats \ $(GDB_CONTRIB_DIR)/gdb/regformats \
$(REP_DIR)/src/app/gdb_monitor/gdbserver $(REP_DIR)/src/app/gdb_monitor/gdbserver
SRC_CC += gdbserver_platform_helper.cc SRC_CC += gdbserver_platform_helper.cc
LIBS += libc CC_OPT_gdbserver_platform_helper += -fpermissive
# generated files CC_OPT += -DGDBSERVER
CC_OPT += -DHAVE_DECL_PTRACE -DHAVE_SYS_PTRACE_H
REGFORMATS_DIR := $(abspath ${GDB_CONTRIB_DIR}/gdb/regformats) LIBS += stdcxx libc
reg-arm.c:
$(VERBOSE) cd $(dir $@) && $(SHELL) $(REGFORMATS_DIR)/regdat.sh $(REGFORMATS_DIR)/reg-arm.dat $(notdir $@)
i386.c:
$(VERBOSE) cd $(dir $@) && $(SHELL) $(REGFORMATS_DIR)/regdat.sh $(REGFORMATS_DIR)/i386/i386.dat $(notdir $@)
i386-avx.c:
$(VERBOSE) cd $(dir $@) && $(SHELL) $(REGFORMATS_DIR)/regdat.sh $(REGFORMATS_DIR)/i386/i386-avx.dat $(notdir $@)
amd64.c:
$(VERBOSE) cd $(dir $@) && $(SHELL) $(REGFORMATS_DIR)/regdat.sh $(REGFORMATS_DIR)/i386/amd64.dat $(notdir $@)
amd64-avx.c:
$(VERBOSE) cd $(dir $@) && $(SHELL) $(REGFORMATS_DIR)/regdat.sh $(REGFORMATS_DIR)/i386/amd64-avx.dat $(notdir $@)
vpath %.cc $(REP_DIR)/src/lib/gdbserver_platform vpath %.cc $(REP_DIR)/src/lib/gdbserver_platform
vpath %.c $(GDB_CONTRIB_DIR)/gdb/gdbserver vpath %.cc $(GDB_CONTRIB_DIR)/gdb

View File

@ -1,9 +1,11 @@
INC_DIR += $(REP_DIR)/src/lib/gdbserver_platform/spec/x86_32 INC_DIR += $(REP_DIR)/src/lib/gdbserver_platform/spec/x86_32
SRC_C = i386.c \ SRC_CC += arch/i386.cc \
i386-avx.c \ gdbserver/linux-x86-low.cc \
linux-x86-low.c gdbserver/linux-x86-tdesc.cc \
nat/x86-linux.cc \
nat/x86-linux-dregs.cc
CC_OPT_linux-x86-low += -Wno-unused-function CC_OPT += -fpermissive -Wno-unused-function
include $(REP_DIR)/lib/mk/gdbserver_platform.inc include $(REP_DIR)/lib/mk/gdbserver_platform.inc

View File

@ -1,7 +1,7 @@
REQUIRES += nova REQUIRES += nova
SRC_CC = spec/x86_64/low.cc \ SRC_CC += spec/x86_64/low.cc \
native_cpu.cc native_cpu.cc
SHARED_LIB = yes SHARED_LIB = yes

View File

@ -1,11 +1,12 @@
INC_DIR += $(REP_DIR)/src/lib/gdbserver_platform/spec/x86_64 INC_DIR += $(REP_DIR)/src/lib/gdbserver_platform/spec/x86_64
SRC_C = i386.c \ SRC_CC += arch/i386.cc \
i386-avx.c \ arch/amd64.cc \
amd64.c \ gdbserver/linux-x86-low.cc \
amd64-avx.c \ gdbserver/linux-x86-tdesc.cc \
linux-x86-low.c nat/x86-linux.cc \
nat/x86-linux-dregs.cc
CC_OPT_linux-x86-low += -Wno-unused-function CC_OPT += -fpermissive -Wno-unused-function
include $(REP_DIR)/lib/mk/gdbserver_platform.inc include $(REP_DIR)/lib/mk/gdbserver_platform.inc

View File

@ -1,120 +1,97 @@
abort U
__aeabi_unwind_cpp_pr0 U
__aeabi_unwind_cpp_pr1 U
all_lwps U
all_threads U
amd64_emit_ops D 248
collect_register_by_name U
collect_register U
current_inferior U
current_insn_ptr U
current_process U
__cxa_allocate_exception U
__cxa_begin_catch U
__cxa_end_catch U
__cxa_end_cleanup U
__cxa_get_exception_ptr U
__cxa_pure_virtual U
__cxa_throw U
debug_threads U
delete_gdb_breakpoint_at U
dl_unwind_find_exidx W
__dynamic_cast U
emit_error U
__error U
error U
expedite_regs_amd64_avx D 32
expedite_regs_amd64 D 32
expedite_regs_arm D 16
expedite_regs_i386_avx D 32
expedite_regs_i386 D 32
fatal U
find_inferior_id U
find_inferior U
find_lwp_pid U
find_regno U
fprintf U
free U
gdbserver_expedite_regs U
gdbserver_xmltarget U
genode_fetch_register T
genode_read_memory_byte U
genode_store_register T
get_raw_reg_func_addr U
get_thread_regcache U
__gnu_Unwind_Find_exidx T
__gxx_personality_v0 U
i386_dr_low_get_addr T
i386_dr_low_get_control T
i386_dr_low_get_status T
i386_dr_low_set_addr T
i386_dr_low_set_control T
i386_emit_ops D 248
i386_low_init_dregs U
i386_low_insert_watchpoint U
i386_low_remove_watchpoint U
i386_low_stopped_by_watchpoint U
i386_low_stopped_data_address U
inferior_target_data U
init_registers_amd64_avx T
init_registers_amd64 T
init_registers_arm T
init_registers_i386_avx T
init_registers_i386 T
_init T
internal_error U
l4_atomic_add T
l4_atomic_cmpxchg T
l4_atomic_xchg T
l4_utcb_wrap W
linux_stop_lwp U
memcpy U
num_xmm_registers U
paddress U
pid_to_ptid U
ps_get_thread_area T
ptid_get_lwp U
ptid_get_pid U
ptrace U
regcache_invalidate U
register_size U
regs_amd64_avx D 1168
regs_amd64 D 912
regs_arm D 312
regs_i386_avx D 784
regs_i386 D 656
relocate_instruction U
set_gdb_breakpoint_at U
set_register_cache U
__stderrp U
strtok U
strtoul U
supply_register_by_name U
supply_register U
target_regsets D 112
the_low_target D 216
the_target U
_Unwind_Resume U _Unwind_Resume U
write_inferior_memory U _Z11ptid_of_lwpP8lwp_info U
x86_xcr0 U _Z12debug_printfPKcz U
xcalloc U _Z12find_lwp_pid6ptid_t U
xmltarget_amd64_avx D 8 _Z13all_processesB5cxx11 U
xmltarget_amd64 D 8 _Z13register_sizePK11target_desci U
xmltarget_arm D 4 _Z14agent_loaded_pv U
xmltarget_i386_avx D 8
xmltarget_i386 D 8
xstrdup U
_Z14fetch_registerPKcmRm T _Z14fetch_registerPKcmRm T
_Z14internal_errorPKciS0_z U
_Z14linux_stop_lwpP8lwp_info U
_Z14lwp_is_stoppedP8lwp_info U
_Z14store_registerPKcRmm T _Z14store_registerPKcRmm T
_Z14tdesc_add_flagP22tdesc_type_with_fieldsiPKc U
_Z15current_processv U
_Z15lwp_stop_reasonP8lwp_info U
_Z15set_tdesc_osabiP11target_descPKc U
_Z15tdesc_add_fieldP22tdesc_type_with_fieldsPKcP10tdesc_type U
_Z16current_lwp_ptidv U
_Z16find_process_pidi U
_Z16init_target_descP11target_descPPKc U
_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
_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
_Z19tdesc_create_structP13tdesc_featurePKc U
_Z19tdesc_create_vectorP13tdesc_featurePKcP10tdesc_typei U
_Z19x86_debug_reg_statei T
_Z19x86_linux_regs_infov T
_Z20relocate_instructionPyy U
_Z20tdesc_create_featureP11target_descPKc U
_Z20x86_linux_new_threadP8lwp_info T
_Z21cannot_fetch_registerPKc T _Z21cannot_fetch_registerPKc T
_Z21cannot_store_registerPKcm T _Z21cannot_store_registerPKcm T
_Z21genode_fetch_registeriPm T
_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
_Z22find_any_thread_of_pidi U
_Z22genode_child_resourcesv 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
_Z23initialize_regsets_infoP12regsets_info U
_Z23supply_register_by_nameP8regcachePKcPKv U
_Z23x86_linux_delete_threadP13arch_lwp_info T
_Z23x86_linux_dr_get_statusv T
_Z24collect_register_by_nameP8regcachePKcPv U
_Z24get_current_thread_statev T _Z24get_current_thread_statev T
_Z24set_current_thread_stateN6Genode12Thread_stateE T _Z24set_current_thread_stateN6Genode12Thread_stateE T
_ZdlPvRN6Genode11DeallocatorE U _Z24x86_dr_insert_watchpointP19x86_debug_reg_state17target_hw_bp_typeyi U
_ZdlPv U _Z24x86_dr_remove_watchpointP19x86_debug_reg_state17target_hw_bp_typeyi 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_linux_prepare_to_resumeP8lwp_info T
_Z28amd64_linux_read_descriptionmb T
_Z30i386_create_target_descriptionmb 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
_ZN11Gdb_monitor21Cpu_session_component10thread_capEm U _ZN11Gdb_monitor21Cpu_session_component10thread_capEm U
_ZN11Gdb_monitor21Cpu_session_component17lookup_cpu_threadEN6Genode10CapabilityINS1_10Cpu_threadEEE U
_ZN11Gdb_monitor21Cpu_session_component17_setup_native_cpuEv T _ZN11Gdb_monitor21Cpu_session_component17_setup_native_cpuEv T
_ZN11Gdb_monitor21Cpu_session_component18parent_cpu_sessionEv U _ZN11Gdb_monitor21Cpu_session_component18parent_cpu_sessionEv U
_ZN11Gdb_monitor21Cpu_session_component19_cleanup_native_cpuEv T _ZN11Gdb_monitor21Cpu_session_component19_cleanup_native_cpuEv T
@ -128,20 +105,48 @@ _ZN6Genode15Cancelable_lockC2ENS0_5StateE U
_ZN6Genode17Native_capability4_decEv U _ZN6Genode17Native_capability4_decEv U
_ZN6Genode17Native_capability4_incEv U _ZN6Genode17Native_capability4_incEv U
_ZN6Genode17Native_capabilityC1Ev U _ZN6Genode17Native_capabilityC1Ev U
_ZN6Genode17Native_capabilityC2Ev U
_ZN6Genode3Log3logEv U _ZN6Genode3Log3logEv U
_ZN6Genode3Log8_acquireENS0_4TypeE U _ZN6Genode3Log8_acquireENS0_4TypeE U
_ZN6Genode3Log8_releaseEv U _ZN6Genode3Log8_releaseEv U
_ZN6Genode5printERNS_6OutputEl U _ZN6Genode5Trace6Logger17_evaluate_controlEv U
_ZN6Genode5printERNS_6OutputEPKc U _ZN6Genode5printERNS_6OutputEPKc U
_ZN6Genode5printERNS_6OutputEPKv U _ZN6Genode5printERNS_6OutputEPKv U
_ZN6Genode5Trace6Logger17_evaluate_controlEv U _ZN6Genode5printERNS_6OutputEl U
_ZN6Genode6Thread7_loggerEv U _ZN6Genode6Thread7_loggerEv U
_ZN6Genode8ipc_callENS_17Native_capabilityERNS_11Msgbuf_baseES2_m U _ZN6Genode8ipc_callENS_17Native_capabilityERNS_11Msgbuf_baseES2_m U
_ZNK6Genode17Native_capability10local_nameEv U _ZNK6Genode17Native_capability10local_nameEv U
_ZnwjRN6Genode9AllocatorE U
_ZSt9terminatev U _ZSt9terminatev U
_ZTIN11Gdb_monitor20Cpu_thread_componentE U _ZTIN11Gdb_monitor20Cpu_thread_componentE U
_ZTVN10__cxxabiv117__class_type_infoE U _ZTVN10__cxxabiv117__class_type_infoE U
_ZTVN10__cxxabiv120__si_class_type_infoE U _ZTVN10__cxxabiv120__si_class_type_infoE U
_ZTVN10__cxxabiv121__vmi_class_type_infoE U _ZTVN10__cxxabiv121__vmi_class_type_infoE U
_ZdlPv U
_ZdlPvRN6Genode11DeallocatorE U
_ZnwmRN6Genode9AllocatorE U
__cxa_allocate_exception U
__cxa_begin_catch U
__cxa_end_catch U
__cxa_get_exception_ptr U
__cxa_pure_virtual U
__cxa_throw U
__dynamic_cast U
__error U
__gxx_personality_v0 U
abort U
amd64_emit_ops D 296
current_insn_ptr U
current_thread U
debug_threads U
emit_error U
free U
have_ptrace_getfpxregs B 4
i386_emit_ops D 296
ptrace U
sprintf U
strtok U
strtoul U
the_low_target D 296
the_target U
x86_dr_low D 48
xcalloc U
xstrdup U

View File

@ -1 +1 @@
d551192c3d4c27c03d68e104e6ba62d2dfe6e661 b82025f7f85938ce713b6c442c693afe465dd83a

View File

@ -1,9 +1,9 @@
LICENSE := GPLv3 LICENSE := GPLv3
VERSION := 7.3.1 VERSION := 8.2.1
DOWNLOADS := gdb.archive DOWNLOADS := gdb.archive
URL(gdb) := ftp://ftp.fu-berlin.de/gnu/gdb/gdb-$(VERSION).tar.bz2 URL(gdb) := ftp://ftp.fu-berlin.de/gnu/gdb/gdb-$(VERSION).tar.xz
SHA(gdb) := 6d7bff716fde98d03866a1b747c0929ee7dba49bca13e01d975e0b0fa9b33a28 SHA(gdb) := 0a6a432907a03c5c8eaad3c3cffd50c00a40c3a5e3c4039440624bae703f2202
SIG(gdb) := ${URL(gdb)}.sig SIG(gdb) := ${URL(gdb)}.sig
KEY(gdb) := GNU KEY(gdb) := GNU
DIR(gdb) := src/noux-pkg/gdb DIR(gdb) := src/noux-pkg/gdb
@ -11,3 +11,62 @@ DIR(gdb) := src/noux-pkg/gdb
PATCHES := $(addprefix ${DIR(gdb)}/patches/, \ PATCHES := $(addprefix ${DIR(gdb)}/patches/, \
$(shell cat $(REP_DIR)/${DIR(gdb)}/patches/series)) $(shell cat $(REP_DIR)/${DIR(gdb)}/patches/series))
PATCH_OPT := -p1 -d ${DIR(gdb)} PATCH_OPT := -p1 -d ${DIR(gdb)}
default: symlinks
#
# These .c files need to be compiled with g++
#
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

View File

@ -112,7 +112,7 @@ proc binary_name_gdbserver_platform_lib_so { } {
# generic modules # generic modules
build_boot_image { build_boot_image {
libc.lib.so vfs.lib.so libc_pipe.lib.so stdcxx.lib.so libc.lib.so libm.lib.so vfs.lib.so libc_pipe.lib.so
pc_uart_drv pc_uart_drv
gdb_monitor gdbserver_platform.lib.so gdb_monitor gdbserver_platform.lib.so
} }

View File

@ -97,7 +97,7 @@ proc binary_name_gdbserver_platform_lib_so { } {
set boot_modules { set boot_modules {
core init timer core init timer
ld.lib.so libc.lib.so vfs.lib.so libm.lib.so libc_pipe.lib.so ld.lib.so libc.lib.so vfs.lib.so libm.lib.so libc_pipe.lib.so
pc_uart_drv posix.lib.so pc_uart_drv posix.lib.so stdcxx.lib.so
gdb_monitor gdbserver_platform.lib.so test-gdb_monitor gdb_monitor gdbserver_platform.lib.so test-gdb_monitor
} }
@ -142,6 +142,9 @@ append gdb_cmds [gdb_initial_breakpoint_cmds $gdb_target_binary]
eval spawn [gdb] debug/ld.lib.so -n $gdb_cmds eval spawn [gdb] debug/ld.lib.so -n $gdb_cmds
set gdb_id [list $spawn_id $genode_id] set gdb_id [list $spawn_id $genode_id]
send "set pagination off\n"
run_genode_until {\(gdb\)} 20 $gdb_id
puts "" puts ""
puts "----- test: breakpoint in 'main()' -----" puts "----- test: breakpoint in 'main()' -----"
puts "" puts ""
@ -244,8 +247,8 @@ if {![regexp {Breakpoint 4, test_thread_start} $output]} {
send "info threads\n" send "info threads\n"
run_genode_until {\(gdb\)} 20 $gdb_id run_genode_until {\(gdb\)} 20 $gdb_id
if {![regexp { 4 Thread 3} $output] || if {![regexp {\* 4 Thread 4 test_thread_start} $output] ||
![regexp {\* 3 Thread 4 test_thread_start} $output] || ![regexp { 3 Thread 3} $output] ||
![regexp { 2 Thread 2} $output] || ![regexp { 2 Thread 2} $output] ||
![regexp { 1 Thread 1} $output]} { ![regexp { 1 Thread 1} $output]} {
puts stderr "*** Error: Thread info is not as expected" puts stderr "*** Error: Thread info is not as expected"
@ -274,7 +277,7 @@ puts ""
send "c\n" send "c\n"
run_genode_until {\(gdb\)} 20 $gdb_id run_genode_until {\(gdb\)} 20 $gdb_id
if {![regexp {Program received signal SIGSEGV, Segmentation fault.} $output]} { if {![regexp {Thread 4 received signal SIGSEGV, Segmentation fault.} $output]} {
puts stderr "*** Error: Segmentation fault exception was not caught" puts stderr "*** Error: Segmentation fault exception was not caught"
exit -1 exit -1
} }
@ -292,10 +295,10 @@ if {![have_spec arm]} {
send "bt\n" send "bt\n"
run_genode_until {\(gdb\)} 20 $gdb_id run_genode_until {\(gdb\)} 20 $gdb_id
if {![regexp {Genode::Cancelable_lock::lock\(\)} $output] || if {![regexp {Genode::Cancelable_lock::lock} $output] ||
![regexp {Genode::Signal_receiver::block_for_signal\(\)} $output] || ![regexp {Genode::Signal_receiver::block_for_signal} $output] ||
![regexp {Genode::Entrypoint::_wait_and_dispatch_one_io_signal\(bool\)} $output] || ![regexp {Genode::Entrypoint::_wait_and_dispatch_one_io_signal} $output] ||
![regexp {Libc::Kernel::run\(Libc::Application_code&\)} $output] } { ![regexp {Libc::Kernel::run} $output] } {
puts stderr "*** Error: Stack trace when in syscall is not as expected" puts stderr "*** Error: Stack trace when in syscall is not as expected"
exit -1 exit -1

View File

@ -10,9 +10,10 @@ import_from_depot [depot_user]/src/[base_src] \
[depot_user]/pkg/terminal \ [depot_user]/pkg/terminal \
[depot_user]/src/init \ [depot_user]/src/init \
[depot_user]/src/libc \ [depot_user]/src/libc \
[depot_user]/src/ncurses \
[depot_user]/src/noux \ [depot_user]/src/noux \
[depot_user]/src/posix \ [depot_user]/src/posix \
[depot_user]/src/ncurses [depot_user]/src/stdcxx
source ${genode_dir}/repos/ports/run/noux_gdb.inc source ${genode_dir}/repos/ports/run/noux_gdb.inc

View File

@ -228,13 +228,16 @@ class Gdb_monitor::App_child : public Child_policy,
/** /**
* Constructor * Constructor
*/ */
App_child(Env &env, App_child(Env &env,
Allocator &alloc, Allocator &alloc,
char const *unique_name, char const *unique_name,
Ram_quota ram_quota, Ram_quota ram_quota,
Cap_quota cap_quota, Cap_quota cap_quota,
Entrypoint &signal_ep, Entrypoint &signal_ep,
Xml_node target_node) Xml_node target_node,
int const new_thread_pipe_write_end,
int const breakpoint_len,
unsigned char const *breakpoint_data)
: :
_env(env), _env(env),
_alloc(alloc), _alloc(alloc),
@ -246,7 +249,9 @@ class Gdb_monitor::App_child : public Child_policy,
_unresolved_page_fault_handler(signal_ep, *this, _unresolved_page_fault_handler(signal_ep, *this,
&App_child::_handle_unresolved_page_fault), &App_child::_handle_unresolved_page_fault),
_cpu_factory(_env, _env.ep().rpc_ep(), _alloc, _pd.core_pd_cap(), _cpu_factory(_env, _env.ep().rpc_ep(), _alloc, _pd.core_pd_cap(),
signal_ep, &_genode_child_resources), signal_ep, new_thread_pipe_write_end,
breakpoint_len, breakpoint_data,
&_genode_child_resources),
_rom_factory(_env, _env.ep().rpc_ep(), _alloc) _rom_factory(_env, _env.ep().rpc_ep(), _alloc)
{ {
_genode_child_resources.region_map_component(&_pd.region_map()); _genode_child_resources.region_map_component(&_pd.region_map());

View File

@ -254,7 +254,10 @@ Thread_capability Cpu_session_component::create_thread(Capability<Pd_session> pd
{ {
Cpu_thread_component *cpu_thread = Cpu_thread_component *cpu_thread =
new (_md_alloc) Cpu_thread_component(*this, _core_pd, name, new (_md_alloc) Cpu_thread_component(*this, _core_pd, name,
affinity, weight, utcb); affinity, weight, utcb,
_new_thread_pipe_write_end,
_breakpoint_len,
_breakpoint_data);
_thread_list.append(cpu_thread); _thread_list.append(cpu_thread);
@ -309,13 +312,19 @@ Cpu_session_component::Cpu_session_component(Env &env,
Pd_session_capability core_pd, Pd_session_capability core_pd,
Entrypoint &signal_ep, Entrypoint &signal_ep,
const char *args, const char *args,
Affinity const &affinity) Affinity const &affinity,
int const new_thread_pipe_write_end,
int const breakpoint_len,
unsigned char const *breakpoint_data)
: _env(env), : _env(env),
_ep(ep), _ep(ep),
_md_alloc(md_alloc), _md_alloc(md_alloc),
_core_pd(core_pd), _core_pd(core_pd),
_parent_cpu_session(env.session<Cpu_session>(_id_space_element.id(), args, affinity)), _parent_cpu_session(env.session<Cpu_session>(_id_space_element.id(), args, affinity)),
_signal_ep(signal_ep), _signal_ep(signal_ep),
_new_thread_pipe_write_end(new_thread_pipe_write_end),
_breakpoint_len(breakpoint_len),
_breakpoint_data(breakpoint_data),
_native_cpu_cap(_setup_native_cpu()) _native_cpu_cap(_setup_native_cpu())
{ {
_ep.manage(this); _ep.manage(this);

View File

@ -60,6 +60,10 @@ class Gdb_monitor::Cpu_session_component : public Rpc_object<Cpu_session>
Cpu_session_client _parent_cpu_session; Cpu_session_client _parent_cpu_session;
Entrypoint &_signal_ep; Entrypoint &_signal_ep;
int const _new_thread_pipe_write_end;
int const _breakpoint_len;
unsigned char const *_breakpoint_data;
Append_list<Cpu_thread_component> _thread_list; Append_list<Cpu_thread_component> _thread_list;
bool _stop_new_threads = true; bool _stop_new_threads = true;
@ -81,7 +85,10 @@ class Gdb_monitor::Cpu_session_component : public Rpc_object<Cpu_session>
Pd_session_capability core_pd, Pd_session_capability core_pd,
Entrypoint &signal_ep, Entrypoint &signal_ep,
const char *args, const char *args,
Affinity const &affinity); Affinity const &affinity,
int const new_thread_pipe_write_end,
int const breakpoint_len,
unsigned char const *breakpoint_data);
/** /**
* Destructor * Destructor
@ -137,6 +144,9 @@ class Gdb_monitor::Local_cpu_factory : public Cpu_service::Factory
Allocator &_md_alloc; Allocator &_md_alloc;
Pd_session_capability _core_pd; Pd_session_capability _core_pd;
Entrypoint &_signal_ep; Entrypoint &_signal_ep;
int const _new_thread_pipe_write_end;
int const _breakpoint_len;
unsigned char const *_breakpoint_data;
Genode_child_resources *_genode_child_resources; Genode_child_resources *_genode_child_resources;
@ -147,11 +157,17 @@ class Gdb_monitor::Local_cpu_factory : public Cpu_service::Factory
Allocator &md_alloc, Allocator &md_alloc,
Pd_session_capability core_pd, Pd_session_capability core_pd,
Entrypoint &signal_ep, Entrypoint &signal_ep,
int new_thread_pipe_write_end,
int const breakpoint_len,
unsigned char const *breakpoint_data,
Genode_child_resources *genode_child_resources) Genode_child_resources *genode_child_resources)
: _env(env), _ep(ep), : _env(env), _ep(ep),
_md_alloc(md_alloc), _md_alloc(md_alloc),
_core_pd(core_pd), _core_pd(core_pd),
_signal_ep(signal_ep), _signal_ep(signal_ep),
_new_thread_pipe_write_end(new_thread_pipe_write_end),
_breakpoint_len(breakpoint_len),
_breakpoint_data(breakpoint_data),
_genode_child_resources(genode_child_resources) _genode_child_resources(genode_child_resources)
{ } { }
@ -169,7 +185,10 @@ class Gdb_monitor::Local_cpu_factory : public Cpu_service::Factory
_core_pd, _core_pd,
_signal_ep, _signal_ep,
args.string(), args.string(),
affinity); affinity,
_new_thread_pipe_write_end,
_breakpoint_len,
_breakpoint_data);
_genode_child_resources->cpu_session_component(cpu_session_component); _genode_child_resources->cpu_session_component(cpu_session_component);
return *cpu_session_component; return *cpu_session_component;
} }

View File

@ -14,21 +14,12 @@
/* GDB monitor includes */ /* GDB monitor includes */
#include "cpu_thread_component.h" #include "cpu_thread_component.h"
#include "genode-low.h"
/* libc includes */ /* libc includes */
#include <signal.h> #include <signal.h>
#include <unistd.h> #include <unistd.h>
/* mem-break.c */
extern "C" int breakpoint_len;
extern "C" const unsigned char *breakpoint_data;
extern "C" int set_gdb_breakpoint_at(long long where);
/* genode-low.cc */
extern "C" int genode_read_memory(long long memaddr, unsigned char *myaddr, int len);
extern "C" int genode_write_memory (long long memaddr, const unsigned char *myaddr, int len);
extern void genode_set_initial_breakpoint_at(long long addr);
static unsigned long new_lwpid = GENODE_MAIN_LWPID; static unsigned long new_lwpid = GENODE_MAIN_LWPID;
@ -41,13 +32,13 @@ bool Cpu_thread_component::_set_breakpoint_at_first_instruction(addr_t ip)
_breakpoint_ip = ip; _breakpoint_ip = ip;
if (genode_read_memory(_breakpoint_ip, _original_instructions, if (genode_read_memory(_breakpoint_ip, _original_instructions,
breakpoint_len) != 0) { _breakpoint_len) != 0) {
warning(__PRETTY_FUNCTION__, ": could not read memory at thread start address"); warning(__PRETTY_FUNCTION__, ": could not read memory at thread start address");
return false; return false;
} }
if (genode_write_memory(_breakpoint_ip, breakpoint_data, if (genode_write_memory(_breakpoint_ip, _breakpoint_data,
breakpoint_len) != 0) { _breakpoint_len) != 0) {
warning(__PRETTY_FUNCTION__, ": could not set breakpoint at thread start address"); warning(__PRETTY_FUNCTION__, ": could not set breakpoint at thread start address");
return false; return false;
} }
@ -59,7 +50,7 @@ bool Cpu_thread_component::_set_breakpoint_at_first_instruction(addr_t ip)
void Cpu_thread_component::_remove_breakpoint_at_first_instruction() void Cpu_thread_component::_remove_breakpoint_at_first_instruction()
{ {
if (genode_write_memory(_breakpoint_ip, _original_instructions, if (genode_write_memory(_breakpoint_ip, _original_instructions,
breakpoint_len) != 0) _breakpoint_len) != 0)
warning(__PRETTY_FUNCTION__, ": could not remove breakpoint at thread start address"); warning(__PRETTY_FUNCTION__, ": could not remove breakpoint at thread start address");
} }
@ -87,15 +78,21 @@ Cpu_thread_component::Cpu_thread_component(Cpu_session_component &cpu_session_
Cpu_session::Name const &name, Cpu_session::Name const &name,
Affinity::Location affinity, Affinity::Location affinity,
Cpu_session::Weight weight, Cpu_session::Weight weight,
addr_t utcb) addr_t utcb,
int const new_thread_pipe_write_end,
int const breakpoint_len,
unsigned char const *breakpoint_data)
: :
_cpu_session_component(cpu_session_component), _cpu_session_component(cpu_session_component),
_parent_cpu_thread( _parent_cpu_thread(
_cpu_session_component.parent_cpu_session().create_thread(pd, _cpu_session_component.parent_cpu_session().create_thread(pd,
name, name,
affinity, affinity,
weight, weight,
utcb)), utcb)),
_new_thread_pipe_write_end(new_thread_pipe_write_end),
_breakpoint_len(breakpoint_len),
_breakpoint_data(breakpoint_data),
_exception_handler(_cpu_session_component.signal_ep(), *this, _exception_handler(_cpu_session_component.signal_ep(), *this,
&Cpu_thread_component::_handle_exception), &Cpu_thread_component::_handle_exception),
_sigstop_handler(_cpu_session_component.signal_ep(), *this, _sigstop_handler(_cpu_session_component.signal_ep(), *this,
@ -192,13 +189,24 @@ int Cpu_thread_component::deliver_signal(int signo)
break; break;
case SIGINFO: case SIGINFO:
if (_verbose) if (_verbose)
log("delivering initial SIGSTOP to thread ", _lwpid); if (_lwpid != GENODE_MAIN_LWPID)
log("delivering initial SIGSTOP to thread ", _lwpid);
break; break;
default: default:
error("unexpected signal ", signo); error("unexpected signal ", signo);
} }
write(_pipefd[1], &signo, sizeof(signo)); if (!((signo == SIGINFO) && (_lwpid == GENODE_MAIN_LWPID)))
write(_pipefd[1], &signo, sizeof(signo));
/*
* gdbserver might be blocking in 'waitpid()' without having
* the new thread's pipe fd in its 'select' fd set yet. Writing
* into the 'new thread pipe' here will unblock 'select' in this
* case.
*/
if (signo == SIGINFO)
write(_new_thread_pipe_write_end, &_lwpid, sizeof(_lwpid));
return 0; return 0;
} }

View File

@ -36,6 +36,10 @@ class Gdb_monitor::Cpu_thread_component : public Rpc_object<Cpu_thread>,
Cpu_session_component &_cpu_session_component; Cpu_session_component &_cpu_session_component;
Cpu_thread_client _parent_cpu_thread; Cpu_thread_client _parent_cpu_thread;
int const _new_thread_pipe_write_end;
int const _breakpoint_len;
unsigned char const *_breakpoint_data;
unsigned long _lwpid { 0 }; unsigned long _lwpid { 0 };
addr_t _initial_ip { 0 }; addr_t _initial_ip { 0 };
@ -72,7 +76,10 @@ class Gdb_monitor::Cpu_thread_component : public Rpc_object<Cpu_thread>,
Cpu_session::Name const &name, Cpu_session::Name const &name,
Affinity::Location affinity, Affinity::Location affinity,
Cpu_session::Weight weight, Cpu_session::Weight weight,
addr_t utcb); addr_t utcb,
int const new_thread_pipe_write_end,
int const breakpoint_len,
unsigned char const *breakpoint_data);
~Cpu_thread_component(); ~Cpu_thread_component();

View File

@ -27,28 +27,32 @@
#include <sys/wait.h> #include <sys/wait.h>
#include <unistd.h> #include <unistd.h>
extern "C" {
#define private _private
#include "genode-low.h" #include "genode-low.h"
#include "server.h" #include "server.h"
#include "linux-low.h" #include "linux-low.h"
#define _private private
int linux_detach_one_lwp (struct inferior_list_entry *entry, void *args); void linux_detach_one_lwp (struct lwp_info *lwp);
}
static bool verbose = false; static bool verbose = false;
Genode::Env *genode_env; Genode::Env *genode_env;
/*
* 'waitpid()' is implemented using 'select()'. When a new thread is created,
* 'select()' needs to unblock, so there is a dedicated pipe for that. The
* lwpid of the new thread needs to be read from the pipe in 'waitpid()', so
* that the next 'select()' call can block again. The lwpid needs to be stored
* in a variable until it is inquired later.
*/
static int _new_thread_pipe[2]; static int _new_thread_pipe[2];
static unsigned long _new_thread_lwpid;
/* /*
* When 'waitpid()' reports a SIGTRAP, this variable stores the lwpid of the * When 'waitpid()' reports a SIGTRAP, this variable stores the lwpid of the
* corresponding thread. This information is used in the initial breakpoint * corresponding thread. This information is used in the initial breakpoint
* handler to let the correct thread handle the event. * handler to let the correct thread handle the event.
*/ */
static unsigned long sigtrap_lwpid; static unsigned long _sigtrap_lwpid;
using namespace Genode; using namespace Genode;
using namespace Gdb_monitor; using namespace Gdb_monitor;
@ -248,7 +252,7 @@ static void genode_stop_thread(unsigned long lwpid)
} }
extern "C" pid_t waitpid(pid_t pid, int *status, int flags) pid_t my_waitpid(pid_t pid, int *status, int flags)
{ {
extern int remote_desc; extern int remote_desc;
@ -296,7 +300,7 @@ extern "C" pid_t waitpid(pid_t pid, int *status, int flags)
cc = read (remote_desc, &c, 1); cc = read (remote_desc, &c, 1);
if (cc == 1 && c == '\003' && current_inferior != NULL) { if (cc == 1 && c == '\003' && current_thread != NULL) {
/* this causes a SIGINT to be delivered to one of the threads */ /* this causes a SIGINT to be delivered to one of the threads */
(*the_target->request_interrupt)(); (*the_target->request_interrupt)();
continue; continue;
@ -308,13 +312,39 @@ extern "C" pid_t waitpid(pid_t pid, int *status, int flags)
} else if (FD_ISSET(_new_thread_pipe[0], &readset)) { } else if (FD_ISSET(_new_thread_pipe[0], &readset)) {
unsigned long lwpid = GENODE_MAIN_LWPID; /*
* Linux 'ptrace(2)' manual text related to the main thread:
*
* "If the PTRACE_O_TRACEEXEC option is not in effect, all
* successful calls to execve(2) by the traced process will
* cause it to be sent a SIGTRAP signal, giving the parent a
* chance to gain control before the new program begins
* execution."
*
* Linux 'ptrace' manual text related to other threads:
*
* "PTRACE_O_CLONE
* ...
* A waitpid(2) by the tracer will return a status value such
* that
*
* status>>8 == (SIGTRAP | (PTRACE_EVENT_CLONE<<8))
*
* The PID of the new process can be retrieved with
* PTRACE_GETEVENTMSG."
*/
genode_stop_thread(lwpid); *status = W_STOPCODE(SIGTRAP);
*status = W_STOPCODE(SIGTRAP) | (PTRACE_EVENT_CLONE << 16); read(_new_thread_pipe[0], &_new_thread_lwpid,
sizeof(_new_thread_lwpid));
return lwpid; if (_new_thread_lwpid != GENODE_MAIN_LWPID) {
*status |= (PTRACE_EVENT_CLONE << 16);
genode_stop_thread(GENODE_MAIN_LWPID);
}
return GENODE_MAIN_LWPID;
} else { } else {
@ -341,7 +371,7 @@ extern "C" pid_t waitpid(pid_t pid, int *status, int flags)
if (signal == SIGTRAP) { if (signal == SIGTRAP) {
sigtrap_lwpid = lwpid; _sigtrap_lwpid = lwpid;
} else if (signal == SIGSTOP) { } else if (signal == SIGSTOP) {
@ -369,9 +399,6 @@ extern "C" pid_t waitpid(pid_t pid, int *status, int flags)
if (verbose) if (verbose)
log("received SIGINFO for new lwpid ", lwpid); log("received SIGINFO for new lwpid ", lwpid);
if (lwpid != GENODE_MAIN_LWPID)
write(_new_thread_pipe[1], &lwpid, sizeof(lwpid));
/* /*
* First signal of a new thread. On Genode originally a * First signal of a new thread. On Genode originally a
* SIGTRAP, but gdbserver expects SIGSTOP. * SIGTRAP, but gdbserver expects SIGSTOP.
@ -411,13 +438,12 @@ extern "C" long ptrace(enum __ptrace_request request, pid_t pid, void *addr, voi
case PTRACE_SETREGS: request_str = "PTRACE_SETREGS"; break; case PTRACE_SETREGS: request_str = "PTRACE_SETREGS"; break;
case PTRACE_ATTACH: request_str = "PTRACE_ATTACH"; break; case PTRACE_ATTACH: request_str = "PTRACE_ATTACH"; break;
case PTRACE_DETACH: request_str = "PTRACE_DETACH"; break; case PTRACE_DETACH: request_str = "PTRACE_DETACH"; break;
case PTRACE_GETSIGINFO: request_str = "PTRACE_GETSIGINFO"; break;
case PTRACE_GETEVENTMSG: case PTRACE_GETEVENTMSG:
/* /*
* Only PTRACE_EVENT_CLONE is currently supported. * Only PTRACE_EVENT_CLONE is currently supported.
*
* Read the lwpid of the new thread from the pipe.
*/ */
read(_new_thread_pipe[0], data, sizeof(unsigned long)); *(unsigned long*)data = _new_thread_lwpid;
return 0; return 0;
case PTRACE_GETREGSET: request_str = "PTRACE_GETREGSET"; break; case PTRACE_GETREGSET: request_str = "PTRACE_GETREGSET"; break;
} }
@ -429,7 +455,7 @@ extern "C" long ptrace(enum __ptrace_request request, pid_t pid, void *addr, voi
} }
extern "C" int fork() extern "C" int vfork()
{ {
/* create the thread announcement pipe */ /* create the thread announcement pipe */
@ -499,13 +525,20 @@ extern "C" int fork()
static Entrypoint signal_ep { *genode_env, SIGNAL_EP_STACK_SIZE, static Entrypoint signal_ep { *genode_env, SIGNAL_EP_STACK_SIZE,
"sig_handler", Affinity::Location() }; "sig_handler", Affinity::Location() };
int breakpoint_len = 0;
unsigned char const *breakpoint_data =
the_target->sw_breakpoint_from_kind(0, &breakpoint_len);
App_child *child = new (alloc) App_child(*genode_env, App_child *child = new (alloc) App_child(*genode_env,
alloc, alloc,
filename.string(), filename.string(),
Ram_quota{ram_quota}, Ram_quota{ram_quota},
cap_quota, cap_quota,
signal_ep, signal_ep,
target_node); target_node,
_new_thread_pipe[1],
breakpoint_len,
breakpoint_data);
_genode_child_resources = child->genode_child_resources(); _genode_child_resources = child->genode_child_resources();
@ -527,6 +560,8 @@ extern "C" int kill(pid_t pid, int sig)
{ {
Cpu_session_component &csc = genode_child_resources().cpu_session_component(); Cpu_session_component &csc = genode_child_resources().cpu_session_component();
if (pid <= 0) pid = GENODE_MAIN_LWPID;
Thread_capability thread_cap = csc.thread_cap(pid); Thread_capability thread_cap = csc.thread_cap(pid);
if (!thread_cap.valid()) { if (!thread_cap.valid()) {
@ -542,11 +577,11 @@ extern "C" int kill(pid_t pid, int sig)
extern "C" int initial_breakpoint_handler(CORE_ADDR addr) extern "C" int initial_breakpoint_handler(CORE_ADDR addr)
{ {
Cpu_session_component &csc = genode_child_resources().cpu_session_component(); Cpu_session_component &csc = genode_child_resources().cpu_session_component();
return csc.handle_initial_breakpoint(sigtrap_lwpid); return csc.handle_initial_breakpoint(_sigtrap_lwpid);
} }
void genode_set_initial_breakpoint_at(CORE_ADDR addr) void genode_set_initial_breakpoint_at(unsigned long addr)
{ {
set_breakpoint_at(addr, initial_breakpoint_handler); set_breakpoint_at(addr, initial_breakpoint_handler);
} }
@ -554,13 +589,14 @@ void genode_set_initial_breakpoint_at(CORE_ADDR addr)
void genode_remove_thread(unsigned long lwpid) void genode_remove_thread(unsigned long lwpid)
{ {
int pid = GENODE_MAIN_LWPID; struct thread_info *thread_info =
linux_detach_one_lwp((struct inferior_list_entry *) find_thread_ptid(ptid_t(GENODE_MAIN_LWPID, lwpid, 0));
find_thread_ptid(ptid_build(GENODE_MAIN_LWPID, lwpid, 0)), &pid); struct lwp_info *lwp = get_thread_lwp(thread_info);
linux_detach_one_lwp(lwp);
} }
extern "C" void genode_stop_all_threads() void genode_stop_all_threads()
{ {
Cpu_session_component &csc = genode_child_resources().cpu_session_component(); Cpu_session_component &csc = genode_child_resources().cpu_session_component();
csc.pause_all_threads(); csc.pause_all_threads();
@ -609,10 +645,12 @@ void genode_continue_thread(unsigned long lwpid, int single_step)
void genode_fetch_registers(struct regcache *regcache, int regno) void genode_fetch_registers(struct regcache *regcache, int regno)
{ {
const struct regs_info *regs_info = (*the_low_target.regs_info) ();
unsigned long reg_content = 0; unsigned long reg_content = 0;
if (regno == -1) { if (regno == -1) {
for (regno = 0; regno < the_low_target.num_regs; regno++) { for (regno = 0; regno < regs_info->usrregs->num_regs; regno++) {
if (genode_fetch_register(regno, &reg_content) == 0) if (genode_fetch_register(regno, &reg_content) == 0)
supply_register(regcache, regno, &reg_content); supply_register(regcache, regno, &reg_content);
else else
@ -631,17 +669,21 @@ void genode_store_registers(struct regcache *regcache, int regno)
{ {
if (verbose) log(__func__, ": regno=", regno); if (verbose) log(__func__, ": regno=", regno);
const struct regs_info *regs_info = (*the_low_target.regs_info) ();
unsigned long reg_content = 0; unsigned long reg_content = 0;
if (regno == -1) { if (regno == -1) {
for (regno = 0; regno < the_low_target.num_regs; regno++) { for (regno = 0; regno < regs_info->usrregs->num_regs; regno++) {
if ((Genode::size_t)register_size(regno) <= sizeof(reg_content)) { if ((Genode::size_t)register_size(regcache->tdesc, regno) <=
sizeof(reg_content)) {
collect_register(regcache, regno, &reg_content); collect_register(regcache, regno, &reg_content);
genode_store_register(regno, reg_content); genode_store_register(regno, reg_content);
} }
} }
} else { } else {
if ((Genode::size_t)register_size(regno) <= sizeof(reg_content)) { if ((Genode::size_t)register_size(regcache->tdesc, regno) <=
sizeof(reg_content)) {
collect_register(regcache, regno, &reg_content); collect_register(regcache, regno, &reg_content);
genode_store_register(regno, reg_content); genode_store_register(regno, reg_content);
} }

View File

@ -43,4 +43,7 @@ int genode_fetch_register(int regno, unsigned long *reg_content);
void genode_store_register(int regno, unsigned long reg_content); void genode_store_register(int regno, unsigned long reg_content);
unsigned char genode_read_memory_byte(void *addr); unsigned char genode_read_memory_byte(void *addr);
/* interface for cpu_thread_component.cc */
void genode_set_initial_breakpoint_at(unsigned long addr);
#endif /* GENODE_LOW_H */ #endif /* GENODE_LOW_H */

View File

@ -25,11 +25,11 @@ extern "C" int sigsuspend() { return -1; }
/* /*
* version.c * version.c
*/ */
extern "C" const char version[] = "7.3.1"; extern "C" const char version[] = "8.1.1";
extern "C" const char host_name[] = ""; extern "C" const char host_name[] = "";
extern "C" int gdbserver_main(int argc, const char *argv[]); extern int gdbserver_main(int argc, char *argv[]);
extern Genode::Env *genode_env; extern Genode::Env *genode_env;
@ -38,7 +38,7 @@ void Libc::Component::construct(Libc::Env &env)
genode_env = &env; genode_env = &env;
int argc = 3; int argc = 3;
const char *argv[] = { "gdbserver", "/dev/terminal", "target", 0 }; char *argv[] = { "gdbserver", "/dev/terminal", "target", 0 };
Libc::with_libc([&] () { Libc::with_libc([&] () {
gdbserver_main(argc, argv); gdbserver_main(argc, argv);

View File

@ -3,44 +3,90 @@ TARGET = gdb_monitor
GDB_CONTRIB_DIR = $(call select_from_ports,gdb)/src/noux-pkg/gdb GDB_CONTRIB_DIR = $(call select_from_ports,gdb)/src/noux-pkg/gdb
INC_DIR += $(GDB_CONTRIB_DIR)/include \ INC_DIR += $(GDB_CONTRIB_DIR)/include \
$(GDB_CONTRIB_DIR)/gdb \
$(GDB_CONTRIB_DIR)/gdb/common \ $(GDB_CONTRIB_DIR)/gdb/common \
$(GDB_CONTRIB_DIR)/gdb/gdbserver \ $(GDB_CONTRIB_DIR)/gdb/gdbserver \
$(GDB_CONTRIB_DIR)/gdb/gnulib/import \
$(GDB_CONTRIB_DIR)/gdb/regformats \ $(GDB_CONTRIB_DIR)/gdb/regformats \
$(REP_DIR)/src/lib/gdbserver_libc_support \ $(REP_DIR)/src/lib/gdbserver_libc_support \
$(PRG_DIR)/gdbserver \ $(PRG_DIR)/gdbserver \
$(PRG_DIR) $(PRG_DIR)
LIBS = libc libc_pipe \ LIBS = stdcxx libc libc_pipe \
gdbserver_platform gdbserver_libc_support gdbserver_platform gdbserver_libc_support
SRC_C = event-loop.c \ # libiberty
i386-low.c \ SRC_C = argv.c \
i387-fp.c \ concat.c \
inferiors.c \ crc32.c
mem-break.c \
remote-utils.c \
regcache.c \
server.c \
signals.c \
target.c \
tracepoint.c \
utils.c
SRC_C += linux-low.c # gnulib
SRC_C += rawmemchr.c \
strchrnul.c
CC_OPT += -DGDBSERVER -DPKGVERSION="\"7.3.1\"" -DREPORT_BUGS_TO="\"\"" # 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/debug.cc \
gdbserver/dll.cc \
gdbserver/event-loop.cc \
gdbserver/fork-child.cc \
gdbserver/hostio.cc \
gdbserver/i387-fp.cc \
gdbserver/inferiors.cc \
gdbserver/linux-low.cc \
gdbserver/mem-break.cc \
gdbserver/notif.cc \
gdbserver/regcache.cc \
gdbserver/remote-utils.cc \
gdbserver/server.cc \
gdbserver/symbol.cc \
gdbserver/target.cc \
gdbserver/tdesc.cc \
gdbserver/tracepoint.cc \
gdbserver/utils.cc \
gdbserver/x86-low.cc \
nat/fork-inferior.cc \
nat/linux-ptrace.cc \
nat/x86-dregs.cc \
target/waitstatus.cc
CC_OPT_linux-low += -Wno-unused-function # genode
SRC_CC += genode-low.cc \
cpu_session_component.cc \
cpu_thread_component.cc \
region_map_component.cc \
signal_handler_thread.cc \
main.cc
SRC_CC = genode-low.cc \ CC_OPT += -DGDBSERVER -DPKGVERSION="\"8.1.1\"" -DREPORT_BUGS_TO="\"\""
cpu_session_component.cc \ CC_OPT += -DHAVE_SYS_WAIT_H -DHAVE_SYS_PTRACE_H -DHAVE_DECL_PTRACE -DHAVE_TERMIOS
cpu_thread_component.cc \ CC_OPT += -fpermissive -Wno-unused-function
region_map_component.cc \
signal_handler_thread.cc \
main.cc
vpath %.c $(GDB_CONTRIB_DIR)/gdb/common vpath %.c $(GDB_CONTRIB_DIR)/gdb/gnulib/import
vpath %.c $(GDB_CONTRIB_DIR)/gdb/gdbserver vpath %.c $(GDB_CONTRIB_DIR)/libiberty
vpath %.cc $(GDB_CONTRIB_DIR)/gdb
vpath %.cc $(PRG_DIR)/gdbserver vpath %.cc $(PRG_DIR)/gdbserver
# #

View File

@ -1,20 +0,0 @@
/*
* \brief Dummy declarations of Linux-specific libc types and macros
* needed to build gdbserver
* \author Christian Prochaska
* \date 2011-09-01
*/
/*
* Copyright (C) 2011-2017 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.
*/
#ifndef ELF_COMMON_H
#define ELF_COMMON_H
#define NT_X86_XSTATE 0x202 /* x86 extended state using xsave */
#endif

View File

@ -39,7 +39,7 @@ enum __ptrace_request {
PTRACE_GETREGSET = 0x4204, PTRACE_GETREGSET = 0x4204,
}; };
extern long ptrace(enum __ptrace_request request, ...); extern "C" long ptrace (enum __ptrace_request, pid_t, void*, void*);
#endif /* SYS_PTRACE_H */ #endif /* SYS_PTRACE_H */

View File

@ -18,7 +18,7 @@
using namespace Genode; using namespace Genode;
extern "C" int genode_fetch_register(int regno, unsigned long *value) int genode_fetch_register(int regno, unsigned long *value)
{ {
Thread_state ts; Thread_state ts;
@ -53,7 +53,7 @@ extern "C" int genode_fetch_register(int regno, unsigned long *value)
} }
extern "C" void genode_store_register(int regno, unsigned long value) void genode_store_register(int regno, unsigned long value)
{ {
Thread_state ts; Thread_state ts;

View File

@ -19,7 +19,7 @@
using namespace Genode; using namespace Genode;
extern "C" int genode_fetch_register(int regno, unsigned long *value) int genode_fetch_register(int regno, unsigned long *value)
{ {
Thread_state ts; Thread_state ts;
@ -95,7 +95,7 @@ extern "C" int genode_fetch_register(int regno, unsigned long *value)
} }
extern "C" void genode_store_register(int regno, unsigned long value) void genode_store_register(int regno, unsigned long value)
{ {
Thread_state ts; Thread_state ts;

View File

@ -16,13 +16,9 @@
#include "cpu_session_component.h" #include "cpu_session_component.h"
#include "genode_child_resources.h" #include "genode_child_resources.h"
extern "C" {
#define private _private
#include "server.h" #include "server.h"
#include "linux-low.h" #include "linux-low.h"
#include "genode-low.h" #include "genode-low.h"
#define _private private
}
using namespace Genode; using namespace Genode;
using namespace Gdb_monitor; using namespace Gdb_monitor;
@ -37,9 +33,9 @@ Thread_state get_current_thread_state()
{ {
Cpu_session_component &csc = genode_child_resources()->cpu_session_component(); Cpu_session_component &csc = genode_child_resources()->cpu_session_component();
ptid_t ptid = ((struct inferior_list_entry*)current_inferior)->id; ptid_t ptid = current_thread->id;
Cpu_thread_client cpu_thread(csc.thread_cap(ptid.lwp)); Cpu_thread_client cpu_thread(csc.thread_cap(ptid.lwp()));
return cpu_thread.state(); return cpu_thread.state();
} }
@ -49,9 +45,9 @@ void set_current_thread_state(Thread_state thread_state)
{ {
Cpu_session_component &csc = genode_child_resources()->cpu_session_component(); Cpu_session_component &csc = genode_child_resources()->cpu_session_component();
ptid_t ptid = ((struct inferior_list_entry*)current_inferior)->id; ptid_t ptid = current_thread->id;
Cpu_thread_client cpu_thread(csc.thread_cap(ptid.lwp)); Cpu_thread_client cpu_thread(csc.thread_cap(ptid.lwp()));
cpu_thread.state(thread_state); cpu_thread.state(thread_state);
} }

View File

@ -8,11 +8,11 @@ Enable software single-stepping on ARM.
1 file changed, 2 insertions(+) 1 file changed, 2 insertions(+)
diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c
index 155208e..91537d6 100644 index cfdfb0b..3afe712 100644
--- a/gdb/arm-tdep.c --- a/gdb/arm-tdep.c
+++ b/gdb/arm-tdep.c +++ b/gdb/arm-tdep.c
@@ -8467,6 +8467,8 @@ arm_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) @@ -9289,6 +9289,8 @@ arm_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
tdep = xcalloc (1, sizeof (struct gdbarch_tdep)); tdep = XCNEW (struct gdbarch_tdep);
gdbarch = gdbarch_alloc (&info, tdep); gdbarch = gdbarch_alloc (&info, tdep);
+ set_gdbarch_software_single_step(gdbarch, arm_software_single_step); + set_gdbarch_software_single_step(gdbarch, arm_software_single_step);

View File

@ -0,0 +1,23 @@
call_dummy_location.patch
From: Christian Prochaska <christian.prochaska@genode-labs.com>
---
gdb/i386-tdep.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c
index fe2453c..6c9fdf8 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)
set_gdbarch_get_longjmp_target (gdbarch, i386_get_longjmp_target);
/* Call dummy code. */
+#if 0 /* the stack is not executable on a Genode target */
set_gdbarch_call_dummy_location (gdbarch, ON_STACK);
+#endif
set_gdbarch_push_dummy_code (gdbarch, i386_push_dummy_code);
set_gdbarch_push_dummy_call (gdbarch, i386_push_dummy_call);
set_gdbarch_frame_align (gdbarch, i386_frame_align);

View File

@ -1,29 +0,0 @@
gcc6.patch
ChangeLog part removed to make the patch apply on Genode.
From 24b4cf66a626566e7903813a2e0156778f4903f9 Mon Sep 17 00:00:00 2001
From: Szabolcs Nagy <szabolcs.nagy@arm.com>
Date: Tue, 16 Jun 2015 13:35:33 +0100
Subject: [PATCH] Fixes a compile time warnng about left shifting a negative
value.
* arm-dis.c (print_insn_coprocessor): Avoid negative shift.
---
opcodes/ChangeLog | 4 ++++
opcodes/arm-dis.c | 2 +-
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/opcodes/arm-dis.c b/opcodes/arm-dis.c
index e9f4425..818847d 100644
--- a/opcodes/arm-dis.c
+++ b/opcodes/arm-dis.c
@@ -3352,7 +3352,7 @@ print_insn_coprocessor (bfd_vma pc,
/* Is ``imm'' a negative number? */
if (imm & 0x40)
- imm |= (-1 << 7);
+ imm -= 0x80;
func (stream, "%d", imm);
}

View File

@ -0,0 +1,102 @@
gdb_x86_64.patch
From: Christian Prochaska <christian.prochaska@genode-labs.com>
---
gdb/amd64-tdep.c | 13 +++++++++++++
gdb/defs.h | 1 +
gdb/i386-tdep.c | 5 +++++
gdb/osabi.c | 6 ++++++
4 files changed, 25 insertions(+)
diff --git a/gdb/amd64-tdep.c b/gdb/amd64-tdep.c
index e1f8862..314bf77 100644
--- a/gdb/amd64-tdep.c
+++ b/gdb/amd64-tdep.c
@@ -50,6 +50,7 @@
#include "osabi.h"
#include "x86-tdep.h"
+#include "osabi.h"
#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)
return *tdesc;
}
+static void
+amd64_genode_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
+{
+ amd64_init_abi (info, gdbarch,
+ amd64_target_description (X86_XSTATE_SSE_MASK, false));
+}
+
void
_initialize_amd64_tdep (void)
{
@@ -3326,6 +3334,11 @@ _initialize_amd64_tdep (void)
selftests::record_xml_tdesc (a.xml, tdesc);
}
#endif /* GDB_SELF_TEST */
+
+ /* Genode */
+ gdbarch_register_osabi(bfd_arch_i386, bfd_mach_x86_64,
+ GDB_OSABI_GENODE, amd64_genode_init_abi);
+ /* /Genode */
}
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
--- a/gdb/i386-tdep.c
+++ b/gdb/i386-tdep.c
@@ -9051,6 +9051,11 @@ Show Intel Memory Protection Extensions specific variables."),
gdbarch_register_osabi (bfd_arch_i386, 0, GDB_OSABI_SVR4,
i386_svr4_init_abi);
+ /* Genode */
+ gdbarch_register_osabi(bfd_arch_i386, 0, GDB_OSABI_GENODE,
+ i386_elf_init_abi);
+ /* /Genode */
+
/* Initialize the i386-specific register groups. */
i386_init_reggroups ();
diff --git a/gdb/osabi.c b/gdb/osabi.c
index 7d0540b..a68eea6 100644
--- a/gdb/osabi.c
+++ b/gdb/osabi.c
@@ -80,6 +80,7 @@ static const struct osabi_names gdb_osabi_names[] =
{ "LynxOS178", NULL },
{ "Newlib", NULL },
{ "SDE", NULL },
+ { "Genode", NULL },
{ "<invalid>", NULL }
};
@@ -562,6 +563,11 @@ generic_elf_osabi_sniffer (bfd *abfd)
bfd_map_over_sections (abfd,
generic_elf_osabi_sniff_abi_tag_sections,
&osabi);
+/* Genode */
+ if (osabi == GDB_OSABI_UNKNOWN)
+ osabi = GDB_OSABI_GENODE;
+/* /Genode */
+
break;
case ELFOSABI_FREEBSD:

File diff suppressed because it is too large Load Diff

View File

@ -1,169 +0,0 @@
gdbserver_x86_64.patch
From: Christian Prochaska <christian.prochaska@genode-labs.com>
---
gdb/gdbserver/linux-x86-low.c | 54 ++++++++++++++++++++++++++++++++++++++---
1 file changed, 50 insertions(+), 4 deletions(-)
diff --git a/gdb/gdbserver/linux-x86-low.c b/gdb/gdbserver/linux-x86-low.c
index e98e3bd..0ece728 100644
--- a/gdb/gdbserver/linux-x86-low.c
+++ b/gdb/gdbserver/linux-x86-low.c
@@ -33,6 +33,12 @@
#endif
#ifdef __GENODE__
+#ifdef __x86_64__
+void init_registers_amd64 (void);
+static inline void init_registers_amd64_linux(void) { init_registers_amd64(); }
+void init_registers_amd64_avx (void);
+static inline void init_registers_amd64_avx_linux(void) { init_registers_amd64_avx(); }
+#endif /* __x64_64__ */
/* Defined in auto-generated file i386.c. */
void init_registers_i386 (void);
static inline void init_registers_i386_linux(void) { init_registers_i386(); }
@@ -83,7 +89,9 @@ static const char *xmltarget_amd64_linux_no_xml = "@<target>\
#endif /* __GENODE__ */
#ifdef __GENODE__
-#ifndef __x86_64__
+#ifdef __x86_64__
+#include "amd64.h"
+#else
#include "i386.h"
#endif /* __x86_64__ */
#else
@@ -153,7 +161,11 @@ static /*const*/ int i386_regmap[] =
/* So code below doesn't have to care, i386 or amd64. */
#define ORIG_EAX ORIG_RAX
-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,
@@ -165,7 +177,9 @@ static const int x86_64_regmap[] =
-1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1,
+#ifndef __GENODE__
ORIG_RAX * 8
+#endif
};
#define X86_64_NUM_REGS (sizeof (x86_64_regmap) / sizeof (x86_64_regmap[0]))
@@ -188,6 +202,7 @@ static /*const*/ int i386_regmap[] =
/* Called by libthread_db. */
+#ifndef __GENODE__
ps_err_e
ps_get_thread_area (const struct ps_prochandle *ph,
lwpid_t lwpid, int idx, void **base)
@@ -225,6 +240,7 @@ ps_get_thread_area (const 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
@@ -286,6 +302,20 @@ i386_cannot_fetch_register (int regno)
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)
{
@@ -728,6 +758,7 @@ x86_linux_prepare_to_resume (struct lwp_info *lwp)
compatible with the siginfo type exported by the 32-bit userspace
support. */
+#ifndef __GENODE__
#ifdef __x86_64__
typedef int compat_int_t;
@@ -969,6 +1000,7 @@ x86_siginfo_fixup (siginfo_t *native, void *inf, int direction)
return 0;
}
+#endif
static int use_xml;
@@ -1138,11 +1170,15 @@ static void
x86_arch_setup (void)
{
#ifdef __x86_64__
+#ifdef __GENODE__
+ int use_64bit = 1;
+#else
int pid = pid_of (get_thread_lwp (current_inferior));
char *file = linux_child_pid_to_exec_file (pid);
int use_64bit = elf_64_file_p (file);
free (file);
+#endif
if (use_64bit < 0)
{
@@ -1152,19 +1188,25 @@ x86_arch_setup (void)
}
else if (use_64bit)
{
+#ifdef __GENODE__
+ the_low_target.num_regs = X86_64_NUM_REGS;
+ the_low_target.regmap = x86_64_regmap;
+ the_low_target.cannot_fetch_register = x86_64_cannot_fetch_register;
+ the_low_target.cannot_store_register = x86_64_cannot_store_register;
+#else
/* Amd64 doesn't have HAVE_LINUX_USRREGS. */
the_low_target.num_regs = -1;
the_low_target.regmap = NULL;
the_low_target.cannot_fetch_register = NULL;
the_low_target.cannot_store_register = NULL;
-
+#endif
/* Amd64 has 16 xmm regs. */
num_xmm_registers = 16;
x86_linux_update_xmltarget ();
return;
}
-#endif
+#endif /* __x86_64__ */
/* Ok we have a 32-bit inferior. */
@@ -2620,7 +2662,11 @@ 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_new_thread,
#ifndef __GENODE__

View File

@ -1,8 +1,19 @@
noux_build.patch
From: Christian Prochaska <christian.prochaska@genode-labs.com>
---
gdb/configure | 10 +++++-----
gdb/dwarf-index-write.c | 2 +-
sim/common/Make-common.in | 2 +-
3 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/gdb/configure b/gdb/configure diff --git a/gdb/configure b/gdb/configure
index 30e5e45..9c5ed7f 100755 index 28756ed..a3d6fc2 100755
--- a/gdb/configure --- a/gdb/configure
+++ b/gdb/configure +++ b/gdb/configure
@@ -7917,11 +7917,11 @@ fi @@ -6608,11 +6608,11 @@ fi
# configuration. # configuration.
gdb_host_obs=posix-hdep.o gdb_host_obs=posix-hdep.o
@ -18,7 +29,7 @@ index 30e5e45..9c5ed7f 100755
. $srcdir/configure.host . $srcdir/configure.host
@@ -12919,7 +12919,7 @@ sigjmp_buf env; while (! sigsetjmp (env, 1)) siglongjmp (env, 1); @@ -13785,7 +13785,7 @@ sigjmp_buf env; while (! sigsetjmp (env, 1)) siglongjmp (env, 1);
return 0; return 0;
} }
_ACEOF _ACEOF
@ -27,24 +38,24 @@ index 30e5e45..9c5ed7f 100755
gdb_cv_func_sigsetjmp=yes gdb_cv_func_sigsetjmp=yes
else else
gdb_cv_func_sigsetjmp=no gdb_cv_func_sigsetjmp=no
diff --git a/missing b/missing diff --git a/gdb/dwarf-index-write.c b/gdb/dwarf-index-write.c
index 28055d2..031956f 100755 index d283146..55bef80 100644
--- a/missing --- a/gdb/dwarf-index-write.c
+++ b/missing +++ b/gdb/dwarf-index-write.c
@@ -314,7 +314,7 @@ WARNING: \`$1' is $msg. You should only need it if @@ -705,7 +705,7 @@ public:
fi gdb_assert (m_abbrev_table.empty ());
# If the file does not exist, the user really needs makeinfo; const size_t name_count = m_name_to_value_set.size ();
# let's fail without touching anything. m_bucket_table.resize
- test -f $file || exit 1 - (std::pow (2, std::ceil (std::log2 (name_count * 4 / 3))));
+ #test -f $file || exit 1 + (std::pow (2, std::ceil (log2 (name_count * 4 / 3))));
touch $file 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/sim/common/Make-common.in b/sim/common/Make-common.in diff --git a/sim/common/Make-common.in b/sim/common/Make-common.in
index 351f4a0..9b68c87 100644 index 1e61927..6263ece 100644
--- a/sim/common/Make-common.in --- a/sim/common/Make-common.in
+++ b/sim/common/Make-common.in +++ b/sim/common/Make-common.in
@@ -237,7 +237,7 @@ CSEARCH = -I. -I$(srcdir) -I../common -I$(srccom) \ @@ -236,7 +236,7 @@ CSEARCH = -I. -I$(srcdir) -I../common -I$(srccom) \
-I../../bfd -I$(srcroot)/bfd \ -I../../bfd -I$(srcroot)/bfd \
-I../../opcodes -I$(srcroot)/opcodes \ -I../../opcodes -I$(srcroot)/opcodes \
@INCINTL@ @INCINTL@

View File

@ -1,8 +1,6 @@
siginfo.patch
shared_library.patch shared_library.patch
arm_single_step.patch arm_single_step.patch
x86_64.patch gdb_x86_64.patch
noux_build.patch noux_build.patch
gdbserver_genode.patch gdbserver_genode.patch
gdbserver_x86_64.patch call_dummy_location.patch
gcc6.patch

View File

@ -6,26 +6,26 @@ Enable shared library support.
--- ---
gdb/amd64-tdep.c | 4 ++++ gdb/amd64-tdep.c | 4 ++++
gdb/arm-tdep.c | 4 ++++ gdb/arm-tdep.c | 4 ++++
gdb/configure.tgt | 5 ++++- gdb/configure.tgt | 6 +++++-
gdb/i386-tdep.c | 4 ++++ gdb/i386-tdep.c | 4 ++++
4 files changed, 16 insertions(+), 1 deletion(-) 4 files changed, 17 insertions(+), 1 deletion(-)
diff --git a/gdb/amd64-tdep.c b/gdb/amd64-tdep.c diff --git a/gdb/amd64-tdep.c b/gdb/amd64-tdep.c
index 9b5d5bb..db3821a 100644 index 190e086..e1f8862 100644
--- a/gdb/amd64-tdep.c --- a/gdb/amd64-tdep.c
+++ b/gdb/amd64-tdep.c +++ b/gdb/amd64-tdep.c
@@ -45,6 +45,8 @@ @@ -50,6 +50,8 @@
#include "features/i386/amd64.c" #include "osabi.h"
#include "features/i386/amd64-avx.c" #include "x86-tdep.h"
+#include "solib-svr4.h" +#include "solib-svr4.h"
+ +
/* Note that the AMD64 architecture was previously known as x86-64. /* Note that the AMD64 architecture was previously known as x86-64.
The latter is (forever) engraved into the canonical system name as The latter is (forever) engraved into the canonical system name as
returned by config.guess, and used as the name for the AMD64 port returned by config.guess, and used as the name for the AMD64 port
@@ -2465,6 +2467,8 @@ amd64_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) @@ -3056,6 +3058,8 @@ amd64_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch,
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); static const char *const stap_register_indirection_suffixes[] = { ")",
const struct target_desc *tdesc = info.target_desc; NULL };
+ set_solib_svr4_fetch_link_map_offsets(gdbarch, svr4_lp64_fetch_link_map_offsets); + set_solib_svr4_fetch_link_map_offsets(gdbarch, svr4_lp64_fetch_link_map_offsets);
+ +
@ -33,20 +33,20 @@ index 9b5d5bb..db3821a 100644
floating-point registers. */ floating-point registers. */
tdep->sizeof_fpregset = I387_SIZEOF_FXSAVE; tdep->sizeof_fpregset = I387_SIZEOF_FXSAVE;
diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c
index bb52ad4..155208e 100644 index fdfb360..cfdfb0b 100644
--- a/gdb/arm-tdep.c --- a/gdb/arm-tdep.c
+++ b/gdb/arm-tdep.c +++ b/gdb/arm-tdep.c
@@ -57,6 +57,8 @@ @@ -73,6 +73,8 @@
#include "selftest.h"
#include "features/arm-with-m.c" #endif
+#include "solib-svr4.h" +#include "solib-svr4.h"
+ +
static int arm_debug; static int arm_debug;
/* Macros for setting and testing a bit in a minimal symbol that marks /* Macros for setting and testing a bit in a minimal symbol that marks
@@ -8465,6 +8467,8 @@ arm_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) @@ -9287,6 +9289,8 @@ arm_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
tdep = xcalloc (1, sizeof (struct gdbarch_tdep)); tdep = XCNEW (struct gdbarch_tdep);
gdbarch = gdbarch_alloc (&info, tdep); gdbarch = gdbarch_alloc (&info, tdep);
+ set_solib_svr4_fetch_link_map_offsets(gdbarch, svr4_ilp32_fetch_link_map_offsets); + set_solib_svr4_fetch_link_map_offsets(gdbarch, svr4_ilp32_fetch_link_map_offsets);
@ -55,47 +55,49 @@ index bb52ad4..155208e 100644
These are gdbarch discriminators, like the OSABI. */ These are gdbarch discriminators, like the OSABI. */
tdep->arm_abi = arm_abi; tdep->arm_abi = arm_abi;
diff --git a/gdb/configure.tgt b/gdb/configure.tgt diff --git a/gdb/configure.tgt b/gdb/configure.tgt
index 5ab1554..ae57017 100644 index f197160..cbdd010 100644
--- a/gdb/configure.tgt --- a/gdb/configure.tgt
+++ b/gdb/configure.tgt +++ b/gdb/configure.tgt
@@ -96,7 +96,7 @@ arm*-*-symbianelf*) @@ -180,6 +180,7 @@ arm*-*-symbianelf*)
;; ;;
arm*-*-* | thumb*-*-* | strongarm*-*-* | xscale-*-*) arm*-*-*)
# Target: ARM embedded system # Target: ARM embedded system
- gdb_target_obs="arm-tdep.o" + gdb_target_obs="solib-svr4.o"
+ gdb_target_obs="arm-tdep.o solib.o solib-svr4.o"
gdb_sim=../sim/arm/libsim.a gdb_sim=../sim/arm/libsim.a
;; ;;
@@ -623,6 +623,9 @@ x86_64-*-openbsd*) @@ -698,8 +699,11 @@ x86_64-*-dicos*)
i387-tdep.o i386bsd-tdep.o i386obsd-tdep.o \ dicos-tdep.o i386-dicos-tdep.o amd64-dicos-tdep.o"
bsd-uthread.o corelow.o solib.o solib-svr4.o"
;; ;;
+x86_64-*-*) x86_64-*-elf*)
+ gdb_target_obs="amd64-tdep.o i386-tdep.o i387-tdep.o solib.o solib-svr4.o" - gdb_target_obs="${i386_tobjs}"
+ ;; + gdb_target_obs="${amd64_tobjs} ${i386_tobjs} solib-svr4.o"
xtensa*-*-linux*) gdb_target=linux ;;
# Target: GNU/Linux Xtensa +x86_64-*-rtems*)
gdb_target_obs="xtensa-tdep.o xtensa-config.o xtensa-linux-tdep.o \ + gdb_target_obs="amd64-tdep.o i386-tdep.o i387-tdep.o i386bsd-tdep.o"
+ ;;
x86_64-*-linux*)
# 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 diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c
index 5f4089b..3c13bea 100644 index a6994aa..18e6e77 100644
--- a/gdb/i386-tdep.c --- a/gdb/i386-tdep.c
+++ b/gdb/i386-tdep.c +++ b/gdb/i386-tdep.c
@@ -60,6 +60,8 @@ @@ -65,6 +65,8 @@
#include "features/i386/i386-avx.c" #include <ctype.h>
#include "features/i386/i386-mmx.c" #include <algorithm>
+#include "solib-svr4.h" +#include "solib-svr4.h"
+ +
/* Register names. */ /* Register names. */
static const char *i386_register_names[] = static const char *i386_register_names[] =
@@ -7051,6 +7053,8 @@ i386_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) @@ -8374,6 +8376,8 @@ i386_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
tdep = XCALLOC (1, struct gdbarch_tdep); tdep = XCNEW (struct gdbarch_tdep);
gdbarch = gdbarch_alloc (&info, tdep); gdbarch = gdbarch_alloc (&info, tdep);
+ set_solib_svr4_fetch_link_map_offsets(gdbarch, svr4_ilp32_fetch_link_map_offsets); + set_solib_svr4_fetch_link_map_offsets(gdbarch, svr4_ilp32_fetch_link_map_offsets);
+ +
/* General-purpose registers. */ /* General-purpose registers. */
tdep->gregset = NULL;
tdep->gregset_reg_offset = NULL; tdep->gregset_reg_offset = NULL;
tdep->gregset_num_regs = I386_NUM_GREGS;

View File

@ -1,279 +0,0 @@
From 0bcbef9314d6679d1fbbb0114683d06de0196623 Mon Sep 17 00:00:00 2001
From: Christian Prochaska <christian.prochaska@genode-labs.com>
Message-Id: <0bcbef9314d6679d1fbbb0114683d06de0196623.1341578007.git.chris@arachsys.com>
From: Chris Webb <chris@arachsys.com>
Date: Fri, 6 Jul 2012 13:18:58 +0100
Subject: [PATCH] Replace struct siginfo with siginfo_t
Glibc 2.16.0 removes the undocumented definition of 'struct siginfo' from
<bits/siginfo.h>. This struct is also available as the POSIX-defined
siginfo_t, so replace all uses of struct siginfo with siginfo_t.
Signed-off-by: Chris Webb <chris@arachsys.com>
---
gdb/amd64-linux-nat.c | 4 ++--
gdb/arm-linux-nat.c | 2 +-
gdb/gdbserver/linux-low.c | 10 +++++-----
gdb/gdbserver/linux-low.h | 5 ++---
gdb/gdbserver/linux-x86-low.c | 4 ++--
gdb/ia64-linux-nat.c | 2 +-
gdb/linux-nat.c | 16 ++++++++--------
gdb/linux-nat.h | 6 +++---
gdb/ppc-linux-nat.c | 2 +-
gdb/procfs.c | 2 +-
10 files changed, 26 insertions(+), 27 deletions(-)
diff --git a/gdb/amd64-linux-nat.c b/gdb/amd64-linux-nat.c
index a869f85..7bae36d 100644
--- a/gdb/amd64-linux-nat.c
+++ b/gdb/amd64-linux-nat.c
@@ -684,13 +684,13 @@ siginfo_from_compat_siginfo (siginfo_t *to, compat_siginfo_t *from)
INF. */
static int
-amd64_linux_siginfo_fixup (struct siginfo *native, gdb_byte *inf, int direction)
+amd64_linux_siginfo_fixup (siginfo_t *native, gdb_byte *inf, int direction)
{
/* Is the inferior 32-bit? If so, then do fixup the siginfo
object. */
if (gdbarch_addr_bit (get_frame_arch (get_current_frame ())) == 32)
{
- gdb_assert (sizeof (struct siginfo) == sizeof (compat_siginfo_t));
+ gdb_assert (sizeof (siginfo_t) == sizeof (compat_siginfo_t));
if (direction == 0)
compat_siginfo_from_siginfo ((struct compat_siginfo *) inf, native);
diff --git a/gdb/arm-linux-nat.c b/gdb/arm-linux-nat.c
index 43f4fde..3ec2bfc 100644
--- a/gdb/arm-linux-nat.c
+++ b/gdb/arm-linux-nat.c
@@ -1203,7 +1203,7 @@ arm_linux_remove_watchpoint (CORE_ADDR addr, int len, int rw,
static int
arm_linux_stopped_data_address (struct target_ops *target, CORE_ADDR *addr_p)
{
- struct siginfo *siginfo_p = linux_nat_get_siginfo (inferior_ptid);
+ siginfo_t *siginfo_p = linux_nat_get_siginfo (inferior_ptid);
int slot = siginfo_p->si_errno;
/* This must be a hardware breakpoint. */
diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c
index 81b8540..e597e2f 100644
--- a/gdb/gdbserver/linux-low.c
+++ b/gdb/gdbserver/linux-low.c
@@ -4693,7 +4693,7 @@ linux_qxfer_osdata (const char *annex,
layout of the inferiors' architecture. */
static void
-siginfo_fixup (struct siginfo *siginfo, void *inf_siginfo, int direction)
+siginfo_fixup (siginfo_t *siginfo, void *inf_siginfo, int direction)
{
int done = 0;
@@ -4705,9 +4705,9 @@ siginfo_fixup (struct siginfo *siginfo, void *inf_siginfo, int direction)
if (!done)
{
if (direction == 1)
- memcpy (siginfo, inf_siginfo, sizeof (struct siginfo));
+ memcpy (siginfo, inf_siginfo, sizeof (siginfo_t));
else
- memcpy (inf_siginfo, siginfo, sizeof (struct siginfo));
+ memcpy (inf_siginfo, siginfo, sizeof (siginfo_t));
}
}
@@ -4716,8 +4716,8 @@ linux_xfer_siginfo (const char *annex, unsigned char *readbuf,
unsigned const char *writebuf, CORE_ADDR offset, int len)
{
int pid;
- struct siginfo siginfo;
- char inf_siginfo[sizeof (struct siginfo)];
+ siginfo_t siginfo;
+ char inf_siginfo[sizeof (siginfo_t)];
if (current_inferior == NULL)
return -1;
diff --git a/gdb/gdbserver/linux-low.h b/gdb/gdbserver/linux-low.h
index 6635bc6..d449e1b 100644
--- a/gdb/gdbserver/linux-low.h
+++ b/gdb/gdbserver/linux-low.h
@@ -21,6 +21,7 @@
#include <thread_db.h>
#endif
+#include <signal.h>
#include "gdb_proc_service.h"
#ifdef HAVE_LINUX_REGSETS
@@ -46,8 +47,6 @@ struct regset_info
extern struct regset_info target_regsets[];
#endif
-struct siginfo;
-
struct process_info_private
{
/* Arch-specific additions. */
@@ -100,7 +99,7 @@ struct linux_target_ops
Returns true if any conversion was done; false otherwise.
If DIRECTION is 1, then copy from INF to NATIVE.
If DIRECTION is 0, copy from NATIVE to INF. */
- int (*siginfo_fixup) (struct siginfo *native, void *inf, int direction);
+ int (*siginfo_fixup) (siginfo_t *native, void *inf, int direction);
/* Hook to call when a new process is created or attached to.
If extra per-process architecture-specific data is needed,
diff --git a/gdb/gdbserver/linux-x86-low.c b/gdb/gdbserver/linux-x86-low.c
index 69c6b57..82dcf83 100644
--- a/gdb/gdbserver/linux-x86-low.c
+++ b/gdb/gdbserver/linux-x86-low.c
@@ -906,13 +906,13 @@ siginfo_from_compat_siginfo (siginfo_t *to, compat_siginfo_t *from)
INF. */
static int
-x86_siginfo_fixup (struct siginfo *native, void *inf, int direction)
+x86_siginfo_fixup (siginfo_t *native, void *inf, int direction)
{
#ifdef __x86_64__
/* Is the inferior 32-bit? If so, then fixup the siginfo object. */
if (register_size (0) == 4)
{
- if (sizeof (struct siginfo) != sizeof (compat_siginfo_t))
+ if (sizeof (siginfo_t) != sizeof (compat_siginfo_t))
fatal ("unexpected difference in siginfo");
if (direction == 0)
diff --git a/gdb/ia64-linux-nat.c b/gdb/ia64-linux-nat.c
index 0f88e14..02482b2 100644
--- a/gdb/ia64-linux-nat.c
+++ b/gdb/ia64-linux-nat.c
@@ -640,7 +640,7 @@ static int
ia64_linux_stopped_data_address (struct target_ops *ops, CORE_ADDR *addr_p)
{
CORE_ADDR psr;
- struct siginfo *siginfo_p;
+ siginfo_t *siginfo_p;
struct regcache *regcache = get_current_regcache ();
siginfo_p = linux_nat_get_siginfo (inferior_ptid);
diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c
index 44a2a21..791d7b2 100644
--- a/gdb/linux-nat.c
+++ b/gdb/linux-nat.c
@@ -214,7 +214,7 @@ static void (*linux_nat_new_thread) (ptid_t);
/* The method to call, if any, when the siginfo object needs to be
converted between the layout returned by ptrace, and the layout in
the architecture of the inferior. */
-static int (*linux_nat_siginfo_fixup) (struct siginfo *,
+static int (*linux_nat_siginfo_fixup) (siginfo_t *,
gdb_byte *,
int);
@@ -3945,7 +3945,7 @@ linux_nat_mourn_inferior (struct target_ops *ops)
layout of the inferiors' architecture. */
static void
-siginfo_fixup (struct siginfo *siginfo, gdb_byte *inf_siginfo, int direction)
+siginfo_fixup (siginfo_t *siginfo, gdb_byte *inf_siginfo, int direction)
{
int done = 0;
@@ -3957,9 +3957,9 @@ siginfo_fixup (struct siginfo *siginfo, gdb_byte *inf_siginfo, int direction)
if (!done)
{
if (direction == 1)
- memcpy (siginfo, inf_siginfo, sizeof (struct siginfo));
+ memcpy (siginfo, inf_siginfo, sizeof (siginfo_t));
else
- memcpy (inf_siginfo, siginfo, sizeof (struct siginfo));
+ memcpy (inf_siginfo, siginfo, sizeof (siginfo_t));
}
}
@@ -3969,8 +3969,8 @@ linux_xfer_siginfo (struct target_ops *ops, enum target_object object,
const gdb_byte *writebuf, ULONGEST offset, LONGEST len)
{
int pid;
- struct siginfo siginfo;
- gdb_byte inf_siginfo[sizeof (struct siginfo)];
+ siginfo_t siginfo;
+ gdb_byte inf_siginfo[sizeof (siginfo_t)];
gdb_assert (object == TARGET_OBJECT_SIGNAL_INFO);
gdb_assert (readbuf || writebuf);
@@ -5784,7 +5784,7 @@ linux_nat_set_new_thread (struct target_ops *t, void (*new_thread) (ptid_t))
inferior. */
void
linux_nat_set_siginfo_fixup (struct target_ops *t,
- int (*siginfo_fixup) (struct siginfo *,
+ int (*siginfo_fixup) (siginfo_t *,
gdb_byte *,
int))
{
@@ -5793,7 +5793,7 @@ linux_nat_set_siginfo_fixup (struct target_ops *t,
}
/* Return the saved siginfo associated with PTID. */
-struct siginfo *
+siginfo_t *
linux_nat_get_siginfo (ptid_t ptid)
{
struct lwp_info *lp = find_lwp_pid (ptid);
diff --git a/gdb/linux-nat.h b/gdb/linux-nat.h
index 42cb2fc..422db28 100644
--- a/gdb/linux-nat.h
+++ b/gdb/linux-nat.h
@@ -60,7 +60,7 @@ struct lwp_info
/* Non-zero si_signo if this LWP stopped with a trap. si_addr may
be the address of a hardware watchpoint. */
- struct siginfo siginfo;
+ siginfo_t siginfo;
/* STOPPED_BY_WATCHPOINT is non-zero if this LWP stopped with a data
watchpoint trap. */
@@ -160,7 +160,7 @@ void linux_nat_set_new_thread (struct target_ops *, void (*) (ptid_t));
that ptrace returns, and the layout in the architecture of the
inferior. */
void linux_nat_set_siginfo_fixup (struct target_ops *,
- int (*) (struct siginfo *,
+ int (*) (siginfo_t *,
gdb_byte *,
int));
@@ -169,7 +169,7 @@ void linux_nat_set_siginfo_fixup (struct target_ops *,
void linux_nat_switch_fork (ptid_t new_ptid);
/* Return the saved siginfo associated with PTID. */
-struct siginfo *linux_nat_get_siginfo (ptid_t ptid);
+siginfo_t *linux_nat_get_siginfo (ptid_t ptid);
/* Compute and return the processor core of a given thread. */
int linux_nat_core_of_thread_1 (ptid_t ptid);
diff --git a/gdb/ppc-linux-nat.c b/gdb/ppc-linux-nat.c
index 6f11715..3a3de07 100644
--- a/gdb/ppc-linux-nat.c
+++ b/gdb/ppc-linux-nat.c
@@ -2161,7 +2161,7 @@ ppc_linux_thread_exit (struct thread_info *tp, int silent)
static int
ppc_linux_stopped_data_address (struct target_ops *target, CORE_ADDR *addr_p)
{
- struct siginfo *siginfo_p;
+ siginfo_t *siginfo_p;
siginfo_p = linux_nat_get_siginfo (inferior_ptid);
diff --git a/gdb/procfs.c b/gdb/procfs.c
index 5d7cb23..ea52d97 100644
--- a/gdb/procfs.c
+++ b/gdb/procfs.c
@@ -263,7 +263,7 @@ typedef struct sigaction gdb_sigaction_t;
#ifdef HAVE_PR_SIGINFO64_T
typedef pr_siginfo64_t gdb_siginfo_t;
#else
-typedef struct siginfo gdb_siginfo_t;
+typedef siginfo_t gdb_siginfo_t;
#endif
/* On mips-irix, praddset and prdelset are defined in such a way that

View File

@ -1,80 +0,0 @@
gdb_x86_64.diff
From: Christian Prochaska <christian.prochaska@genode-labs.com>
---
gdb/amd64-tdep.c | 5 +++++
gdb/defs.h | 1 +
gdb/i386-tdep.c | 5 +++++
gdb/osabi.c | 6 ++++++
4 files changed, 17 insertions(+)
diff --git a/gdb/amd64-tdep.c b/gdb/amd64-tdep.c
index db3821a..5f5e165 100644
--- a/gdb/amd64-tdep.c
+++ b/gdb/amd64-tdep.c
@@ -2581,6 +2581,11 @@ void _initialize_amd64_tdep (void);
void
_initialize_amd64_tdep (void)
{
+ /* Genode */
+ gdbarch_register_osabi(bfd_arch_i386, bfd_mach_x86_64,
+ GDB_OSABI_GENODE, amd64_init_abi);
+ /* /Genode */
+
initialize_tdesc_amd64 ();
initialize_tdesc_amd64_avx ();
}
diff --git a/gdb/defs.h b/gdb/defs.h
index 9531c5a..7c7258f 100644
--- a/gdb/defs.h
+++ b/gdb/defs.h
@@ -996,6 +996,7 @@ enum gdb_osabi
GDB_OSABI_DICOS,
GDB_OSABI_DARWIN,
GDB_OSABI_SYMBIAN,
+ GDB_OSABI_GENODE,
GDB_OSABI_INVALID /* keep this last */
};
diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c
index 3c13bea..3aaeec5 100644
--- a/gdb/i386-tdep.c
+++ b/gdb/i386-tdep.c
@@ -7367,6 +7367,11 @@ is \"default\"."),
gdbarch_register_osabi (bfd_arch_i386, 0, GDB_OSABI_GO32,
i386_go32_init_abi);
+ /* Genode */
+ gdbarch_register_osabi(bfd_arch_i386, 0, GDB_OSABI_GENODE,
+ i386_elf_init_abi);
+ /* /Genode */
+
/* Initialize the i386-specific register groups. */
i386_init_reggroups ();
diff --git a/gdb/osabi.c b/gdb/osabi.c
index a264924..c5e1775 100644
--- a/gdb/osabi.c
+++ b/gdb/osabi.c
@@ -73,6 +73,7 @@ static const char * const gdb_osabi_names[] =
"DICOS",
"Darwin",
"Symbian",
+ "Genode",
"<invalid>"
};
@@ -522,6 +523,11 @@ generic_elf_osabi_sniffer (bfd *abfd)
bfd_map_over_sections (abfd,
generic_elf_osabi_sniff_abi_tag_sections,
&osabi);
+/* Genode */
+ if (osabi == GDB_OSABI_UNKNOWN)
+ osabi = GDB_OSABI_GENODE;
+/* /Genode */
+
break;
case ELFOSABI_FREEBSD:

View File

@ -8,7 +8,7 @@ CONFIGURE_ARGS += --without-expat
CPPFLAGS += -DHAVE_LIBEXPAT=1 CPPFLAGS += -DHAVE_LIBEXPAT=1
CFLAGS += -Wno-error=sizeof-pointer-memaccess -Wno-error=unused-value CFLAGS += -Wno-error=sizeof-pointer-memaccess -Wno-error=unused-value
LIBS += ncurses expat LIBS += stdcxx ncurses expat
# workaround for problems with makeinfo version 5 # workaround for problems with makeinfo version 5
MAKE_ENV += "MAKEINFO=true" MAKE_ENV += "MAKEINFO=true"

View File

@ -1,4 +1,20 @@
PROGRAM_PREFIX = genode-arm- PROGRAM_PREFIX = genode-arm-
GDB_TARGET = arm-none-eabi GDB_TARGET = arm-none-eabi
#
# We link libraries to the final binaries using the 'LIBS' variable. But
# unfortunately, the gdb build system has hardcoded some libs such as '-lm'.
# To satisfy the linker, we provide dummy archives.
#
LDFLAGS += -L$(PWD)
.SECONDARY: dummy_libs
dummy_libs: libm.a
libm.a:
$(VERBOSE)$(AR) -rc $@
Makefile: dummy_libs
include $(PRG_DIR)/../gdb/target.inc include $(PRG_DIR)/../gdb/target.inc