binutils-gdb/gdb/linux-record.c

2066 lines
54 KiB
C
Raw Permalink Normal View History

/* Process record and replay target code for GNU/Linux.
Copyright (C) 2008-2024 Free Software Foundation, Inc.
This file is part of GDB.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include "extract-store-integer.h"
#include "target.h"
#include "gdbtypes.h"
#include "regcache.h"
#include "record.h"
Split record.h into record.h and record-full.h. Split record.c into record.c and record-full.c. The split leaves the command part in record.c and moves the target part into record-full.c. gdb/ * record.h: Split into this and ... * record-full.h: ... this. * record.c: Split into this and ... * record-full.c: ... this. * target.h (target_ops): Add new fields to_info_record, to_save_record, to_delete_record, to_record_is_replaying, to_goto_record_begin, to_goto_record_end, to_goto_record. (target_info_record): New. (target_save_record): New. (target_supports_delete_record): New. (target_delete_record): New. (target_record_is_replaying): New. (target_goto_record_begin): New. (target_goto_record_end): New. (target_goto_record): New. * target.c (target_info_record): New. (target_save_record): New. (target_supports_delete_record): New. (target_delete_record): New. (target_record_is_replaying): New. (target_goto_record_begin): New. (target_goto_record_end): New. (target_goto_record): New. * record.h: Declare struct cmd_list_element. (record_cmdlist): New declaration. (set_record_cmdlist): New declaration. (show_record_cmdlist): New declaration. (info_record_cmdlist): New declaration. (cmd_record_goto): New declaration. * record.c: Remove unnecessary includes. Include inferior.h. (cmd_record_goto): Remove declaration. (record_cmdlist): Now extern. Initialize. (set_record_cmdlist): Now extern. Initialize. (show_record_cmdlist): Now extern. Initialize. (info_record_cmdlist): Now extern. Initialize. (find_record_target): New. (require_record_target): New. (cmd_record_start): Update. (cmd_record_delete): Remove target-specific code. Call target_delete_record. (cmd_record_stop): Unpush any record target. (set_record_insn_max_num): Move to record-full.c (set_record_command): Add comment. (show_record_command): Add comment. (info_record_command): Update comment. Remove target-specific code. Call the record target's to_info_record. (cmd_record_start): New. (cmd_record_goto): Now extern. Remove target-specific code. Call target_goto_begin, target_goto_end, or target_goto. (_initialize_record): Move record target ops initialization to record-full.c. Change "record" command help text. Move "record restore", "record set", and "record show" commands to record-full.c. * Makefile.in (SFILES): Add record-full.c. (HFILES_NO_SRCDIR): Add record-full.h. (COMMON_OBS): Add record-full.o. * amd64-linux-tdep.c: Include record-full.h instead of record.h. * arm-tdep.c: Include record-full.h. * i386-linux-tdep.c: Include record-full.h instead of record.h. * i386-tdep.c: Include record-full.h. * infrun.c: Include record-full.h. * linux-record.c: Include record-full.h. * moxie-tdep.c: Include record-full.h. * record-full.c: Include record-full.h. Change module comment. (set_record_full_cmdlist): New. (show_record_full_cmdlist): New. (record_full_cmdlist): New. (record_goto_insn): New declaration. (record_save): New declaration. (record_check_insn_num): Change query string. (record_info): New. (record_delete): New. (record_is_replaying): New. (record_goto_entry): New. (record_goto_begin): New. (record_goto_end): New. (record_goto): New. (init_record_ops): Update. (init_record_core_ops): Update. (cmd_record_save): Rename to record_save. Remove target and arg checks. (cmd_record_start): New. (set_record_insn_max_num): Moved from record.c (set_record_full_command): New. (show_record_full_command): New. (_initialize_record_full): New.
2013-03-11 16:42:55 +08:00
#include "record-full.h"
#include "linux-record.h"
Don't include gdbarch.h from defs.h I touched symtab.h and was surprised to see how many files were rebuilt. I looked into it a bit, and found that defs.h includes gdbarch.h, which in turn includes many things. gdbarch.h is only needed by a minority ofthe files in gdb, so this patch removes the include from defs.h and updates the fallout. I did "wc -l" on the files in build/gdb/.deps; this patch reduces the line count from 139935 to 137030; so there are definitely future build-time savings here. Note that while I configured with --enable-targets=all, it's possible that some *-nat.c file needs an update. I could not test all of these. The buildbot caught a few problems along these lines. gdb/ChangeLog 2019-07-10 Tom Tromey <tom@tromey.com> * defs.h: Don't include gdbarch.h. * aarch64-ravenscar-thread.c, aarch64-tdep.c, alpha-bsd-tdep.h, alpha-linux-tdep.c, alpha-mdebug-tdep.c, arch-utils.h, arm-tdep.h, ax-general.c, btrace.c, buildsym-legacy.c, buildsym.h, c-lang.c, cli/cli-decode.h, cli/cli-dump.c, cli/cli-script.h, cli/cli-style.h, coff-pe-read.h, compile/compile-c-support.c, compile/compile-cplus.h, compile/compile-loc2c.c, corefile.c, cp-valprint.c, cris-linux-tdep.c, ctf.c, d-lang.c, d-namespace.c, dcache.c, dicos-tdep.c, dictionary.c, disasm-selftests.c, dummy-frame.c, dummy-frame.h, dwarf2-frame-tailcall.c, dwarf2expr.c, expression.h, f-lang.c, frame-base.c, frame-unwind.c, frv-linux-tdep.c, gdbarch-selftests.c, gdbtypes.h, go-lang.c, hppa-nbsd-tdep.c, hppa-obsd-tdep.c, i386-dicos-tdep.c, i386-tdep.h, ia64-vms-tdep.c, interps.h, language.c, linux-record.c, location.h, m2-lang.c, m32r-linux-tdep.c, mem-break.c, memattr.c, mn10300-linux-tdep.c, nios2-linux-tdep.c, objfiles.h, opencl-lang.c, or1k-linux-tdep.c, p-lang.c, parser-defs.h, ppc-tdep.h, probe.h, python/py-record-btrace.c, record-btrace.c, record.h, regcache-dump.c, regcache.h, riscv-fbsd-tdep.c, riscv-linux-tdep.c, rust-exp.y, sh-linux-tdep.c, sh-nbsd-tdep.c, source-cache.c, sparc-nbsd-tdep.c, sparc-obsd-tdep.c, sparc-ravenscar-thread.c, sparc64-fbsd-tdep.c, std-regs.c, target-descriptions.h, target-float.c, tic6x-linux-tdep.c, tilegx-linux-tdep.c, top.c, tracefile.c, trad-frame.c, type-stack.h, ui-style.c, utils.c, utils.h, valarith.c, valprint.c, varobj.c, x86-tdep.c, xml-support.h, xtensa-linux-tdep.c, cli/cli-cmds.h: Update. * s390-linux-nat.c, procfs.c, inf-ptrace.c: Likewise.
2019-06-10 05:21:02 +08:00
#include "gdbarch.h"
/* These macros are the values of the first argument of system call
"sys_ptrace". The values of these macros were obtained from Linux
Kernel source. */
#define RECORD_PTRACE_PEEKTEXT 1
#define RECORD_PTRACE_PEEKDATA 2
#define RECORD_PTRACE_PEEKUSR 3
/* These macros are the values of the first argument of system call
"sys_socketcall". The values of these macros were obtained from
Linux Kernel source. */
#define RECORD_SYS_SOCKET 1
#define RECORD_SYS_BIND 2
#define RECORD_SYS_CONNECT 3
#define RECORD_SYS_LISTEN 4
#define RECORD_SYS_ACCEPT 5
#define RECORD_SYS_GETSOCKNAME 6
#define RECORD_SYS_GETPEERNAME 7
#define RECORD_SYS_SOCKETPAIR 8
#define RECORD_SYS_SEND 9
#define RECORD_SYS_RECV 10
#define RECORD_SYS_SENDTO 11
#define RECORD_SYS_RECVFROM 12
#define RECORD_SYS_SHUTDOWN 13
#define RECORD_SYS_SETSOCKOPT 14
#define RECORD_SYS_GETSOCKOPT 15
#define RECORD_SYS_SENDMSG 16
#define RECORD_SYS_RECVMSG 17
/* These macros are the values of the first argument of system call
"sys_ipc". The values of these macros were obtained from Linux
Kernel source. */
#define RECORD_SEMOP 1
#define RECORD_SEMGET 2
#define RECORD_SEMCTL 3
#define RECORD_SEMTIMEDOP 4
#define RECORD_MSGSND 11
#define RECORD_MSGRCV 12
#define RECORD_MSGGET 13
#define RECORD_MSGCTL 14
#define RECORD_SHMAT 21
#define RECORD_SHMDT 22
#define RECORD_SHMGET 23
#define RECORD_SHMCTL 24
/* These macros are the values of the first argument of system call
"sys_quotactl". The values of these macros were obtained from Linux
Kernel source. */
#define RECORD_Q_GETFMT 0x800004
#define RECORD_Q_GETINFO 0x800005
#define RECORD_Q_GETQUOTA 0x800007
#define RECORD_Q_XGETQSTAT (('5' << 8) + 5)
#define RECORD_Q_XGETQUOTA (('3' << 8) + 3)
#define OUTPUT_REG(val, num) phex_nz ((val), \
gdbarch_register_type (regcache->arch (), (num))->length ())
/* Record a memory area of length LEN pointed to by register
REGNUM. */
static int
record_mem_at_reg (struct regcache *regcache, int regnum, int len)
{
ULONGEST addr;
regcache_raw_read_unsigned (regcache, regnum, &addr);
return record_full_arch_list_add_mem ((CORE_ADDR) addr, len);
}
static int
record_linux_sockaddr (struct regcache *regcache,
struct linux_record_tdep *tdep, ULONGEST addr,
ULONGEST len)
{
gdb_byte *a;
int addrlen;
s/get_regcache_arch (regcache)/regcache->arch ()/g This patches removes get_regcache_arch, and use regache->arch () instead. The motivation of this change is that I am going to move some basic stuff into a base class of regcache. I don't need to update "client" code regcache->arch (). On the other hand, this patch shortens the code a little bit. gdb: 2017-10-25 Yao Qi <yao.qi@linaro.org> * aarch32-linux-nat.c (aarch32_gp_regcache_supply): Use regcache->arch () instead get_regcache_arch. * aarch64-fbsd-nat.c (aarch64_fbsd_fetch_inferior_registers): Likewise. (aarch64_fbsd_store_inferior_registers): Likewise. * aarch64-linux-nat.c (fetch_gregs_from_thread): Likewise. (store_gregs_to_thread): Likewise. (fetch_fpregs_from_thread): Likewise. (store_fpregs_to_thread): Likewise. * aarch64-tdep.c (aarch64_extract_return_value): Likewise. (aarch64_store_return_value): Likewise. (aarch64_software_single_step): Likewise. * aix-thread.c (aix_thread_wait): Likewise. (supply_reg32): Likewise. (supply_sprs64): Likewise. (supply_sprs32): Likewise. (fill_gprs64): Likewise. (fill_gprs32): Likewise. (fill_sprs64): Likewise. (fill_sprs32): Likewise. (store_regs_user_thread): Likewise. (store_regs_kernel_thread): Likewise. * alpha-bsd-nat.c (alphabsd_fetch_inferior_registers): Likewise. (alphabsd_store_inferior_registers): Likewise. * alpha-tdep.c (alpha_extract_return_value): Likewise. (alpha_store_return_value): Likewise. (alpha_deal_with_atomic_sequence): Likewise. (alpha_next_pc): Likewise. (alpha_software_single_step): Likewise. * amd64-bsd-nat.c (amd64bsd_fetch_inferior_registers): Likewise. (amd64bsd_store_inferior_registers): Likewise. * amd64-linux-nat.c (amd64_linux_fetch_inferior_registers): Likewise. (amd64_linux_store_inferior_registers): Likewise. * amd64-nat.c (amd64_supply_native_gregset): Likewise. (amd64_collect_native_gregset): Likewise. * amd64-obsd-tdep.c (amd64obsd_supply_uthread): Likewise. (amd64obsd_collect_uthread): Likewise. * amd64-tdep.c (amd64_supply_fpregset): Likewise. (amd64_collect_fpregset): Likewise. (amd64_supply_fxsave): Likewise. (amd64_supply_xsave): Likewise. (amd64_collect_fxsave): Likewise. (amd64_collect_xsave): Likewise. * arc-tdep.c (arc_write_pc): Likewise. * arch-utils.c (default_skip_permanent_breakpoint): Likewise. * arm-fbsd-nat.c (arm_fbsd_fetch_inferior_registers): Likewise. (arm_fbsd_store_inferior_registers): Likewise. * arm-linux-nat.c (fetch_vfp_regs): Likewise. (store_vfp_regs): Likewise. (arm_linux_fetch_inferior_registers): Likewise. (arm_linux_store_inferior_registers): Likewise. * arm-linux-tdep.c (arm_linux_supply_gregset): Likewise. (arm_linux_sigreturn_next_pc): Likewise. (arm_linux_get_next_pcs_syscall_next_pc): Likewise. * arm-nbsd-nat.c (arm_supply_gregset): Likewise. (fetch_register): Likewise. (store_register): Likewise. * arm-tdep.c (arm_is_thumb): Likewise. (displaced_in_arm_mode): Likewise. (bx_write_pc): Likewise. (arm_get_next_pcs_addr_bits_remove): Likewise. (arm_software_single_step): Likewise. (arm_extract_return_value): Likewise. (arm_store_return_value): Likewise. (arm_write_pc): Likewise. * bfin-tdep.c (bfin_extract_return_value): Likewise. * bsd-uthread.c (bsd_uthread_fetch_registers): Likewise. (bsd_uthread_store_registers): Likewise. * core-regset.c (fetch_core_registers): Likewise. * corelow.c (get_core_registers): Likewise. * cris-tdep.c (cris_store_return_value): Likewise. (cris_extract_return_value): Likewise. (find_step_target): Likewise. (find_step_target): Likewise. (cris_software_single_step): Likewise. * ctf.c (ctf_fetch_registers): Likewise. * darwin-nat.c (cancel_breakpoint): Likewise. * fbsd-tdep.c (fbsd_collect_thread_registers): Likewise. * frv-tdep.c (frv_extract_return_value): Likewise. * ft32-tdep.c (ft32_store_return_value): Likewise. (ft32_extract_return_value): Likewise. * go32-nat.c (fetch_register): Likewise. (go32_fetch_registers): Likewise. (go32_store_registers): Likewise. (store_register): Likewise. * h8300-tdep.c (h8300_extract_return_value): Likewise. (h8300_store_return_value): Likewise. * hppa-linux-nat.c (fetch_register): Likewise. (store_register): Likewise. (hppa_linux_fetch_inferior_registers): Likewise. (hppa_linux_store_inferior_registers): Likewise. * i386-darwin-nat.c (i386_darwin_fetch_inferior_registers): Likewise. (i386_darwin_store_inferior_registers): Likewise. * i386-gnu-nat.c (gnu_fetch_registers): Likewise. (gnu_store_registers): Likewise. * i386-linux-nat.c (fetch_register): Likewise. (store_register): Likewise. (supply_gregset): Likewise. (fill_gregset): Likewise. (i386_linux_fetch_inferior_registers): Likewise. (i386_linux_store_inferior_registers): Likewise. (i386_linux_resume): Likewise. * i386-linux-tdep.c (i386_linux_get_syscall_number_from_regcache): Likewise. * i386-nto-tdep.c (i386nto_supply_gregset): Likewise. * i386-obsd-nat.c (i386obsd_supply_pcb): Likewise. * i386-obsd-tdep.c (i386obsd_supply_uthread): Likewise. (i386obsd_collect_uthread): Likewise. * i386-tdep.c (i386_mmx_regnum_to_fp_regnum): Likewise. (i386_supply_gregset): Likewise. (i386_collect_gregset): Likewise. (i386_supply_fpregset): Likewise. (i386_collect_fpregset): Likewise. (i386_mpx_bd_base): Likewise. * i386-v4-nat.c (supply_fpregset): Likewise. (fill_fpregset): Likewise. * i387-tdep.c (i387_supply_fsave): Likewise. (i387_collect_fsave): Likewise. (i387_supply_fxsave): Likewise. (i387_collect_fxsave): Likewise. (i387_supply_xsave): Likewise. (i387_collect_xsave): Likewise. * ia64-linux-nat.c (ia64_linux_fetch_registers): Likewise. (ia64_linux_store_registers): Likewise. * ia64-tdep.c (ia64_access_rse_reg): Likewise. (ia64_extract_return_value): Likewise. (ia64_store_return_value): Likewise. (find_func_descr): Likewise. * inf-child.c (inf_child_fetch_inferior_registers): Likewise. * inf-ptrace.c (inf_ptrace_fetch_registers): Likewise. (inf_ptrace_store_registers): Likewise. * infrun.c (use_displaced_stepping): Likewise. (displaced_step_prepare_throw): Likewise. (resume): Likewise. (proceed): Likewise. (do_target_wait): Likewise. (adjust_pc_after_break): Likewise. (handle_inferior_event_1): Likewise. (handle_signal_stop): Likewise. (save_infcall_suspend_state): Likewise. (restore_infcall_suspend_state): Likewise. * iq2000-tdep.c (iq2000_extract_return_value): Likewise. * jit.c (jit_frame_prev_register): Likewise. * linux-nat.c (save_stop_reason): Likewise. (linux_nat_wait_1): Likewise. (resume_stopped_resumed_lwps): Likewise. * linux-record.c (record_linux_sockaddr): Likewise. (record_linux_msghdr): Likewise. (record_linux_system_call): Likewise. * linux-tdep.c (linux_collect_thread_registers): Likewise. * lm32-tdep.c (lm32_extract_return_value): Likewise. (lm32_store_return_value): Likewise. * m32c-tdep.c (m32c_read_flg): Likewise. (m32c_pseudo_register_read): Likewise. (m32c_pseudo_register_write): Likewise. * m32r-linux-tdep.c (m32r_linux_supply_gregset): Likewise. (m32r_linux_collect_gregset): Likewise. * m32r-tdep.c (m32r_store_return_value): Likewise. (m32r_extract_return_value): Likewise. * m68k-bsd-nat.c (m68kbsd_supply_fpregset): Likewise. (m68kbsd_collect_fpregset): Likewise. * m68k-bsd-tdep.c (m68kbsd_supply_fpregset): Likewise. * m68k-linux-nat.c (fetch_register): Likewise. (old_fetch_inferior_registers): Likewise. (old_store_inferior_registers): Likewise. (store_regs): Likewise. * m68k-tdep.c (m68k_svr4_extract_return_value): Likewise. (m68k_svr4_store_return_value): Likewise. * m88k-tdep.c (m88k_store_arguments): Likewise. * mi/mi-main.c (mi_cmd_data_list_changed_registers): Likewise. (mi_cmd_data_write_register_values): Likewise. * mips-fbsd-nat.c (mips_fbsd_fetch_inferior_registers): Likewise. (mips_fbsd_store_inferior_registers): Likewise. * mips-fbsd-tdep.c (mips_fbsd_supply_fpregs): Likewise. (mips_fbsd_supply_gregs): Likewise. (mips_fbsd_collect_fpregs): Likewise. (mips_fbsd_collect_gregs): Likewise. (mips_fbsd_supply_fpregset): Likewise. (mips_fbsd_collect_fpregset): Likewise. (mips_fbsd_supply_gregset): Likewise. (mips_fbsd_collect_gregset): Likewise. * mips-linux-nat.c (supply_gregset): Likewise. (fill_gregset): Likewise. (supply_fpregset): Likewise. (fill_fpregset): Likewise. * mips-linux-tdep.c (mips_supply_gregset): Likewise. (mips_fill_gregset): Likewise. (mips_supply_fpregset): Likewise. (mips_fill_fpregset): Likewise. (mips64_supply_gregset): Likewise. (micromips_linux_sigframe_validate): Likewise. * mips-nbsd-nat.c (mipsnbsd_fetch_inferior_registers): Likewise. (mipsnbsd_fetch_inferior_registers): Likewise. (mipsnbsd_store_inferior_registers): Likewise. * mips-nbsd-tdep.c (mipsnbsd_supply_fpregset): Likewise. (mipsnbsd_supply_gregset): Likewise. (mipsnbsd_iterate_over_regset_sections): Likewise. (mipsnbsd_supply_reg): Likewise. (mipsnbsd_supply_fpreg): Likewise. * mips-tdep.c (mips_in_frame_stub): Likewise. (mips_dummy_id): Likewise. (is_octeon_bbit_op): Likewise. (micromips_bc1_pc): Likewise. (extended_mips16_next_pc): Likewise. (mips16_next_pc): Likewise. (deal_with_atomic_sequence): Likewise. * moxie-tdep.c (moxie_process_readu): Likewise. * nios2-tdep.c (nios2_get_next_pc): Likewise. * nto-procfs.c (procfs_store_registers): Likewise. * ppc-fbsd-nat.c (ppcfbsd_fetch_inferior_registers): Likewise. (ppcfbsd_store_inferior_registers): Likewise. * ppc-linux-nat.c (fetch_vsx_register): Likewise. (fetch_altivec_register): Likewise. (get_spe_registers): Likewise. (fetch_spe_register): Likewise. (fetch_altivec_registers): Likewise. (fetch_all_gp_regs): Likewise. (fetch_all_fp_regs): Likewise. (store_vsx_register): Likewise. (store_altivec_register): Likewise. (set_spe_registers): Likewise. (store_spe_register): Likewise. (store_altivec_registers): Likewise. (store_all_gp_regs): Likewise. (store_all_fp_regs): Likewise. * ppc-linux-tdep.c (ppc_linux_supply_gregset): Likewise. (ppc_linux_collect_gregset): Likewise. (ppc_canonicalize_syscall): Likewise. (ppc_linux_record_signal): Likewise. (ppu2spu_prev_register): Likewise. * ppc-nbsd-nat.c (ppcnbsd_supply_pcb): Likewise. * ppc-obsd-nat.c (ppcobsd_fetch_registers): Likewise. (ppcobsd_store_registers): Likewise. * ppc-ravenscar-thread.c (ppc_ravenscar_generic_fetch_registers): Likewise. (ppc_ravenscar_generic_store_registers): Likewise. * procfs.c (procfs_fetch_registers): Likewise. (procfs_store_registers): Likewise. * ravenscar-thread.c (ravenscar_fetch_registers): Likewise. (ravenscar_store_registers): Likewise. (ravenscar_prepare_to_store): Likewise. * record-btrace.c (record_btrace_fetch_registers): Likewise. * record-full.c (record_full_wait_1): Likewise. (record_full_registers_change): Likewise. (record_full_store_registers): Likewise. (record_full_core_fetch_registers): Likewise. (record_full_save): Likewise. (record_full_goto_insn): Likewise. * regcache.c (regcache_register_size): Likewise. (get_regcache_arch): Remove. (regcache_read_pc): Likewise. * regcache.h (get_regcache_arch): Remove. * remote-sim.c (gdbsim_fetch_register): Likewise. (gdbsim_store_register): Likewise. * remote.c (fetch_register_using_p): Likewise. (send_g_packet): Likewise. (remote_prepare_to_store): Likewise. (store_registers_using_G): Likewise. * reverse.c (save_bookmark_command): Likewise. (goto_bookmark_command): Likewise. * rs6000-aix-tdep.c (branch_dest): Likewise. * rs6000-nat.c (rs6000_ptrace64): Likewise. (fetch_register): Likewise. * rs6000-tdep.c (ppc_supply_reg): Likewise. (ppc_collect_reg): Likewise. (ppc_collect_gregset): Likewise. (ppc_collect_fpregset): Likewise. (ppc_collect_vsxregset): Likewise. (ppc_collect_vrregset): Likewise. (ppc_displaced_step_hw_singlestep): Likewise. (rs6000_pseudo_register_read): Likewise. (rs6000_pseudo_register_write): Likewise. * s390-linux-nat.c (supply_gregset): Likewise. (fill_gregset): Likewise. (s390_linux_fetch_inferior_registers): Likewise. * s390-linux-tdep.c (s390_write_pc): Likewise. (s390_software_single_step): Likewise. (s390_all_but_pc_registers_record): Likewise. (s390_linux_syscall_record): Likewise. * sentinel-frame.c (sentinel_frame_prev_arch): Likewise. * sh-nbsd-nat.c (shnbsd_fetch_inferior_registers): Likewise. (shnbsd_store_inferior_registers): Likewise. * sh-tdep.c (sh_extract_return_value_nofpu): Likewise. (sh_extract_return_value_fpu): Likewise. (sh_store_return_value_nofpu): Likewise. (sh_corefile_supply_regset): Likewise. (sh_corefile_collect_regset): Likewise. * sh64-tdep.c (sh64_extract_return_value): Likewise. (sh64_store_return_value): Likewise. * sparc-linux-tdep.c (sparc32_linux_collect_core_fpregset): Likewise. * sparc-nat.c (sparc_fetch_inferior_registers): Likewise. (sparc_store_inferior_registers): Likewise. * sparc-ravenscar-thread.c (register_in_thread_descriptor_p): Likewise. (sparc_ravenscar_prepare_to_store): Likewise. * sparc-tdep.c (sparc32_store_arguments): Likewise. (sparc_analyze_control_transfer): Likewise. (sparc_step_trap): Likewise. (sparc_software_single_step): Likewise. (sparc32_gdbarch_init): Likewise. (sparc_supply_rwindow): Likewise. (sparc_collect_rwindow): Likewise. * sparc64-linux-tdep.c (sparc64_linux_collect_core_fpregset): Likewise. * sparc64-nbsd-nat.c (sparc64nbsd_supply_gregset): Likewise. (sparc64nbsd_collect_gregset): Likewise. (sparc64nbsd_supply_fpregset): Likewise. (sparc64nbsd_collect_fpregset): Likewise. * sparc64-tdep.c (sparc64_store_arguments): Likewise. (sparc64_supply_gregset): Likewise. (sparc64_collect_gregset): Likewise. (sparc64_supply_fpregset): Likewise. (sparc64_collect_fpregset): Likewise. * spu-linux-nat.c (spu_fetch_inferior_registers): Likewise. * spu-tdep.c (spu_unwind_sp): Likewise. (spu2ppu_prev_register): Likewise. (spu_memory_remove_breakpoint): Likewise. * stack.c (return_command): Likewise. * tic6x-tdep.c (tic6x_extract_signed_field): Likewise. * tracefile-tfile.c (tfile_fetch_registers): Likewise. * tracefile.c (trace_save_ctf): Likewise. * windows-nat.c (do_windows_fetch_inferior_registers): Likewise. (do_windows_store_inferior_registers): Likewise. (windows_resume): Likewise. * xtensa-linux-nat.c (fill_gregset): Likewise. (supply_gregset_reg): Likewise. * xtensa-tdep.c (xtensa_register_write_masked): Likewise. (xtensa_register_read_masked): Likewise. (xtensa_supply_gregset): Likewise. (xtensa_extract_return_value): Likewise. (xtensa_store_return_value): Likewise.
2017-10-25 23:37:03 +08:00
struct gdbarch *gdbarch = regcache->arch ();
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
if (!addr)
return 0;
Add casts to memory allocation related calls Most allocation functions (if not all) return a void* pointing to the allocated memory. In C++, we need to add an explicit cast when assigning the result to a pointer to another type (which is the case more often than not). The content of this patch is taken from Pedro's branch, from commit "(mostly) auto-generated patch to insert casts needed for C++". I validated that the changes make sense and manually reflowed the code to make it respect the coding style. I also found multiple places where I could use XNEW/XNEWVEC/XRESIZEVEC/etc. Thanks a lot to whoever did that automated script to insert casts, doing it completely by hand would have taken a ridiculous amount of time. Only files built on x86 with --enable-targets=all are modified. This means that all other -nat.c files are untouched and will have to be dealt with later by using appropiate compilers. Or maybe we can try to build them with a regular g++ just to know where to add casts, I don't know. I built-tested this with --enable-targets=all and reg-tested. Here's the changelog entry, which was not too bad to make despite the size, thanks to David Malcom's script. I fixed some bits by hand, but there might be some wrong parts left (hopefully not). gdb/ChangeLog: * aarch64-linux-tdep.c (aarch64_stap_parse_special_token): Add cast to allocation result assignment. * ada-exp.y (write_object_renaming): Likewise. (write_ambiguous_var): Likewise. (ada_nget_field_index): Likewise. (write_var_or_type): Likewise. * ada-lang.c (ada_decode_symbol): Likewise. (ada_value_assign): Likewise. (value_pointer): Likewise. (cache_symbol): Likewise. (add_nonlocal_symbols): Likewise. (ada_name_for_lookup): Likewise. (symbol_completion_add): Likewise. (ada_to_fixed_type_1): Likewise. (ada_get_next_arg): Likewise. (defns_collected): Likewise. * ada-lex.l (processId): Likewise. (processString): Likewise. * ada-tasks.c (read_known_tasks_array): Likewise. (read_known_tasks_list): Likewise. * ada-typeprint.c (decoded_type_name): Likewise. * addrmap.c (addrmap_mutable_create_fixed): Likewise. * amd64-tdep.c (amd64_push_arguments): Likewise. (amd64_displaced_step_copy_insn): Likewise. (amd64_classify_insn_at): Likewise. (amd64_relocate_instruction): Likewise. * amd64obsd-tdep.c (amd64obsd_sigtramp_p): Likewise. * arch-utils.c (simple_displaced_step_copy_insn): Likewise. (initialize_current_architecture): Likewise. * arm-linux-tdep.c (arm_stap_parse_special_token): Likewise. * arm-symbian-tdep.c (arm_symbian_osabi_sniffer): Likewise. * arm-tdep.c (arm_exidx_new_objfile): Likewise. (arm_push_dummy_call): Likewise. (extend_buffer_earlier): Likewise. (arm_adjust_breakpoint_address): Likewise. (arm_skip_stub): Likewise. * auto-load.c (filename_is_in_pattern): Likewise. (maybe_add_script_file): Likewise. (maybe_add_script_text): Likewise. (auto_load_objfile_script_1): Likewise. * auxv.c (ld_so_xfer_auxv): Likewise. * ax-general.c (new_agent_expr): Likewise. (grow_expr): Likewise. (ax_reg_mask): Likewise. * bcache.c (bcache_full): Likewise. * breakpoint.c (program_breakpoint_here_p): Likewise. * btrace.c (parse_xml_raw): Likewise. * build-id.c (build_id_to_debug_bfd): Likewise. * buildsym.c (end_symtab_with_blockvector): Likewise. * c-exp.y (string_exp): Likewise. (qualified_name): Likewise. (write_destructor_name): Likewise. (operator_stoken): Likewise. (parse_number): Likewise. (scan_macro_expansion): Likewise. (yylex): Likewise. (c_print_token): Likewise. * c-lang.c (c_get_string): Likewise. (emit_numeric_character): Likewise. * charset.c (wchar_iterate): Likewise. * cli/cli-cmds.c (complete_command): Likewise. (make_command): Likewise. * cli/cli-dump.c (restore_section_callback): Likewise. (restore_binary_file): Likewise. * cli/cli-interp.c (cli_interpreter_exec): Likewise. * cli/cli-script.c (execute_control_command): Likewise. * cli/cli-setshow.c (do_set_command): Likewise. * coff-pe-read.c (add_pe_forwarded_sym): Likewise. (read_pe_exported_syms): Likewise. * coffread.c (coff_read_struct_type): Likewise. (coff_read_enum_type): Likewise. * common/btrace-common.c (btrace_data_append): Likewise. * common/buffer.c (buffer_grow): Likewise. * common/filestuff.c (gdb_fopen_cloexec): Likewise. * common/format.c (parse_format_string): Likewise. * common/gdb_vecs.c (delim_string_to_char_ptr_vec_append): Likewise. * common/xml-utils.c (xml_escape_text): Likewise. * compile/compile-object-load.c (copy_sections): Likewise. (compile_object_load): Likewise. * compile/compile-object-run.c (compile_object_run): Likewise. * completer.c (filename_completer): Likewise. * corefile.c (read_memory_typed_address): Likewise. (write_memory_unsigned_integer): Likewise. (write_memory_signed_integer): Likewise. (complete_set_gnutarget): Likewise. * corelow.c (get_core_register_section): Likewise. * cp-name-parser.y (d_grab): Likewise. (allocate_info): Likewise. (cp_new_demangle_parse_info): Likewise. * cp-namespace.c (cp_scan_for_anonymous_namespaces): Likewise. (cp_lookup_symbol_in_namespace): Likewise. (lookup_namespace_scope): Likewise. (find_symbol_in_baseclass): Likewise. (cp_lookup_nested_symbol): Likewise. (cp_lookup_transparent_type_loop): Likewise. * cp-support.c (copy_string_to_obstack): Likewise. (make_symbol_overload_list): Likewise. (make_symbol_overload_list_namespace): Likewise. (make_symbol_overload_list_adl_namespace): Likewise. (first_component_command): Likewise. * cp-valprint.c (cp_print_value): Likewise. * ctf.c (ctf_xfer_partial): Likewise. * d-exp.y (StringExp): Likewise. * d-namespace.c (d_lookup_symbol_in_module): Likewise. (lookup_module_scope): Likewise. (find_symbol_in_baseclass): Likewise. (d_lookup_nested_symbol): Likewise. * dbxread.c (find_stab_function_addr): Likewise. (read_dbx_symtab): Likewise. (dbx_end_psymtab): Likewise. (cp_set_block_scope): Likewise. * dcache.c (dcache_alloc): Likewise. * demangle.c (_initialize_demangler): Likewise. * dicos-tdep.c (dicos_load_module_p): Likewise. * dictionary.c (dict_create_hashed_expandable): Likewise. (dict_create_linear_expandable): Likewise. (expand_hashtable): Likewise. (add_symbol_linear_expandable): Likewise. * dwarf2-frame.c (add_cie): Likewise. (add_fde): Likewise. (dwarf2_build_frame_info): Likewise. * dwarf2expr.c (dwarf_expr_grow_stack): Likewise. (dwarf_expr_fetch_address): Likewise. (add_piece): Likewise. (execute_stack_op): Likewise. * dwarf2loc.c (chain_candidate): Likewise. (dwarf_entry_parameter_to_value): Likewise. (read_pieced_value): Likewise. (write_pieced_value): Likewise. * dwarf2read.c (dwarf2_read_section): Likewise. (add_type_unit): Likewise. (read_comp_units_from_section): Likewise. (fixup_go_packaging): Likewise. (dwarf2_compute_name): Likewise. (dwarf2_physname): Likewise. (create_dwo_unit_in_dwp_v1): Likewise. (create_dwo_unit_in_dwp_v2): Likewise. (read_func_scope): Likewise. (read_call_site_scope): Likewise. (dwarf2_attach_fields_to_type): Likewise. (process_structure_scope): Likewise. (mark_common_block_symbol_computed): Likewise. (read_common_block): Likewise. (abbrev_table_read_table): Likewise. (guess_partial_die_structure_name): Likewise. (fixup_partial_die): Likewise. (add_file_name): Likewise. (dwarf2_const_value_data): Likewise. (dwarf2_const_value_attr): Likewise. (build_error_marker_type): Likewise. (guess_full_die_structure_name): Likewise. (anonymous_struct_prefix): Likewise. (typename_concat): Likewise. (dwarf2_canonicalize_name): Likewise. (dwarf2_name): Likewise. (write_constant_as_bytes): Likewise. (dwarf2_fetch_constant_bytes): Likewise. (copy_string): Likewise. (parse_macro_definition): Likewise. * elfread.c (elf_symfile_segments): Likewise. (elf_rel_plt_read): Likewise. (elf_gnu_ifunc_resolve_by_cache): Likewise. (elf_gnu_ifunc_resolve_by_got): Likewise. (elf_read_minimal_symbols): Likewise. (elf_gnu_ifunc_record_cache): Likewise. * event-top.c (top_level_prompt): Likewise. (command_line_handler): Likewise. * exec.c (resize_section_table): Likewise. * expprint.c (print_subexp_standard): Likewise. * fbsd-tdep.c (fbsd_collect_regset_section_cb): Likewise. * findcmd.c (parse_find_args): Likewise. * findvar.c (address_from_register): Likewise. * frame.c (get_prev_frame_always): Likewise. * gdb_bfd.c (gdb_bfd_ref): Likewise. (get_section_descriptor): Likewise. * gdb_obstack.c (obconcat): Likewise. (obstack_strdup): Likewise. * gdbtypes.c (lookup_function_type_with_arguments): Likewise. (create_set_type): Likewise. (lookup_unsigned_typename): Likewise. (lookup_signed_typename): Likewise. (resolve_dynamic_union): Likewise. (resolve_dynamic_struct): Likewise. (add_dyn_prop): Likewise. (copy_dynamic_prop_list): Likewise. (arch_flags_type): Likewise. (append_composite_type_field_raw): Likewise. * gdbtypes.h (INIT_FUNC_SPECIFIC): Likewise. * gnu-v3-abi.c (gnuv3_rtti_type): Likewise. * go-exp.y (string_exp): Likewise. * go-lang.c (go_demangle): Likewise. * guile/guile.c (compute_scheme_string): Likewise. * guile/scm-cmd.c (gdbscm_parse_command_name): Likewise. (gdbscm_canonicalize_command_name): Likewise. * guile/scm-ports.c (ioscm_init_stdio_buffers): Likewise. (ioscm_init_memory_port): Likewise. (ioscm_reinit_memory_port): Likewise. * guile/scm-utils.c (gdbscm_gc_xstrdup): Likewise. (gdbscm_gc_dup_argv): Likewise. * h8300-tdep.c (h8300_push_dummy_call): Likewise. * hppa-tdep.c (internalize_unwinds): Likewise. (read_unwind_info): Likewise. * i386-cygwin-tdep.c (core_process_module_section): Likewise. (windows_core_xfer_shared_libraries): Likewise. * i386-tdep.c (i386_displaced_step_copy_insn): Likewise. (i386_stap_parse_special_token_triplet): Likewise. (i386_stap_parse_special_token_three_arg_disp): Likewise. * i386obsd-tdep.c (i386obsd_sigtramp_p): Likewise. * inf-child.c (inf_child_fileio_readlink): Likewise. * inf-ptrace.c (inf_ptrace_fetch_register): Likewise. (inf_ptrace_store_register): Likewise. * infrun.c (follow_exec): Likewise. (displaced_step_prepare_throw): Likewise. (save_stop_context): Likewise. (save_infcall_suspend_state): Likewise. * jit.c (jit_read_descriptor): Likewise. (jit_read_code_entry): Likewise. (jit_symtab_line_mapping_add_impl): Likewise. (finalize_symtab): Likewise. (jit_unwind_reg_get_impl): Likewise. * jv-exp.y (QualifiedName): Likewise. * jv-lang.c (get_java_utf8_name): Likewise. (type_from_class): Likewise. (java_demangle_type_signature): Likewise. (java_class_name_from_physname): Likewise. * jv-typeprint.c (java_type_print_base): Likewise. * jv-valprint.c (java_value_print): Likewise. * language.c (add_language): Likewise. * linespec.c (add_sal_to_sals_basic): Likewise. (add_sal_to_sals): Likewise. (decode_objc): Likewise. (find_linespec_symbols): Likewise. * linux-fork.c (fork_save_infrun_state): Likewise. * linux-nat.c (linux_nat_detach): Likewise. (linux_nat_fileio_readlink): Likewise. * linux-record.c (record_linux_sockaddr): Likewise. (record_linux_msghdr): Likewise. (Do): Likewise. * linux-tdep.c (linux_core_info_proc_mappings): Likewise. (linux_collect_regset_section_cb): Likewise. (linux_get_siginfo_data): Likewise. * linux-thread-db.c (try_thread_db_load_from_pdir_1): Likewise. (try_thread_db_load_from_dir): Likewise. (thread_db_load_search): Likewise. (info_auto_load_libthread_db): Likewise. * m32c-tdep.c (m32c_m16c_address_to_pointer): Likewise. (m32c_m16c_pointer_to_address): Likewise. * m68hc11-tdep.c (m68hc11_pseudo_register_write): Likewise. * m68k-tdep.c (m68k_get_longjmp_target): Likewise. * machoread.c (macho_check_dsym): Likewise. * macroexp.c (resize_buffer): Likewise. (gather_arguments): Likewise. (maybe_expand): Likewise. * macrotab.c (new_macro_key): Likewise. (new_source_file): Likewise. (new_macro_definition): Likewise. * mdebugread.c (parse_symbol): Likewise. (parse_type): Likewise. (parse_partial_symbols): Likewise. (psymtab_to_symtab_1): Likewise. * mem-break.c (default_memory_insert_breakpoint): Likewise. * mi/mi-cmd-break.c (mi_argv_to_format): Likewise. * mi/mi-main.c (mi_cmd_data_read_memory): Likewise. (mi_cmd_data_read_memory_bytes): Likewise. (mi_cmd_data_write_memory_bytes): Likewise. (mi_cmd_trace_frame_collected): Likewise. * mi/mi-parse.c (mi_parse_argv): Likewise. (mi_parse): Likewise. * minidebug.c (lzma_open): Likewise. (lzma_pread): Likewise. * mips-tdep.c (mips_read_fp_register_single): Likewise. (mips_print_fp_register): Likewise. * mipsnbsd-tdep.c (mipsnbsd_get_longjmp_target): Likewise. * mipsread.c (read_alphacoff_dynamic_symtab): Likewise. * mt-tdep.c (mt_register_name): Likewise. (mt_registers_info): Likewise. (mt_push_dummy_call): Likewise. * namespace.c (add_using_directive): Likewise. * nat/linux-btrace.c (perf_event_read): Likewise. (linux_enable_bts): Likewise. * nat/linux-osdata.c (linux_common_core_of_thread): Likewise. * nat/linux-ptrace.c (linux_ptrace_test_ret_to_nx): Likewise. * nto-tdep.c (nto_find_and_open_solib): Likewise. (nto_parse_redirection): Likewise. * objc-lang.c (objc_demangle): Likewise. (find_methods): Likewise. * objfiles.c (get_objfile_bfd_data): Likewise. (set_objfile_main_name): Likewise. (allocate_objfile): Likewise. (objfile_relocate): Likewise. (update_section_map): Likewise. * osabi.c (generic_elf_osabi_sniff_abi_tag_sections): Likewise. * p-exp.y (exp): Likewise. (yylex): Likewise. * p-valprint.c (pascal_object_print_value): Likewise. * parse.c (initialize_expout): Likewise. (mark_completion_tag): Likewise. (copy_name): Likewise. (parse_float): Likewise. (type_stack_reserve): Likewise. * ppc-linux-tdep.c (ppc_stap_parse_special_token): Likewise. (ppu2spu_prev_register): Likewise. * ppc-ravenscar-thread.c (supply_register_at_address): Likewise. * printcmd.c (printf_wide_c_string): Likewise. (printf_pointer): Likewise. * probe.c (parse_probes): Likewise. * python/py-cmd.c (gdbpy_parse_command_name): Likewise. (cmdpy_init): Likewise. * python/py-gdb-readline.c (gdbpy_readline_wrapper): Likewise. * python/py-symtab.c (set_sal): Likewise. * python/py-unwind.c (pyuw_sniffer): Likewise. * python/python.c (python_interactive_command): Likewise. (compute_python_string): Likewise. * ravenscar-thread.c (get_running_thread_id): Likewise. * record-full.c (record_full_exec_insn): Likewise. (record_full_core_open_1): Likewise. * regcache.c (regcache_raw_read_signed): Likewise. (regcache_raw_read_unsigned): Likewise. (regcache_cooked_read_signed): Likewise. (regcache_cooked_read_unsigned): Likewise. * remote-fileio.c (remote_fileio_func_open): Likewise. (remote_fileio_func_rename): Likewise. (remote_fileio_func_unlink): Likewise. (remote_fileio_func_stat): Likewise. (remote_fileio_func_system): Likewise. * remote-mips.c (mips_xfer_memory): Likewise. (mips_load_srec): Likewise. (pmon_end_download): Likewise. * remote.c (new_remote_state): Likewise. (map_regcache_remote_table): Likewise. (remote_register_number_and_offset): Likewise. (init_remote_state): Likewise. (get_memory_packet_size): Likewise. (remote_pass_signals): Likewise. (remote_program_signals): Likewise. (remote_start_remote): Likewise. (remote_check_symbols): Likewise. (remote_query_supported): Likewise. (extended_remote_attach): Likewise. (process_g_packet): Likewise. (store_registers_using_G): Likewise. (putpkt_binary): Likewise. (read_frame): Likewise. (compare_sections_command): Likewise. (remote_hostio_pread): Likewise. (remote_hostio_readlink): Likewise. (remote_file_put): Likewise. (remote_file_get): Likewise. (remote_pid_to_exec_file): Likewise. (_initialize_remote): Likewise. * rs6000-aix-tdep.c (rs6000_aix_ld_info_to_xml): Likewise. (rs6000_aix_core_xfer_shared_libraries_aix): Likewise. * rs6000-tdep.c (ppc_displaced_step_copy_insn): Likewise. (bfd_uses_spe_extensions): Likewise. * s390-linux-tdep.c (s390_displaced_step_copy_insn): Likewise. * score-tdep.c (score7_malloc_and_get_memblock): Likewise. * solib-dsbt.c (decode_loadmap): Likewise. (fetch_loadmap): Likewise. (scan_dyntag): Likewise. (enable_break): Likewise. (dsbt_relocate_main_executable): Likewise. * solib-frv.c (fetch_loadmap): Likewise. (enable_break2): Likewise. (frv_relocate_main_executable): Likewise. * solib-spu.c (spu_relocate_main_executable): Likewise. (spu_bfd_open): Likewise. * solib-svr4.c (lm_info_read): Likewise. (read_program_header): Likewise. (find_program_interpreter): Likewise. (scan_dyntag): Likewise. (elf_locate_base): Likewise. (open_symbol_file_object): Likewise. (read_program_headers_from_bfd): Likewise. (svr4_relocate_main_executable): Likewise. * solib-target.c (solib_target_relocate_section_addresses): Likewise. * solib.c (solib_find_1): Likewise. (exec_file_find): Likewise. (solib_find): Likewise. * source.c (openp): Likewise. (print_source_lines_base): Likewise. (forward_search_command): Likewise. * sparc-ravenscar-thread.c (supply_register_at_address): Likewise. * spu-tdep.c (spu2ppu_prev_register): Likewise. (spu_get_overlay_table): Likewise. * stabsread.c (patch_block_stabs): Likewise. (define_symbol): Likewise. (again:): Likewise. (read_member_functions): Likewise. (read_one_struct_field): Likewise. (read_enum_type): Likewise. (common_block_start): Likewise. * stack.c (read_frame_arg): Likewise. (backtrace_command): Likewise. * stap-probe.c (stap_parse_register_operand): Likewise. * symfile.c (syms_from_objfile_1): Likewise. (find_separate_debug_file): Likewise. (load_command): Likewise. (load_progress): Likewise. (load_section_callback): Likewise. (reread_symbols): Likewise. (add_filename_language): Likewise. (allocate_compunit_symtab): Likewise. (read_target_long_array): Likewise. (simple_read_overlay_table): Likewise. * symtab.c (symbol_set_names): Likewise. (resize_symbol_cache): Likewise. (rbreak_command): Likewise. (completion_list_add_name): Likewise. (completion_list_objc_symbol): Likewise. (add_filename_to_list): Likewise. * target-descriptions.c (maint_print_c_tdesc_cmd): Likewise. * target-memory.c (target_write_memory_blocks): Likewise. * target.c (target_read_string): Likewise. (read_whatever_is_readable): Likewise. (target_read_alloc_1): Likewise. (simple_search_memory): Likewise. (target_fileio_read_alloc_1): Likewise. * tilegx-tdep.c (tilegx_push_dummy_call): Likewise. * top.c (command_line_input): Likewise. * tracefile-tfile.c (tfile_fetch_registers): Likewise. * tracefile.c (tracefile_fetch_registers): Likewise. * tracepoint.c (add_memrange): Likewise. (init_collection_list): Likewise. (add_aexpr): Likewise. (trace_dump_actions): Likewise. (parse_trace_status): Likewise. (parse_tracepoint_definition): Likewise. (parse_tsv_definition): Likewise. (parse_static_tracepoint_marker_definition): Likewise. * tui/tui-file.c (tui_sfileopen): Likewise. (tui_file_adjust_strbuf): Likewise. * tui/tui-io.c (tui_expand_tabs): Likewise. * tui/tui-source.c (tui_set_source_content): Likewise. * typeprint.c (find_global_typedef): Likewise. * ui-file.c (do_ui_file_xstrdup): Likewise. (ui_file_obsavestring): Likewise. (mem_file_write): Likewise. * utils.c (make_hex_string): Likewise. (get_regcomp_error): Likewise. (puts_filtered_tabular): Likewise. (gdb_realpath_keepfile): Likewise. (ldirname): Likewise. (gdb_bfd_errmsg): Likewise. (substitute_path_component): Likewise. * valops.c (search_struct_method): Likewise. (find_oload_champ_namespace_loop): Likewise. * valprint.c (print_decimal_chars): Likewise. (read_string): Likewise. (generic_emit_char): Likewise. * varobj.c (varobj_delete): Likewise. (varobj_value_get_print_value): Likewise. * vaxobsd-tdep.c (vaxobsd_sigtramp_sniffer): Likewise. * windows-tdep.c (display_one_tib): Likewise. * xcoffread.c (read_xcoff_symtab): Likewise. (process_xcoff_symbol): Likewise. (swap_sym): Likewise. (scan_xcoff_symtab): Likewise. (xcoff_initial_scan): Likewise. * xml-support.c (gdb_xml_end_element): Likewise. (xml_process_xincludes): Likewise. (xml_fetch_content_from_file): Likewise. * xml-syscall.c (xml_list_of_syscalls): Likewise. * xstormy16-tdep.c (xstormy16_push_dummy_call): Likewise. gdb/gdbserver/ChangeLog: * ax.c (gdb_parse_agent_expr): Add cast to allocation result assignment. (gdb_unparse_agent_expr): Likewise. * hostio.c (require_data): Likewise. (handle_pread): Likewise. * linux-low.c (disable_regset): Likewise. (fetch_register): Likewise. (store_register): Likewise. (get_dynamic): Likewise. (linux_qxfer_libraries_svr4): Likewise. * mem-break.c (delete_fast_tracepoint_jump): Likewise. (set_fast_tracepoint_jump): Likewise. (uninsert_fast_tracepoint_jumps_at): Likewise. (reinsert_fast_tracepoint_jumps_at): Likewise. (validate_inserted_breakpoint): Likewise. (clone_agent_expr): Likewise. * regcache.c (init_register_cache): Likewise. * remote-utils.c (putpkt_binary_1): Likewise. (decode_M_packet): Likewise. (decode_X_packet): Likewise. (look_up_one_symbol): Likewise. (relocate_instruction): Likewise. (monitor_output): Likewise. * server.c (handle_search_memory): Likewise. (handle_qxfer_exec_file): Likewise. (handle_qxfer_libraries): Likewise. (handle_qxfer): Likewise. (handle_query): Likewise. (handle_v_cont): Likewise. (handle_v_run): Likewise. (captured_main): Likewise. * target.c (write_inferior_memory): Likewise. * thread-db.c (try_thread_db_load_from_dir): Likewise. * tracepoint.c (init_trace_buffer): Likewise. (add_tracepoint_action): Likewise. (add_traceframe): Likewise. (add_traceframe_block): Likewise. (cmd_qtdpsrc): Likewise. (cmd_qtdv): Likewise. (cmd_qtstatus): Likewise. (response_source): Likewise. (response_tsv): Likewise. (cmd_qtnotes): Likewise. (gdb_collect): Likewise. (initialize_tracepoint): Likewise.
2015-09-26 02:08:06 +08:00
a = (gdb_byte *) alloca (tdep->size_int);
if (record_full_arch_list_add_mem ((CORE_ADDR) len, tdep->size_int))
return -1;
/* Get the addrlen. */
if (target_read_memory ((CORE_ADDR) len, a, tdep->size_int))
{
if (record_debug)
gdb_printf (gdb_stdlog,
"Process record: error reading "
"memory at addr = 0x%s len = %d.\n",
phex_nz (len, tdep->size_pointer),
tdep->size_int);
return -1;
}
addrlen = (int) extract_unsigned_integer (a, tdep->size_int, byte_order);
if (addrlen <= 0 || addrlen > tdep->size_sockaddr)
addrlen = tdep->size_sockaddr;
if (record_full_arch_list_add_mem ((CORE_ADDR) addr, addrlen))
return -1;
return 0;
}
static int
record_linux_msghdr (struct regcache *regcache,
struct linux_record_tdep *tdep, ULONGEST addr)
{
gdb_byte *a;
s/get_regcache_arch (regcache)/regcache->arch ()/g This patches removes get_regcache_arch, and use regache->arch () instead. The motivation of this change is that I am going to move some basic stuff into a base class of regcache. I don't need to update "client" code regcache->arch (). On the other hand, this patch shortens the code a little bit. gdb: 2017-10-25 Yao Qi <yao.qi@linaro.org> * aarch32-linux-nat.c (aarch32_gp_regcache_supply): Use regcache->arch () instead get_regcache_arch. * aarch64-fbsd-nat.c (aarch64_fbsd_fetch_inferior_registers): Likewise. (aarch64_fbsd_store_inferior_registers): Likewise. * aarch64-linux-nat.c (fetch_gregs_from_thread): Likewise. (store_gregs_to_thread): Likewise. (fetch_fpregs_from_thread): Likewise. (store_fpregs_to_thread): Likewise. * aarch64-tdep.c (aarch64_extract_return_value): Likewise. (aarch64_store_return_value): Likewise. (aarch64_software_single_step): Likewise. * aix-thread.c (aix_thread_wait): Likewise. (supply_reg32): Likewise. (supply_sprs64): Likewise. (supply_sprs32): Likewise. (fill_gprs64): Likewise. (fill_gprs32): Likewise. (fill_sprs64): Likewise. (fill_sprs32): Likewise. (store_regs_user_thread): Likewise. (store_regs_kernel_thread): Likewise. * alpha-bsd-nat.c (alphabsd_fetch_inferior_registers): Likewise. (alphabsd_store_inferior_registers): Likewise. * alpha-tdep.c (alpha_extract_return_value): Likewise. (alpha_store_return_value): Likewise. (alpha_deal_with_atomic_sequence): Likewise. (alpha_next_pc): Likewise. (alpha_software_single_step): Likewise. * amd64-bsd-nat.c (amd64bsd_fetch_inferior_registers): Likewise. (amd64bsd_store_inferior_registers): Likewise. * amd64-linux-nat.c (amd64_linux_fetch_inferior_registers): Likewise. (amd64_linux_store_inferior_registers): Likewise. * amd64-nat.c (amd64_supply_native_gregset): Likewise. (amd64_collect_native_gregset): Likewise. * amd64-obsd-tdep.c (amd64obsd_supply_uthread): Likewise. (amd64obsd_collect_uthread): Likewise. * amd64-tdep.c (amd64_supply_fpregset): Likewise. (amd64_collect_fpregset): Likewise. (amd64_supply_fxsave): Likewise. (amd64_supply_xsave): Likewise. (amd64_collect_fxsave): Likewise. (amd64_collect_xsave): Likewise. * arc-tdep.c (arc_write_pc): Likewise. * arch-utils.c (default_skip_permanent_breakpoint): Likewise. * arm-fbsd-nat.c (arm_fbsd_fetch_inferior_registers): Likewise. (arm_fbsd_store_inferior_registers): Likewise. * arm-linux-nat.c (fetch_vfp_regs): Likewise. (store_vfp_regs): Likewise. (arm_linux_fetch_inferior_registers): Likewise. (arm_linux_store_inferior_registers): Likewise. * arm-linux-tdep.c (arm_linux_supply_gregset): Likewise. (arm_linux_sigreturn_next_pc): Likewise. (arm_linux_get_next_pcs_syscall_next_pc): Likewise. * arm-nbsd-nat.c (arm_supply_gregset): Likewise. (fetch_register): Likewise. (store_register): Likewise. * arm-tdep.c (arm_is_thumb): Likewise. (displaced_in_arm_mode): Likewise. (bx_write_pc): Likewise. (arm_get_next_pcs_addr_bits_remove): Likewise. (arm_software_single_step): Likewise. (arm_extract_return_value): Likewise. (arm_store_return_value): Likewise. (arm_write_pc): Likewise. * bfin-tdep.c (bfin_extract_return_value): Likewise. * bsd-uthread.c (bsd_uthread_fetch_registers): Likewise. (bsd_uthread_store_registers): Likewise. * core-regset.c (fetch_core_registers): Likewise. * corelow.c (get_core_registers): Likewise. * cris-tdep.c (cris_store_return_value): Likewise. (cris_extract_return_value): Likewise. (find_step_target): Likewise. (find_step_target): Likewise. (cris_software_single_step): Likewise. * ctf.c (ctf_fetch_registers): Likewise. * darwin-nat.c (cancel_breakpoint): Likewise. * fbsd-tdep.c (fbsd_collect_thread_registers): Likewise. * frv-tdep.c (frv_extract_return_value): Likewise. * ft32-tdep.c (ft32_store_return_value): Likewise. (ft32_extract_return_value): Likewise. * go32-nat.c (fetch_register): Likewise. (go32_fetch_registers): Likewise. (go32_store_registers): Likewise. (store_register): Likewise. * h8300-tdep.c (h8300_extract_return_value): Likewise. (h8300_store_return_value): Likewise. * hppa-linux-nat.c (fetch_register): Likewise. (store_register): Likewise. (hppa_linux_fetch_inferior_registers): Likewise. (hppa_linux_store_inferior_registers): Likewise. * i386-darwin-nat.c (i386_darwin_fetch_inferior_registers): Likewise. (i386_darwin_store_inferior_registers): Likewise. * i386-gnu-nat.c (gnu_fetch_registers): Likewise. (gnu_store_registers): Likewise. * i386-linux-nat.c (fetch_register): Likewise. (store_register): Likewise. (supply_gregset): Likewise. (fill_gregset): Likewise. (i386_linux_fetch_inferior_registers): Likewise. (i386_linux_store_inferior_registers): Likewise. (i386_linux_resume): Likewise. * i386-linux-tdep.c (i386_linux_get_syscall_number_from_regcache): Likewise. * i386-nto-tdep.c (i386nto_supply_gregset): Likewise. * i386-obsd-nat.c (i386obsd_supply_pcb): Likewise. * i386-obsd-tdep.c (i386obsd_supply_uthread): Likewise. (i386obsd_collect_uthread): Likewise. * i386-tdep.c (i386_mmx_regnum_to_fp_regnum): Likewise. (i386_supply_gregset): Likewise. (i386_collect_gregset): Likewise. (i386_supply_fpregset): Likewise. (i386_collect_fpregset): Likewise. (i386_mpx_bd_base): Likewise. * i386-v4-nat.c (supply_fpregset): Likewise. (fill_fpregset): Likewise. * i387-tdep.c (i387_supply_fsave): Likewise. (i387_collect_fsave): Likewise. (i387_supply_fxsave): Likewise. (i387_collect_fxsave): Likewise. (i387_supply_xsave): Likewise. (i387_collect_xsave): Likewise. * ia64-linux-nat.c (ia64_linux_fetch_registers): Likewise. (ia64_linux_store_registers): Likewise. * ia64-tdep.c (ia64_access_rse_reg): Likewise. (ia64_extract_return_value): Likewise. (ia64_store_return_value): Likewise. (find_func_descr): Likewise. * inf-child.c (inf_child_fetch_inferior_registers): Likewise. * inf-ptrace.c (inf_ptrace_fetch_registers): Likewise. (inf_ptrace_store_registers): Likewise. * infrun.c (use_displaced_stepping): Likewise. (displaced_step_prepare_throw): Likewise. (resume): Likewise. (proceed): Likewise. (do_target_wait): Likewise. (adjust_pc_after_break): Likewise. (handle_inferior_event_1): Likewise. (handle_signal_stop): Likewise. (save_infcall_suspend_state): Likewise. (restore_infcall_suspend_state): Likewise. * iq2000-tdep.c (iq2000_extract_return_value): Likewise. * jit.c (jit_frame_prev_register): Likewise. * linux-nat.c (save_stop_reason): Likewise. (linux_nat_wait_1): Likewise. (resume_stopped_resumed_lwps): Likewise. * linux-record.c (record_linux_sockaddr): Likewise. (record_linux_msghdr): Likewise. (record_linux_system_call): Likewise. * linux-tdep.c (linux_collect_thread_registers): Likewise. * lm32-tdep.c (lm32_extract_return_value): Likewise. (lm32_store_return_value): Likewise. * m32c-tdep.c (m32c_read_flg): Likewise. (m32c_pseudo_register_read): Likewise. (m32c_pseudo_register_write): Likewise. * m32r-linux-tdep.c (m32r_linux_supply_gregset): Likewise. (m32r_linux_collect_gregset): Likewise. * m32r-tdep.c (m32r_store_return_value): Likewise. (m32r_extract_return_value): Likewise. * m68k-bsd-nat.c (m68kbsd_supply_fpregset): Likewise. (m68kbsd_collect_fpregset): Likewise. * m68k-bsd-tdep.c (m68kbsd_supply_fpregset): Likewise. * m68k-linux-nat.c (fetch_register): Likewise. (old_fetch_inferior_registers): Likewise. (old_store_inferior_registers): Likewise. (store_regs): Likewise. * m68k-tdep.c (m68k_svr4_extract_return_value): Likewise. (m68k_svr4_store_return_value): Likewise. * m88k-tdep.c (m88k_store_arguments): Likewise. * mi/mi-main.c (mi_cmd_data_list_changed_registers): Likewise. (mi_cmd_data_write_register_values): Likewise. * mips-fbsd-nat.c (mips_fbsd_fetch_inferior_registers): Likewise. (mips_fbsd_store_inferior_registers): Likewise. * mips-fbsd-tdep.c (mips_fbsd_supply_fpregs): Likewise. (mips_fbsd_supply_gregs): Likewise. (mips_fbsd_collect_fpregs): Likewise. (mips_fbsd_collect_gregs): Likewise. (mips_fbsd_supply_fpregset): Likewise. (mips_fbsd_collect_fpregset): Likewise. (mips_fbsd_supply_gregset): Likewise. (mips_fbsd_collect_gregset): Likewise. * mips-linux-nat.c (supply_gregset): Likewise. (fill_gregset): Likewise. (supply_fpregset): Likewise. (fill_fpregset): Likewise. * mips-linux-tdep.c (mips_supply_gregset): Likewise. (mips_fill_gregset): Likewise. (mips_supply_fpregset): Likewise. (mips_fill_fpregset): Likewise. (mips64_supply_gregset): Likewise. (micromips_linux_sigframe_validate): Likewise. * mips-nbsd-nat.c (mipsnbsd_fetch_inferior_registers): Likewise. (mipsnbsd_fetch_inferior_registers): Likewise. (mipsnbsd_store_inferior_registers): Likewise. * mips-nbsd-tdep.c (mipsnbsd_supply_fpregset): Likewise. (mipsnbsd_supply_gregset): Likewise. (mipsnbsd_iterate_over_regset_sections): Likewise. (mipsnbsd_supply_reg): Likewise. (mipsnbsd_supply_fpreg): Likewise. * mips-tdep.c (mips_in_frame_stub): Likewise. (mips_dummy_id): Likewise. (is_octeon_bbit_op): Likewise. (micromips_bc1_pc): Likewise. (extended_mips16_next_pc): Likewise. (mips16_next_pc): Likewise. (deal_with_atomic_sequence): Likewise. * moxie-tdep.c (moxie_process_readu): Likewise. * nios2-tdep.c (nios2_get_next_pc): Likewise. * nto-procfs.c (procfs_store_registers): Likewise. * ppc-fbsd-nat.c (ppcfbsd_fetch_inferior_registers): Likewise. (ppcfbsd_store_inferior_registers): Likewise. * ppc-linux-nat.c (fetch_vsx_register): Likewise. (fetch_altivec_register): Likewise. (get_spe_registers): Likewise. (fetch_spe_register): Likewise. (fetch_altivec_registers): Likewise. (fetch_all_gp_regs): Likewise. (fetch_all_fp_regs): Likewise. (store_vsx_register): Likewise. (store_altivec_register): Likewise. (set_spe_registers): Likewise. (store_spe_register): Likewise. (store_altivec_registers): Likewise. (store_all_gp_regs): Likewise. (store_all_fp_regs): Likewise. * ppc-linux-tdep.c (ppc_linux_supply_gregset): Likewise. (ppc_linux_collect_gregset): Likewise. (ppc_canonicalize_syscall): Likewise. (ppc_linux_record_signal): Likewise. (ppu2spu_prev_register): Likewise. * ppc-nbsd-nat.c (ppcnbsd_supply_pcb): Likewise. * ppc-obsd-nat.c (ppcobsd_fetch_registers): Likewise. (ppcobsd_store_registers): Likewise. * ppc-ravenscar-thread.c (ppc_ravenscar_generic_fetch_registers): Likewise. (ppc_ravenscar_generic_store_registers): Likewise. * procfs.c (procfs_fetch_registers): Likewise. (procfs_store_registers): Likewise. * ravenscar-thread.c (ravenscar_fetch_registers): Likewise. (ravenscar_store_registers): Likewise. (ravenscar_prepare_to_store): Likewise. * record-btrace.c (record_btrace_fetch_registers): Likewise. * record-full.c (record_full_wait_1): Likewise. (record_full_registers_change): Likewise. (record_full_store_registers): Likewise. (record_full_core_fetch_registers): Likewise. (record_full_save): Likewise. (record_full_goto_insn): Likewise. * regcache.c (regcache_register_size): Likewise. (get_regcache_arch): Remove. (regcache_read_pc): Likewise. * regcache.h (get_regcache_arch): Remove. * remote-sim.c (gdbsim_fetch_register): Likewise. (gdbsim_store_register): Likewise. * remote.c (fetch_register_using_p): Likewise. (send_g_packet): Likewise. (remote_prepare_to_store): Likewise. (store_registers_using_G): Likewise. * reverse.c (save_bookmark_command): Likewise. (goto_bookmark_command): Likewise. * rs6000-aix-tdep.c (branch_dest): Likewise. * rs6000-nat.c (rs6000_ptrace64): Likewise. (fetch_register): Likewise. * rs6000-tdep.c (ppc_supply_reg): Likewise. (ppc_collect_reg): Likewise. (ppc_collect_gregset): Likewise. (ppc_collect_fpregset): Likewise. (ppc_collect_vsxregset): Likewise. (ppc_collect_vrregset): Likewise. (ppc_displaced_step_hw_singlestep): Likewise. (rs6000_pseudo_register_read): Likewise. (rs6000_pseudo_register_write): Likewise. * s390-linux-nat.c (supply_gregset): Likewise. (fill_gregset): Likewise. (s390_linux_fetch_inferior_registers): Likewise. * s390-linux-tdep.c (s390_write_pc): Likewise. (s390_software_single_step): Likewise. (s390_all_but_pc_registers_record): Likewise. (s390_linux_syscall_record): Likewise. * sentinel-frame.c (sentinel_frame_prev_arch): Likewise. * sh-nbsd-nat.c (shnbsd_fetch_inferior_registers): Likewise. (shnbsd_store_inferior_registers): Likewise. * sh-tdep.c (sh_extract_return_value_nofpu): Likewise. (sh_extract_return_value_fpu): Likewise. (sh_store_return_value_nofpu): Likewise. (sh_corefile_supply_regset): Likewise. (sh_corefile_collect_regset): Likewise. * sh64-tdep.c (sh64_extract_return_value): Likewise. (sh64_store_return_value): Likewise. * sparc-linux-tdep.c (sparc32_linux_collect_core_fpregset): Likewise. * sparc-nat.c (sparc_fetch_inferior_registers): Likewise. (sparc_store_inferior_registers): Likewise. * sparc-ravenscar-thread.c (register_in_thread_descriptor_p): Likewise. (sparc_ravenscar_prepare_to_store): Likewise. * sparc-tdep.c (sparc32_store_arguments): Likewise. (sparc_analyze_control_transfer): Likewise. (sparc_step_trap): Likewise. (sparc_software_single_step): Likewise. (sparc32_gdbarch_init): Likewise. (sparc_supply_rwindow): Likewise. (sparc_collect_rwindow): Likewise. * sparc64-linux-tdep.c (sparc64_linux_collect_core_fpregset): Likewise. * sparc64-nbsd-nat.c (sparc64nbsd_supply_gregset): Likewise. (sparc64nbsd_collect_gregset): Likewise. (sparc64nbsd_supply_fpregset): Likewise. (sparc64nbsd_collect_fpregset): Likewise. * sparc64-tdep.c (sparc64_store_arguments): Likewise. (sparc64_supply_gregset): Likewise. (sparc64_collect_gregset): Likewise. (sparc64_supply_fpregset): Likewise. (sparc64_collect_fpregset): Likewise. * spu-linux-nat.c (spu_fetch_inferior_registers): Likewise. * spu-tdep.c (spu_unwind_sp): Likewise. (spu2ppu_prev_register): Likewise. (spu_memory_remove_breakpoint): Likewise. * stack.c (return_command): Likewise. * tic6x-tdep.c (tic6x_extract_signed_field): Likewise. * tracefile-tfile.c (tfile_fetch_registers): Likewise. * tracefile.c (trace_save_ctf): Likewise. * windows-nat.c (do_windows_fetch_inferior_registers): Likewise. (do_windows_store_inferior_registers): Likewise. (windows_resume): Likewise. * xtensa-linux-nat.c (fill_gregset): Likewise. (supply_gregset_reg): Likewise. * xtensa-tdep.c (xtensa_register_write_masked): Likewise. (xtensa_register_read_masked): Likewise. (xtensa_supply_gregset): Likewise. (xtensa_extract_return_value): Likewise. (xtensa_store_return_value): Likewise.
2017-10-25 23:37:03 +08:00
struct gdbarch *gdbarch = regcache->arch ();
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
CORE_ADDR tmpaddr;
int tmpint;
if (!addr)
return 0;
if (record_full_arch_list_add_mem ((CORE_ADDR) addr, tdep->size_msghdr))
return -1;
Add casts to memory allocation related calls Most allocation functions (if not all) return a void* pointing to the allocated memory. In C++, we need to add an explicit cast when assigning the result to a pointer to another type (which is the case more often than not). The content of this patch is taken from Pedro's branch, from commit "(mostly) auto-generated patch to insert casts needed for C++". I validated that the changes make sense and manually reflowed the code to make it respect the coding style. I also found multiple places where I could use XNEW/XNEWVEC/XRESIZEVEC/etc. Thanks a lot to whoever did that automated script to insert casts, doing it completely by hand would have taken a ridiculous amount of time. Only files built on x86 with --enable-targets=all are modified. This means that all other -nat.c files are untouched and will have to be dealt with later by using appropiate compilers. Or maybe we can try to build them with a regular g++ just to know where to add casts, I don't know. I built-tested this with --enable-targets=all and reg-tested. Here's the changelog entry, which was not too bad to make despite the size, thanks to David Malcom's script. I fixed some bits by hand, but there might be some wrong parts left (hopefully not). gdb/ChangeLog: * aarch64-linux-tdep.c (aarch64_stap_parse_special_token): Add cast to allocation result assignment. * ada-exp.y (write_object_renaming): Likewise. (write_ambiguous_var): Likewise. (ada_nget_field_index): Likewise. (write_var_or_type): Likewise. * ada-lang.c (ada_decode_symbol): Likewise. (ada_value_assign): Likewise. (value_pointer): Likewise. (cache_symbol): Likewise. (add_nonlocal_symbols): Likewise. (ada_name_for_lookup): Likewise. (symbol_completion_add): Likewise. (ada_to_fixed_type_1): Likewise. (ada_get_next_arg): Likewise. (defns_collected): Likewise. * ada-lex.l (processId): Likewise. (processString): Likewise. * ada-tasks.c (read_known_tasks_array): Likewise. (read_known_tasks_list): Likewise. * ada-typeprint.c (decoded_type_name): Likewise. * addrmap.c (addrmap_mutable_create_fixed): Likewise. * amd64-tdep.c (amd64_push_arguments): Likewise. (amd64_displaced_step_copy_insn): Likewise. (amd64_classify_insn_at): Likewise. (amd64_relocate_instruction): Likewise. * amd64obsd-tdep.c (amd64obsd_sigtramp_p): Likewise. * arch-utils.c (simple_displaced_step_copy_insn): Likewise. (initialize_current_architecture): Likewise. * arm-linux-tdep.c (arm_stap_parse_special_token): Likewise. * arm-symbian-tdep.c (arm_symbian_osabi_sniffer): Likewise. * arm-tdep.c (arm_exidx_new_objfile): Likewise. (arm_push_dummy_call): Likewise. (extend_buffer_earlier): Likewise. (arm_adjust_breakpoint_address): Likewise. (arm_skip_stub): Likewise. * auto-load.c (filename_is_in_pattern): Likewise. (maybe_add_script_file): Likewise. (maybe_add_script_text): Likewise. (auto_load_objfile_script_1): Likewise. * auxv.c (ld_so_xfer_auxv): Likewise. * ax-general.c (new_agent_expr): Likewise. (grow_expr): Likewise. (ax_reg_mask): Likewise. * bcache.c (bcache_full): Likewise. * breakpoint.c (program_breakpoint_here_p): Likewise. * btrace.c (parse_xml_raw): Likewise. * build-id.c (build_id_to_debug_bfd): Likewise. * buildsym.c (end_symtab_with_blockvector): Likewise. * c-exp.y (string_exp): Likewise. (qualified_name): Likewise. (write_destructor_name): Likewise. (operator_stoken): Likewise. (parse_number): Likewise. (scan_macro_expansion): Likewise. (yylex): Likewise. (c_print_token): Likewise. * c-lang.c (c_get_string): Likewise. (emit_numeric_character): Likewise. * charset.c (wchar_iterate): Likewise. * cli/cli-cmds.c (complete_command): Likewise. (make_command): Likewise. * cli/cli-dump.c (restore_section_callback): Likewise. (restore_binary_file): Likewise. * cli/cli-interp.c (cli_interpreter_exec): Likewise. * cli/cli-script.c (execute_control_command): Likewise. * cli/cli-setshow.c (do_set_command): Likewise. * coff-pe-read.c (add_pe_forwarded_sym): Likewise. (read_pe_exported_syms): Likewise. * coffread.c (coff_read_struct_type): Likewise. (coff_read_enum_type): Likewise. * common/btrace-common.c (btrace_data_append): Likewise. * common/buffer.c (buffer_grow): Likewise. * common/filestuff.c (gdb_fopen_cloexec): Likewise. * common/format.c (parse_format_string): Likewise. * common/gdb_vecs.c (delim_string_to_char_ptr_vec_append): Likewise. * common/xml-utils.c (xml_escape_text): Likewise. * compile/compile-object-load.c (copy_sections): Likewise. (compile_object_load): Likewise. * compile/compile-object-run.c (compile_object_run): Likewise. * completer.c (filename_completer): Likewise. * corefile.c (read_memory_typed_address): Likewise. (write_memory_unsigned_integer): Likewise. (write_memory_signed_integer): Likewise. (complete_set_gnutarget): Likewise. * corelow.c (get_core_register_section): Likewise. * cp-name-parser.y (d_grab): Likewise. (allocate_info): Likewise. (cp_new_demangle_parse_info): Likewise. * cp-namespace.c (cp_scan_for_anonymous_namespaces): Likewise. (cp_lookup_symbol_in_namespace): Likewise. (lookup_namespace_scope): Likewise. (find_symbol_in_baseclass): Likewise. (cp_lookup_nested_symbol): Likewise. (cp_lookup_transparent_type_loop): Likewise. * cp-support.c (copy_string_to_obstack): Likewise. (make_symbol_overload_list): Likewise. (make_symbol_overload_list_namespace): Likewise. (make_symbol_overload_list_adl_namespace): Likewise. (first_component_command): Likewise. * cp-valprint.c (cp_print_value): Likewise. * ctf.c (ctf_xfer_partial): Likewise. * d-exp.y (StringExp): Likewise. * d-namespace.c (d_lookup_symbol_in_module): Likewise. (lookup_module_scope): Likewise. (find_symbol_in_baseclass): Likewise. (d_lookup_nested_symbol): Likewise. * dbxread.c (find_stab_function_addr): Likewise. (read_dbx_symtab): Likewise. (dbx_end_psymtab): Likewise. (cp_set_block_scope): Likewise. * dcache.c (dcache_alloc): Likewise. * demangle.c (_initialize_demangler): Likewise. * dicos-tdep.c (dicos_load_module_p): Likewise. * dictionary.c (dict_create_hashed_expandable): Likewise. (dict_create_linear_expandable): Likewise. (expand_hashtable): Likewise. (add_symbol_linear_expandable): Likewise. * dwarf2-frame.c (add_cie): Likewise. (add_fde): Likewise. (dwarf2_build_frame_info): Likewise. * dwarf2expr.c (dwarf_expr_grow_stack): Likewise. (dwarf_expr_fetch_address): Likewise. (add_piece): Likewise. (execute_stack_op): Likewise. * dwarf2loc.c (chain_candidate): Likewise. (dwarf_entry_parameter_to_value): Likewise. (read_pieced_value): Likewise. (write_pieced_value): Likewise. * dwarf2read.c (dwarf2_read_section): Likewise. (add_type_unit): Likewise. (read_comp_units_from_section): Likewise. (fixup_go_packaging): Likewise. (dwarf2_compute_name): Likewise. (dwarf2_physname): Likewise. (create_dwo_unit_in_dwp_v1): Likewise. (create_dwo_unit_in_dwp_v2): Likewise. (read_func_scope): Likewise. (read_call_site_scope): Likewise. (dwarf2_attach_fields_to_type): Likewise. (process_structure_scope): Likewise. (mark_common_block_symbol_computed): Likewise. (read_common_block): Likewise. (abbrev_table_read_table): Likewise. (guess_partial_die_structure_name): Likewise. (fixup_partial_die): Likewise. (add_file_name): Likewise. (dwarf2_const_value_data): Likewise. (dwarf2_const_value_attr): Likewise. (build_error_marker_type): Likewise. (guess_full_die_structure_name): Likewise. (anonymous_struct_prefix): Likewise. (typename_concat): Likewise. (dwarf2_canonicalize_name): Likewise. (dwarf2_name): Likewise. (write_constant_as_bytes): Likewise. (dwarf2_fetch_constant_bytes): Likewise. (copy_string): Likewise. (parse_macro_definition): Likewise. * elfread.c (elf_symfile_segments): Likewise. (elf_rel_plt_read): Likewise. (elf_gnu_ifunc_resolve_by_cache): Likewise. (elf_gnu_ifunc_resolve_by_got): Likewise. (elf_read_minimal_symbols): Likewise. (elf_gnu_ifunc_record_cache): Likewise. * event-top.c (top_level_prompt): Likewise. (command_line_handler): Likewise. * exec.c (resize_section_table): Likewise. * expprint.c (print_subexp_standard): Likewise. * fbsd-tdep.c (fbsd_collect_regset_section_cb): Likewise. * findcmd.c (parse_find_args): Likewise. * findvar.c (address_from_register): Likewise. * frame.c (get_prev_frame_always): Likewise. * gdb_bfd.c (gdb_bfd_ref): Likewise. (get_section_descriptor): Likewise. * gdb_obstack.c (obconcat): Likewise. (obstack_strdup): Likewise. * gdbtypes.c (lookup_function_type_with_arguments): Likewise. (create_set_type): Likewise. (lookup_unsigned_typename): Likewise. (lookup_signed_typename): Likewise. (resolve_dynamic_union): Likewise. (resolve_dynamic_struct): Likewise. (add_dyn_prop): Likewise. (copy_dynamic_prop_list): Likewise. (arch_flags_type): Likewise. (append_composite_type_field_raw): Likewise. * gdbtypes.h (INIT_FUNC_SPECIFIC): Likewise. * gnu-v3-abi.c (gnuv3_rtti_type): Likewise. * go-exp.y (string_exp): Likewise. * go-lang.c (go_demangle): Likewise. * guile/guile.c (compute_scheme_string): Likewise. * guile/scm-cmd.c (gdbscm_parse_command_name): Likewise. (gdbscm_canonicalize_command_name): Likewise. * guile/scm-ports.c (ioscm_init_stdio_buffers): Likewise. (ioscm_init_memory_port): Likewise. (ioscm_reinit_memory_port): Likewise. * guile/scm-utils.c (gdbscm_gc_xstrdup): Likewise. (gdbscm_gc_dup_argv): Likewise. * h8300-tdep.c (h8300_push_dummy_call): Likewise. * hppa-tdep.c (internalize_unwinds): Likewise. (read_unwind_info): Likewise. * i386-cygwin-tdep.c (core_process_module_section): Likewise. (windows_core_xfer_shared_libraries): Likewise. * i386-tdep.c (i386_displaced_step_copy_insn): Likewise. (i386_stap_parse_special_token_triplet): Likewise. (i386_stap_parse_special_token_three_arg_disp): Likewise. * i386obsd-tdep.c (i386obsd_sigtramp_p): Likewise. * inf-child.c (inf_child_fileio_readlink): Likewise. * inf-ptrace.c (inf_ptrace_fetch_register): Likewise. (inf_ptrace_store_register): Likewise. * infrun.c (follow_exec): Likewise. (displaced_step_prepare_throw): Likewise. (save_stop_context): Likewise. (save_infcall_suspend_state): Likewise. * jit.c (jit_read_descriptor): Likewise. (jit_read_code_entry): Likewise. (jit_symtab_line_mapping_add_impl): Likewise. (finalize_symtab): Likewise. (jit_unwind_reg_get_impl): Likewise. * jv-exp.y (QualifiedName): Likewise. * jv-lang.c (get_java_utf8_name): Likewise. (type_from_class): Likewise. (java_demangle_type_signature): Likewise. (java_class_name_from_physname): Likewise. * jv-typeprint.c (java_type_print_base): Likewise. * jv-valprint.c (java_value_print): Likewise. * language.c (add_language): Likewise. * linespec.c (add_sal_to_sals_basic): Likewise. (add_sal_to_sals): Likewise. (decode_objc): Likewise. (find_linespec_symbols): Likewise. * linux-fork.c (fork_save_infrun_state): Likewise. * linux-nat.c (linux_nat_detach): Likewise. (linux_nat_fileio_readlink): Likewise. * linux-record.c (record_linux_sockaddr): Likewise. (record_linux_msghdr): Likewise. (Do): Likewise. * linux-tdep.c (linux_core_info_proc_mappings): Likewise. (linux_collect_regset_section_cb): Likewise. (linux_get_siginfo_data): Likewise. * linux-thread-db.c (try_thread_db_load_from_pdir_1): Likewise. (try_thread_db_load_from_dir): Likewise. (thread_db_load_search): Likewise. (info_auto_load_libthread_db): Likewise. * m32c-tdep.c (m32c_m16c_address_to_pointer): Likewise. (m32c_m16c_pointer_to_address): Likewise. * m68hc11-tdep.c (m68hc11_pseudo_register_write): Likewise. * m68k-tdep.c (m68k_get_longjmp_target): Likewise. * machoread.c (macho_check_dsym): Likewise. * macroexp.c (resize_buffer): Likewise. (gather_arguments): Likewise. (maybe_expand): Likewise. * macrotab.c (new_macro_key): Likewise. (new_source_file): Likewise. (new_macro_definition): Likewise. * mdebugread.c (parse_symbol): Likewise. (parse_type): Likewise. (parse_partial_symbols): Likewise. (psymtab_to_symtab_1): Likewise. * mem-break.c (default_memory_insert_breakpoint): Likewise. * mi/mi-cmd-break.c (mi_argv_to_format): Likewise. * mi/mi-main.c (mi_cmd_data_read_memory): Likewise. (mi_cmd_data_read_memory_bytes): Likewise. (mi_cmd_data_write_memory_bytes): Likewise. (mi_cmd_trace_frame_collected): Likewise. * mi/mi-parse.c (mi_parse_argv): Likewise. (mi_parse): Likewise. * minidebug.c (lzma_open): Likewise. (lzma_pread): Likewise. * mips-tdep.c (mips_read_fp_register_single): Likewise. (mips_print_fp_register): Likewise. * mipsnbsd-tdep.c (mipsnbsd_get_longjmp_target): Likewise. * mipsread.c (read_alphacoff_dynamic_symtab): Likewise. * mt-tdep.c (mt_register_name): Likewise. (mt_registers_info): Likewise. (mt_push_dummy_call): Likewise. * namespace.c (add_using_directive): Likewise. * nat/linux-btrace.c (perf_event_read): Likewise. (linux_enable_bts): Likewise. * nat/linux-osdata.c (linux_common_core_of_thread): Likewise. * nat/linux-ptrace.c (linux_ptrace_test_ret_to_nx): Likewise. * nto-tdep.c (nto_find_and_open_solib): Likewise. (nto_parse_redirection): Likewise. * objc-lang.c (objc_demangle): Likewise. (find_methods): Likewise. * objfiles.c (get_objfile_bfd_data): Likewise. (set_objfile_main_name): Likewise. (allocate_objfile): Likewise. (objfile_relocate): Likewise. (update_section_map): Likewise. * osabi.c (generic_elf_osabi_sniff_abi_tag_sections): Likewise. * p-exp.y (exp): Likewise. (yylex): Likewise. * p-valprint.c (pascal_object_print_value): Likewise. * parse.c (initialize_expout): Likewise. (mark_completion_tag): Likewise. (copy_name): Likewise. (parse_float): Likewise. (type_stack_reserve): Likewise. * ppc-linux-tdep.c (ppc_stap_parse_special_token): Likewise. (ppu2spu_prev_register): Likewise. * ppc-ravenscar-thread.c (supply_register_at_address): Likewise. * printcmd.c (printf_wide_c_string): Likewise. (printf_pointer): Likewise. * probe.c (parse_probes): Likewise. * python/py-cmd.c (gdbpy_parse_command_name): Likewise. (cmdpy_init): Likewise. * python/py-gdb-readline.c (gdbpy_readline_wrapper): Likewise. * python/py-symtab.c (set_sal): Likewise. * python/py-unwind.c (pyuw_sniffer): Likewise. * python/python.c (python_interactive_command): Likewise. (compute_python_string): Likewise. * ravenscar-thread.c (get_running_thread_id): Likewise. * record-full.c (record_full_exec_insn): Likewise. (record_full_core_open_1): Likewise. * regcache.c (regcache_raw_read_signed): Likewise. (regcache_raw_read_unsigned): Likewise. (regcache_cooked_read_signed): Likewise. (regcache_cooked_read_unsigned): Likewise. * remote-fileio.c (remote_fileio_func_open): Likewise. (remote_fileio_func_rename): Likewise. (remote_fileio_func_unlink): Likewise. (remote_fileio_func_stat): Likewise. (remote_fileio_func_system): Likewise. * remote-mips.c (mips_xfer_memory): Likewise. (mips_load_srec): Likewise. (pmon_end_download): Likewise. * remote.c (new_remote_state): Likewise. (map_regcache_remote_table): Likewise. (remote_register_number_and_offset): Likewise. (init_remote_state): Likewise. (get_memory_packet_size): Likewise. (remote_pass_signals): Likewise. (remote_program_signals): Likewise. (remote_start_remote): Likewise. (remote_check_symbols): Likewise. (remote_query_supported): Likewise. (extended_remote_attach): Likewise. (process_g_packet): Likewise. (store_registers_using_G): Likewise. (putpkt_binary): Likewise. (read_frame): Likewise. (compare_sections_command): Likewise. (remote_hostio_pread): Likewise. (remote_hostio_readlink): Likewise. (remote_file_put): Likewise. (remote_file_get): Likewise. (remote_pid_to_exec_file): Likewise. (_initialize_remote): Likewise. * rs6000-aix-tdep.c (rs6000_aix_ld_info_to_xml): Likewise. (rs6000_aix_core_xfer_shared_libraries_aix): Likewise. * rs6000-tdep.c (ppc_displaced_step_copy_insn): Likewise. (bfd_uses_spe_extensions): Likewise. * s390-linux-tdep.c (s390_displaced_step_copy_insn): Likewise. * score-tdep.c (score7_malloc_and_get_memblock): Likewise. * solib-dsbt.c (decode_loadmap): Likewise. (fetch_loadmap): Likewise. (scan_dyntag): Likewise. (enable_break): Likewise. (dsbt_relocate_main_executable): Likewise. * solib-frv.c (fetch_loadmap): Likewise. (enable_break2): Likewise. (frv_relocate_main_executable): Likewise. * solib-spu.c (spu_relocate_main_executable): Likewise. (spu_bfd_open): Likewise. * solib-svr4.c (lm_info_read): Likewise. (read_program_header): Likewise. (find_program_interpreter): Likewise. (scan_dyntag): Likewise. (elf_locate_base): Likewise. (open_symbol_file_object): Likewise. (read_program_headers_from_bfd): Likewise. (svr4_relocate_main_executable): Likewise. * solib-target.c (solib_target_relocate_section_addresses): Likewise. * solib.c (solib_find_1): Likewise. (exec_file_find): Likewise. (solib_find): Likewise. * source.c (openp): Likewise. (print_source_lines_base): Likewise. (forward_search_command): Likewise. * sparc-ravenscar-thread.c (supply_register_at_address): Likewise. * spu-tdep.c (spu2ppu_prev_register): Likewise. (spu_get_overlay_table): Likewise. * stabsread.c (patch_block_stabs): Likewise. (define_symbol): Likewise. (again:): Likewise. (read_member_functions): Likewise. (read_one_struct_field): Likewise. (read_enum_type): Likewise. (common_block_start): Likewise. * stack.c (read_frame_arg): Likewise. (backtrace_command): Likewise. * stap-probe.c (stap_parse_register_operand): Likewise. * symfile.c (syms_from_objfile_1): Likewise. (find_separate_debug_file): Likewise. (load_command): Likewise. (load_progress): Likewise. (load_section_callback): Likewise. (reread_symbols): Likewise. (add_filename_language): Likewise. (allocate_compunit_symtab): Likewise. (read_target_long_array): Likewise. (simple_read_overlay_table): Likewise. * symtab.c (symbol_set_names): Likewise. (resize_symbol_cache): Likewise. (rbreak_command): Likewise. (completion_list_add_name): Likewise. (completion_list_objc_symbol): Likewise. (add_filename_to_list): Likewise. * target-descriptions.c (maint_print_c_tdesc_cmd): Likewise. * target-memory.c (target_write_memory_blocks): Likewise. * target.c (target_read_string): Likewise. (read_whatever_is_readable): Likewise. (target_read_alloc_1): Likewise. (simple_search_memory): Likewise. (target_fileio_read_alloc_1): Likewise. * tilegx-tdep.c (tilegx_push_dummy_call): Likewise. * top.c (command_line_input): Likewise. * tracefile-tfile.c (tfile_fetch_registers): Likewise. * tracefile.c (tracefile_fetch_registers): Likewise. * tracepoint.c (add_memrange): Likewise. (init_collection_list): Likewise. (add_aexpr): Likewise. (trace_dump_actions): Likewise. (parse_trace_status): Likewise. (parse_tracepoint_definition): Likewise. (parse_tsv_definition): Likewise. (parse_static_tracepoint_marker_definition): Likewise. * tui/tui-file.c (tui_sfileopen): Likewise. (tui_file_adjust_strbuf): Likewise. * tui/tui-io.c (tui_expand_tabs): Likewise. * tui/tui-source.c (tui_set_source_content): Likewise. * typeprint.c (find_global_typedef): Likewise. * ui-file.c (do_ui_file_xstrdup): Likewise. (ui_file_obsavestring): Likewise. (mem_file_write): Likewise. * utils.c (make_hex_string): Likewise. (get_regcomp_error): Likewise. (puts_filtered_tabular): Likewise. (gdb_realpath_keepfile): Likewise. (ldirname): Likewise. (gdb_bfd_errmsg): Likewise. (substitute_path_component): Likewise. * valops.c (search_struct_method): Likewise. (find_oload_champ_namespace_loop): Likewise. * valprint.c (print_decimal_chars): Likewise. (read_string): Likewise. (generic_emit_char): Likewise. * varobj.c (varobj_delete): Likewise. (varobj_value_get_print_value): Likewise. * vaxobsd-tdep.c (vaxobsd_sigtramp_sniffer): Likewise. * windows-tdep.c (display_one_tib): Likewise. * xcoffread.c (read_xcoff_symtab): Likewise. (process_xcoff_symbol): Likewise. (swap_sym): Likewise. (scan_xcoff_symtab): Likewise. (xcoff_initial_scan): Likewise. * xml-support.c (gdb_xml_end_element): Likewise. (xml_process_xincludes): Likewise. (xml_fetch_content_from_file): Likewise. * xml-syscall.c (xml_list_of_syscalls): Likewise. * xstormy16-tdep.c (xstormy16_push_dummy_call): Likewise. gdb/gdbserver/ChangeLog: * ax.c (gdb_parse_agent_expr): Add cast to allocation result assignment. (gdb_unparse_agent_expr): Likewise. * hostio.c (require_data): Likewise. (handle_pread): Likewise. * linux-low.c (disable_regset): Likewise. (fetch_register): Likewise. (store_register): Likewise. (get_dynamic): Likewise. (linux_qxfer_libraries_svr4): Likewise. * mem-break.c (delete_fast_tracepoint_jump): Likewise. (set_fast_tracepoint_jump): Likewise. (uninsert_fast_tracepoint_jumps_at): Likewise. (reinsert_fast_tracepoint_jumps_at): Likewise. (validate_inserted_breakpoint): Likewise. (clone_agent_expr): Likewise. * regcache.c (init_register_cache): Likewise. * remote-utils.c (putpkt_binary_1): Likewise. (decode_M_packet): Likewise. (decode_X_packet): Likewise. (look_up_one_symbol): Likewise. (relocate_instruction): Likewise. (monitor_output): Likewise. * server.c (handle_search_memory): Likewise. (handle_qxfer_exec_file): Likewise. (handle_qxfer_libraries): Likewise. (handle_qxfer): Likewise. (handle_query): Likewise. (handle_v_cont): Likewise. (handle_v_run): Likewise. (captured_main): Likewise. * target.c (write_inferior_memory): Likewise. * thread-db.c (try_thread_db_load_from_dir): Likewise. * tracepoint.c (init_trace_buffer): Likewise. (add_tracepoint_action): Likewise. (add_traceframe): Likewise. (add_traceframe_block): Likewise. (cmd_qtdpsrc): Likewise. (cmd_qtdv): Likewise. (cmd_qtstatus): Likewise. (response_source): Likewise. (response_tsv): Likewise. (cmd_qtnotes): Likewise. (gdb_collect): Likewise. (initialize_tracepoint): Likewise.
2015-09-26 02:08:06 +08:00
a = (gdb_byte *) alloca (tdep->size_msghdr);
if (target_read_memory ((CORE_ADDR) addr, a, tdep->size_msghdr))
{
if (record_debug)
gdb_printf (gdb_stdlog,
"Process record: error reading "
"memory at addr = 0x%s "
"len = %d.\n",
phex_nz (addr, tdep->size_pointer),
tdep->size_msghdr);
return -1;
}
/* msg_name msg_namelen */
addr = extract_unsigned_integer (a, tdep->size_pointer, byte_order);
a += tdep->size_pointer;
if (record_full_arch_list_add_mem
((CORE_ADDR) addr,
(int) extract_unsigned_integer (a,
tdep->size_int,
byte_order)))
return -1;
/* We have read an int, but skip size_pointer bytes to account for alignment
of the next field on 64-bit targets. */
a += tdep->size_pointer;
/* msg_iov msg_iovlen */
addr = extract_unsigned_integer (a, tdep->size_pointer, byte_order);
a += tdep->size_pointer;
if (addr)
{
ULONGEST i;
ULONGEST len = extract_unsigned_integer (a, tdep->size_size_t,
byte_order);
Add casts to memory allocation related calls Most allocation functions (if not all) return a void* pointing to the allocated memory. In C++, we need to add an explicit cast when assigning the result to a pointer to another type (which is the case more often than not). The content of this patch is taken from Pedro's branch, from commit "(mostly) auto-generated patch to insert casts needed for C++". I validated that the changes make sense and manually reflowed the code to make it respect the coding style. I also found multiple places where I could use XNEW/XNEWVEC/XRESIZEVEC/etc. Thanks a lot to whoever did that automated script to insert casts, doing it completely by hand would have taken a ridiculous amount of time. Only files built on x86 with --enable-targets=all are modified. This means that all other -nat.c files are untouched and will have to be dealt with later by using appropiate compilers. Or maybe we can try to build them with a regular g++ just to know where to add casts, I don't know. I built-tested this with --enable-targets=all and reg-tested. Here's the changelog entry, which was not too bad to make despite the size, thanks to David Malcom's script. I fixed some bits by hand, but there might be some wrong parts left (hopefully not). gdb/ChangeLog: * aarch64-linux-tdep.c (aarch64_stap_parse_special_token): Add cast to allocation result assignment. * ada-exp.y (write_object_renaming): Likewise. (write_ambiguous_var): Likewise. (ada_nget_field_index): Likewise. (write_var_or_type): Likewise. * ada-lang.c (ada_decode_symbol): Likewise. (ada_value_assign): Likewise. (value_pointer): Likewise. (cache_symbol): Likewise. (add_nonlocal_symbols): Likewise. (ada_name_for_lookup): Likewise. (symbol_completion_add): Likewise. (ada_to_fixed_type_1): Likewise. (ada_get_next_arg): Likewise. (defns_collected): Likewise. * ada-lex.l (processId): Likewise. (processString): Likewise. * ada-tasks.c (read_known_tasks_array): Likewise. (read_known_tasks_list): Likewise. * ada-typeprint.c (decoded_type_name): Likewise. * addrmap.c (addrmap_mutable_create_fixed): Likewise. * amd64-tdep.c (amd64_push_arguments): Likewise. (amd64_displaced_step_copy_insn): Likewise. (amd64_classify_insn_at): Likewise. (amd64_relocate_instruction): Likewise. * amd64obsd-tdep.c (amd64obsd_sigtramp_p): Likewise. * arch-utils.c (simple_displaced_step_copy_insn): Likewise. (initialize_current_architecture): Likewise. * arm-linux-tdep.c (arm_stap_parse_special_token): Likewise. * arm-symbian-tdep.c (arm_symbian_osabi_sniffer): Likewise. * arm-tdep.c (arm_exidx_new_objfile): Likewise. (arm_push_dummy_call): Likewise. (extend_buffer_earlier): Likewise. (arm_adjust_breakpoint_address): Likewise. (arm_skip_stub): Likewise. * auto-load.c (filename_is_in_pattern): Likewise. (maybe_add_script_file): Likewise. (maybe_add_script_text): Likewise. (auto_load_objfile_script_1): Likewise. * auxv.c (ld_so_xfer_auxv): Likewise. * ax-general.c (new_agent_expr): Likewise. (grow_expr): Likewise. (ax_reg_mask): Likewise. * bcache.c (bcache_full): Likewise. * breakpoint.c (program_breakpoint_here_p): Likewise. * btrace.c (parse_xml_raw): Likewise. * build-id.c (build_id_to_debug_bfd): Likewise. * buildsym.c (end_symtab_with_blockvector): Likewise. * c-exp.y (string_exp): Likewise. (qualified_name): Likewise. (write_destructor_name): Likewise. (operator_stoken): Likewise. (parse_number): Likewise. (scan_macro_expansion): Likewise. (yylex): Likewise. (c_print_token): Likewise. * c-lang.c (c_get_string): Likewise. (emit_numeric_character): Likewise. * charset.c (wchar_iterate): Likewise. * cli/cli-cmds.c (complete_command): Likewise. (make_command): Likewise. * cli/cli-dump.c (restore_section_callback): Likewise. (restore_binary_file): Likewise. * cli/cli-interp.c (cli_interpreter_exec): Likewise. * cli/cli-script.c (execute_control_command): Likewise. * cli/cli-setshow.c (do_set_command): Likewise. * coff-pe-read.c (add_pe_forwarded_sym): Likewise. (read_pe_exported_syms): Likewise. * coffread.c (coff_read_struct_type): Likewise. (coff_read_enum_type): Likewise. * common/btrace-common.c (btrace_data_append): Likewise. * common/buffer.c (buffer_grow): Likewise. * common/filestuff.c (gdb_fopen_cloexec): Likewise. * common/format.c (parse_format_string): Likewise. * common/gdb_vecs.c (delim_string_to_char_ptr_vec_append): Likewise. * common/xml-utils.c (xml_escape_text): Likewise. * compile/compile-object-load.c (copy_sections): Likewise. (compile_object_load): Likewise. * compile/compile-object-run.c (compile_object_run): Likewise. * completer.c (filename_completer): Likewise. * corefile.c (read_memory_typed_address): Likewise. (write_memory_unsigned_integer): Likewise. (write_memory_signed_integer): Likewise. (complete_set_gnutarget): Likewise. * corelow.c (get_core_register_section): Likewise. * cp-name-parser.y (d_grab): Likewise. (allocate_info): Likewise. (cp_new_demangle_parse_info): Likewise. * cp-namespace.c (cp_scan_for_anonymous_namespaces): Likewise. (cp_lookup_symbol_in_namespace): Likewise. (lookup_namespace_scope): Likewise. (find_symbol_in_baseclass): Likewise. (cp_lookup_nested_symbol): Likewise. (cp_lookup_transparent_type_loop): Likewise. * cp-support.c (copy_string_to_obstack): Likewise. (make_symbol_overload_list): Likewise. (make_symbol_overload_list_namespace): Likewise. (make_symbol_overload_list_adl_namespace): Likewise. (first_component_command): Likewise. * cp-valprint.c (cp_print_value): Likewise. * ctf.c (ctf_xfer_partial): Likewise. * d-exp.y (StringExp): Likewise. * d-namespace.c (d_lookup_symbol_in_module): Likewise. (lookup_module_scope): Likewise. (find_symbol_in_baseclass): Likewise. (d_lookup_nested_symbol): Likewise. * dbxread.c (find_stab_function_addr): Likewise. (read_dbx_symtab): Likewise. (dbx_end_psymtab): Likewise. (cp_set_block_scope): Likewise. * dcache.c (dcache_alloc): Likewise. * demangle.c (_initialize_demangler): Likewise. * dicos-tdep.c (dicos_load_module_p): Likewise. * dictionary.c (dict_create_hashed_expandable): Likewise. (dict_create_linear_expandable): Likewise. (expand_hashtable): Likewise. (add_symbol_linear_expandable): Likewise. * dwarf2-frame.c (add_cie): Likewise. (add_fde): Likewise. (dwarf2_build_frame_info): Likewise. * dwarf2expr.c (dwarf_expr_grow_stack): Likewise. (dwarf_expr_fetch_address): Likewise. (add_piece): Likewise. (execute_stack_op): Likewise. * dwarf2loc.c (chain_candidate): Likewise. (dwarf_entry_parameter_to_value): Likewise. (read_pieced_value): Likewise. (write_pieced_value): Likewise. * dwarf2read.c (dwarf2_read_section): Likewise. (add_type_unit): Likewise. (read_comp_units_from_section): Likewise. (fixup_go_packaging): Likewise. (dwarf2_compute_name): Likewise. (dwarf2_physname): Likewise. (create_dwo_unit_in_dwp_v1): Likewise. (create_dwo_unit_in_dwp_v2): Likewise. (read_func_scope): Likewise. (read_call_site_scope): Likewise. (dwarf2_attach_fields_to_type): Likewise. (process_structure_scope): Likewise. (mark_common_block_symbol_computed): Likewise. (read_common_block): Likewise. (abbrev_table_read_table): Likewise. (guess_partial_die_structure_name): Likewise. (fixup_partial_die): Likewise. (add_file_name): Likewise. (dwarf2_const_value_data): Likewise. (dwarf2_const_value_attr): Likewise. (build_error_marker_type): Likewise. (guess_full_die_structure_name): Likewise. (anonymous_struct_prefix): Likewise. (typename_concat): Likewise. (dwarf2_canonicalize_name): Likewise. (dwarf2_name): Likewise. (write_constant_as_bytes): Likewise. (dwarf2_fetch_constant_bytes): Likewise. (copy_string): Likewise. (parse_macro_definition): Likewise. * elfread.c (elf_symfile_segments): Likewise. (elf_rel_plt_read): Likewise. (elf_gnu_ifunc_resolve_by_cache): Likewise. (elf_gnu_ifunc_resolve_by_got): Likewise. (elf_read_minimal_symbols): Likewise. (elf_gnu_ifunc_record_cache): Likewise. * event-top.c (top_level_prompt): Likewise. (command_line_handler): Likewise. * exec.c (resize_section_table): Likewise. * expprint.c (print_subexp_standard): Likewise. * fbsd-tdep.c (fbsd_collect_regset_section_cb): Likewise. * findcmd.c (parse_find_args): Likewise. * findvar.c (address_from_register): Likewise. * frame.c (get_prev_frame_always): Likewise. * gdb_bfd.c (gdb_bfd_ref): Likewise. (get_section_descriptor): Likewise. * gdb_obstack.c (obconcat): Likewise. (obstack_strdup): Likewise. * gdbtypes.c (lookup_function_type_with_arguments): Likewise. (create_set_type): Likewise. (lookup_unsigned_typename): Likewise. (lookup_signed_typename): Likewise. (resolve_dynamic_union): Likewise. (resolve_dynamic_struct): Likewise. (add_dyn_prop): Likewise. (copy_dynamic_prop_list): Likewise. (arch_flags_type): Likewise. (append_composite_type_field_raw): Likewise. * gdbtypes.h (INIT_FUNC_SPECIFIC): Likewise. * gnu-v3-abi.c (gnuv3_rtti_type): Likewise. * go-exp.y (string_exp): Likewise. * go-lang.c (go_demangle): Likewise. * guile/guile.c (compute_scheme_string): Likewise. * guile/scm-cmd.c (gdbscm_parse_command_name): Likewise. (gdbscm_canonicalize_command_name): Likewise. * guile/scm-ports.c (ioscm_init_stdio_buffers): Likewise. (ioscm_init_memory_port): Likewise. (ioscm_reinit_memory_port): Likewise. * guile/scm-utils.c (gdbscm_gc_xstrdup): Likewise. (gdbscm_gc_dup_argv): Likewise. * h8300-tdep.c (h8300_push_dummy_call): Likewise. * hppa-tdep.c (internalize_unwinds): Likewise. (read_unwind_info): Likewise. * i386-cygwin-tdep.c (core_process_module_section): Likewise. (windows_core_xfer_shared_libraries): Likewise. * i386-tdep.c (i386_displaced_step_copy_insn): Likewise. (i386_stap_parse_special_token_triplet): Likewise. (i386_stap_parse_special_token_three_arg_disp): Likewise. * i386obsd-tdep.c (i386obsd_sigtramp_p): Likewise. * inf-child.c (inf_child_fileio_readlink): Likewise. * inf-ptrace.c (inf_ptrace_fetch_register): Likewise. (inf_ptrace_store_register): Likewise. * infrun.c (follow_exec): Likewise. (displaced_step_prepare_throw): Likewise. (save_stop_context): Likewise. (save_infcall_suspend_state): Likewise. * jit.c (jit_read_descriptor): Likewise. (jit_read_code_entry): Likewise. (jit_symtab_line_mapping_add_impl): Likewise. (finalize_symtab): Likewise. (jit_unwind_reg_get_impl): Likewise. * jv-exp.y (QualifiedName): Likewise. * jv-lang.c (get_java_utf8_name): Likewise. (type_from_class): Likewise. (java_demangle_type_signature): Likewise. (java_class_name_from_physname): Likewise. * jv-typeprint.c (java_type_print_base): Likewise. * jv-valprint.c (java_value_print): Likewise. * language.c (add_language): Likewise. * linespec.c (add_sal_to_sals_basic): Likewise. (add_sal_to_sals): Likewise. (decode_objc): Likewise. (find_linespec_symbols): Likewise. * linux-fork.c (fork_save_infrun_state): Likewise. * linux-nat.c (linux_nat_detach): Likewise. (linux_nat_fileio_readlink): Likewise. * linux-record.c (record_linux_sockaddr): Likewise. (record_linux_msghdr): Likewise. (Do): Likewise. * linux-tdep.c (linux_core_info_proc_mappings): Likewise. (linux_collect_regset_section_cb): Likewise. (linux_get_siginfo_data): Likewise. * linux-thread-db.c (try_thread_db_load_from_pdir_1): Likewise. (try_thread_db_load_from_dir): Likewise. (thread_db_load_search): Likewise. (info_auto_load_libthread_db): Likewise. * m32c-tdep.c (m32c_m16c_address_to_pointer): Likewise. (m32c_m16c_pointer_to_address): Likewise. * m68hc11-tdep.c (m68hc11_pseudo_register_write): Likewise. * m68k-tdep.c (m68k_get_longjmp_target): Likewise. * machoread.c (macho_check_dsym): Likewise. * macroexp.c (resize_buffer): Likewise. (gather_arguments): Likewise. (maybe_expand): Likewise. * macrotab.c (new_macro_key): Likewise. (new_source_file): Likewise. (new_macro_definition): Likewise. * mdebugread.c (parse_symbol): Likewise. (parse_type): Likewise. (parse_partial_symbols): Likewise. (psymtab_to_symtab_1): Likewise. * mem-break.c (default_memory_insert_breakpoint): Likewise. * mi/mi-cmd-break.c (mi_argv_to_format): Likewise. * mi/mi-main.c (mi_cmd_data_read_memory): Likewise. (mi_cmd_data_read_memory_bytes): Likewise. (mi_cmd_data_write_memory_bytes): Likewise. (mi_cmd_trace_frame_collected): Likewise. * mi/mi-parse.c (mi_parse_argv): Likewise. (mi_parse): Likewise. * minidebug.c (lzma_open): Likewise. (lzma_pread): Likewise. * mips-tdep.c (mips_read_fp_register_single): Likewise. (mips_print_fp_register): Likewise. * mipsnbsd-tdep.c (mipsnbsd_get_longjmp_target): Likewise. * mipsread.c (read_alphacoff_dynamic_symtab): Likewise. * mt-tdep.c (mt_register_name): Likewise. (mt_registers_info): Likewise. (mt_push_dummy_call): Likewise. * namespace.c (add_using_directive): Likewise. * nat/linux-btrace.c (perf_event_read): Likewise. (linux_enable_bts): Likewise. * nat/linux-osdata.c (linux_common_core_of_thread): Likewise. * nat/linux-ptrace.c (linux_ptrace_test_ret_to_nx): Likewise. * nto-tdep.c (nto_find_and_open_solib): Likewise. (nto_parse_redirection): Likewise. * objc-lang.c (objc_demangle): Likewise. (find_methods): Likewise. * objfiles.c (get_objfile_bfd_data): Likewise. (set_objfile_main_name): Likewise. (allocate_objfile): Likewise. (objfile_relocate): Likewise. (update_section_map): Likewise. * osabi.c (generic_elf_osabi_sniff_abi_tag_sections): Likewise. * p-exp.y (exp): Likewise. (yylex): Likewise. * p-valprint.c (pascal_object_print_value): Likewise. * parse.c (initialize_expout): Likewise. (mark_completion_tag): Likewise. (copy_name): Likewise. (parse_float): Likewise. (type_stack_reserve): Likewise. * ppc-linux-tdep.c (ppc_stap_parse_special_token): Likewise. (ppu2spu_prev_register): Likewise. * ppc-ravenscar-thread.c (supply_register_at_address): Likewise. * printcmd.c (printf_wide_c_string): Likewise. (printf_pointer): Likewise. * probe.c (parse_probes): Likewise. * python/py-cmd.c (gdbpy_parse_command_name): Likewise. (cmdpy_init): Likewise. * python/py-gdb-readline.c (gdbpy_readline_wrapper): Likewise. * python/py-symtab.c (set_sal): Likewise. * python/py-unwind.c (pyuw_sniffer): Likewise. * python/python.c (python_interactive_command): Likewise. (compute_python_string): Likewise. * ravenscar-thread.c (get_running_thread_id): Likewise. * record-full.c (record_full_exec_insn): Likewise. (record_full_core_open_1): Likewise. * regcache.c (regcache_raw_read_signed): Likewise. (regcache_raw_read_unsigned): Likewise. (regcache_cooked_read_signed): Likewise. (regcache_cooked_read_unsigned): Likewise. * remote-fileio.c (remote_fileio_func_open): Likewise. (remote_fileio_func_rename): Likewise. (remote_fileio_func_unlink): Likewise. (remote_fileio_func_stat): Likewise. (remote_fileio_func_system): Likewise. * remote-mips.c (mips_xfer_memory): Likewise. (mips_load_srec): Likewise. (pmon_end_download): Likewise. * remote.c (new_remote_state): Likewise. (map_regcache_remote_table): Likewise. (remote_register_number_and_offset): Likewise. (init_remote_state): Likewise. (get_memory_packet_size): Likewise. (remote_pass_signals): Likewise. (remote_program_signals): Likewise. (remote_start_remote): Likewise. (remote_check_symbols): Likewise. (remote_query_supported): Likewise. (extended_remote_attach): Likewise. (process_g_packet): Likewise. (store_registers_using_G): Likewise. (putpkt_binary): Likewise. (read_frame): Likewise. (compare_sections_command): Likewise. (remote_hostio_pread): Likewise. (remote_hostio_readlink): Likewise. (remote_file_put): Likewise. (remote_file_get): Likewise. (remote_pid_to_exec_file): Likewise. (_initialize_remote): Likewise. * rs6000-aix-tdep.c (rs6000_aix_ld_info_to_xml): Likewise. (rs6000_aix_core_xfer_shared_libraries_aix): Likewise. * rs6000-tdep.c (ppc_displaced_step_copy_insn): Likewise. (bfd_uses_spe_extensions): Likewise. * s390-linux-tdep.c (s390_displaced_step_copy_insn): Likewise. * score-tdep.c (score7_malloc_and_get_memblock): Likewise. * solib-dsbt.c (decode_loadmap): Likewise. (fetch_loadmap): Likewise. (scan_dyntag): Likewise. (enable_break): Likewise. (dsbt_relocate_main_executable): Likewise. * solib-frv.c (fetch_loadmap): Likewise. (enable_break2): Likewise. (frv_relocate_main_executable): Likewise. * solib-spu.c (spu_relocate_main_executable): Likewise. (spu_bfd_open): Likewise. * solib-svr4.c (lm_info_read): Likewise. (read_program_header): Likewise. (find_program_interpreter): Likewise. (scan_dyntag): Likewise. (elf_locate_base): Likewise. (open_symbol_file_object): Likewise. (read_program_headers_from_bfd): Likewise. (svr4_relocate_main_executable): Likewise. * solib-target.c (solib_target_relocate_section_addresses): Likewise. * solib.c (solib_find_1): Likewise. (exec_file_find): Likewise. (solib_find): Likewise. * source.c (openp): Likewise. (print_source_lines_base): Likewise. (forward_search_command): Likewise. * sparc-ravenscar-thread.c (supply_register_at_address): Likewise. * spu-tdep.c (spu2ppu_prev_register): Likewise. (spu_get_overlay_table): Likewise. * stabsread.c (patch_block_stabs): Likewise. (define_symbol): Likewise. (again:): Likewise. (read_member_functions): Likewise. (read_one_struct_field): Likewise. (read_enum_type): Likewise. (common_block_start): Likewise. * stack.c (read_frame_arg): Likewise. (backtrace_command): Likewise. * stap-probe.c (stap_parse_register_operand): Likewise. * symfile.c (syms_from_objfile_1): Likewise. (find_separate_debug_file): Likewise. (load_command): Likewise. (load_progress): Likewise. (load_section_callback): Likewise. (reread_symbols): Likewise. (add_filename_language): Likewise. (allocate_compunit_symtab): Likewise. (read_target_long_array): Likewise. (simple_read_overlay_table): Likewise. * symtab.c (symbol_set_names): Likewise. (resize_symbol_cache): Likewise. (rbreak_command): Likewise. (completion_list_add_name): Likewise. (completion_list_objc_symbol): Likewise. (add_filename_to_list): Likewise. * target-descriptions.c (maint_print_c_tdesc_cmd): Likewise. * target-memory.c (target_write_memory_blocks): Likewise. * target.c (target_read_string): Likewise. (read_whatever_is_readable): Likewise. (target_read_alloc_1): Likewise. (simple_search_memory): Likewise. (target_fileio_read_alloc_1): Likewise. * tilegx-tdep.c (tilegx_push_dummy_call): Likewise. * top.c (command_line_input): Likewise. * tracefile-tfile.c (tfile_fetch_registers): Likewise. * tracefile.c (tracefile_fetch_registers): Likewise. * tracepoint.c (add_memrange): Likewise. (init_collection_list): Likewise. (add_aexpr): Likewise. (trace_dump_actions): Likewise. (parse_trace_status): Likewise. (parse_tracepoint_definition): Likewise. (parse_tsv_definition): Likewise. (parse_static_tracepoint_marker_definition): Likewise. * tui/tui-file.c (tui_sfileopen): Likewise. (tui_file_adjust_strbuf): Likewise. * tui/tui-io.c (tui_expand_tabs): Likewise. * tui/tui-source.c (tui_set_source_content): Likewise. * typeprint.c (find_global_typedef): Likewise. * ui-file.c (do_ui_file_xstrdup): Likewise. (ui_file_obsavestring): Likewise. (mem_file_write): Likewise. * utils.c (make_hex_string): Likewise. (get_regcomp_error): Likewise. (puts_filtered_tabular): Likewise. (gdb_realpath_keepfile): Likewise. (ldirname): Likewise. (gdb_bfd_errmsg): Likewise. (substitute_path_component): Likewise. * valops.c (search_struct_method): Likewise. (find_oload_champ_namespace_loop): Likewise. * valprint.c (print_decimal_chars): Likewise. (read_string): Likewise. (generic_emit_char): Likewise. * varobj.c (varobj_delete): Likewise. (varobj_value_get_print_value): Likewise. * vaxobsd-tdep.c (vaxobsd_sigtramp_sniffer): Likewise. * windows-tdep.c (display_one_tib): Likewise. * xcoffread.c (read_xcoff_symtab): Likewise. (process_xcoff_symbol): Likewise. (swap_sym): Likewise. (scan_xcoff_symtab): Likewise. (xcoff_initial_scan): Likewise. * xml-support.c (gdb_xml_end_element): Likewise. (xml_process_xincludes): Likewise. (xml_fetch_content_from_file): Likewise. * xml-syscall.c (xml_list_of_syscalls): Likewise. * xstormy16-tdep.c (xstormy16_push_dummy_call): Likewise. gdb/gdbserver/ChangeLog: * ax.c (gdb_parse_agent_expr): Add cast to allocation result assignment. (gdb_unparse_agent_expr): Likewise. * hostio.c (require_data): Likewise. (handle_pread): Likewise. * linux-low.c (disable_regset): Likewise. (fetch_register): Likewise. (store_register): Likewise. (get_dynamic): Likewise. (linux_qxfer_libraries_svr4): Likewise. * mem-break.c (delete_fast_tracepoint_jump): Likewise. (set_fast_tracepoint_jump): Likewise. (uninsert_fast_tracepoint_jumps_at): Likewise. (reinsert_fast_tracepoint_jumps_at): Likewise. (validate_inserted_breakpoint): Likewise. (clone_agent_expr): Likewise. * regcache.c (init_register_cache): Likewise. * remote-utils.c (putpkt_binary_1): Likewise. (decode_M_packet): Likewise. (decode_X_packet): Likewise. (look_up_one_symbol): Likewise. (relocate_instruction): Likewise. (monitor_output): Likewise. * server.c (handle_search_memory): Likewise. (handle_qxfer_exec_file): Likewise. (handle_qxfer_libraries): Likewise. (handle_qxfer): Likewise. (handle_query): Likewise. (handle_v_cont): Likewise. (handle_v_run): Likewise. (captured_main): Likewise. * target.c (write_inferior_memory): Likewise. * thread-db.c (try_thread_db_load_from_dir): Likewise. * tracepoint.c (init_trace_buffer): Likewise. (add_tracepoint_action): Likewise. (add_traceframe): Likewise. (add_traceframe_block): Likewise. (cmd_qtdpsrc): Likewise. (cmd_qtdv): Likewise. (cmd_qtstatus): Likewise. (response_source): Likewise. (response_tsv): Likewise. (cmd_qtnotes): Likewise. (gdb_collect): Likewise. (initialize_tracepoint): Likewise.
2015-09-26 02:08:06 +08:00
gdb_byte *iov = (gdb_byte *) alloca (tdep->size_iovec);
for (i = 0; i < len; i++)
{
if (target_read_memory ((CORE_ADDR) addr, iov, tdep->size_iovec))
{
if (record_debug)
gdb_printf (gdb_stdlog,
"Process record: error "
"reading memory at "
"addr = 0x%s "
"len = %d.\n",
phex_nz (addr,tdep->size_pointer),
tdep->size_iovec);
return -1;
}
tmpaddr = (CORE_ADDR) extract_unsigned_integer (iov,
tdep->size_pointer,
byte_order);
tmpint = (int) extract_unsigned_integer (iov + tdep->size_pointer,
tdep->size_size_t,
byte_order);
if (record_full_arch_list_add_mem (tmpaddr, tmpint))
return -1;
addr += tdep->size_iovec;
}
}
a += tdep->size_size_t;
/* msg_control msg_controllen */
addr = extract_unsigned_integer (a, tdep->size_pointer, byte_order);
a += tdep->size_pointer;
tmpint = (int) extract_unsigned_integer (a, tdep->size_size_t, byte_order);
if (record_full_arch_list_add_mem ((CORE_ADDR) addr, tmpint))
return -1;
return 0;
}
/* When the architecture process record get a Linux syscall
instruction, it will get a Linux syscall number of this
architecture and convert it to the Linux syscall number "num" which
is internal to GDB. Most Linux syscalls across architectures in
Linux would be similar and mostly differ by sizes of types and
structures. This sizes are put to "tdep".
Record the values of the registers and memory that will be changed
in current system call.
Return -1 if something wrong. */
int
record_linux_system_call (enum gdb_syscall syscall,
struct regcache *regcache,
struct linux_record_tdep *tdep)
{
s/get_regcache_arch (regcache)/regcache->arch ()/g This patches removes get_regcache_arch, and use regache->arch () instead. The motivation of this change is that I am going to move some basic stuff into a base class of regcache. I don't need to update "client" code regcache->arch (). On the other hand, this patch shortens the code a little bit. gdb: 2017-10-25 Yao Qi <yao.qi@linaro.org> * aarch32-linux-nat.c (aarch32_gp_regcache_supply): Use regcache->arch () instead get_regcache_arch. * aarch64-fbsd-nat.c (aarch64_fbsd_fetch_inferior_registers): Likewise. (aarch64_fbsd_store_inferior_registers): Likewise. * aarch64-linux-nat.c (fetch_gregs_from_thread): Likewise. (store_gregs_to_thread): Likewise. (fetch_fpregs_from_thread): Likewise. (store_fpregs_to_thread): Likewise. * aarch64-tdep.c (aarch64_extract_return_value): Likewise. (aarch64_store_return_value): Likewise. (aarch64_software_single_step): Likewise. * aix-thread.c (aix_thread_wait): Likewise. (supply_reg32): Likewise. (supply_sprs64): Likewise. (supply_sprs32): Likewise. (fill_gprs64): Likewise. (fill_gprs32): Likewise. (fill_sprs64): Likewise. (fill_sprs32): Likewise. (store_regs_user_thread): Likewise. (store_regs_kernel_thread): Likewise. * alpha-bsd-nat.c (alphabsd_fetch_inferior_registers): Likewise. (alphabsd_store_inferior_registers): Likewise. * alpha-tdep.c (alpha_extract_return_value): Likewise. (alpha_store_return_value): Likewise. (alpha_deal_with_atomic_sequence): Likewise. (alpha_next_pc): Likewise. (alpha_software_single_step): Likewise. * amd64-bsd-nat.c (amd64bsd_fetch_inferior_registers): Likewise. (amd64bsd_store_inferior_registers): Likewise. * amd64-linux-nat.c (amd64_linux_fetch_inferior_registers): Likewise. (amd64_linux_store_inferior_registers): Likewise. * amd64-nat.c (amd64_supply_native_gregset): Likewise. (amd64_collect_native_gregset): Likewise. * amd64-obsd-tdep.c (amd64obsd_supply_uthread): Likewise. (amd64obsd_collect_uthread): Likewise. * amd64-tdep.c (amd64_supply_fpregset): Likewise. (amd64_collect_fpregset): Likewise. (amd64_supply_fxsave): Likewise. (amd64_supply_xsave): Likewise. (amd64_collect_fxsave): Likewise. (amd64_collect_xsave): Likewise. * arc-tdep.c (arc_write_pc): Likewise. * arch-utils.c (default_skip_permanent_breakpoint): Likewise. * arm-fbsd-nat.c (arm_fbsd_fetch_inferior_registers): Likewise. (arm_fbsd_store_inferior_registers): Likewise. * arm-linux-nat.c (fetch_vfp_regs): Likewise. (store_vfp_regs): Likewise. (arm_linux_fetch_inferior_registers): Likewise. (arm_linux_store_inferior_registers): Likewise. * arm-linux-tdep.c (arm_linux_supply_gregset): Likewise. (arm_linux_sigreturn_next_pc): Likewise. (arm_linux_get_next_pcs_syscall_next_pc): Likewise. * arm-nbsd-nat.c (arm_supply_gregset): Likewise. (fetch_register): Likewise. (store_register): Likewise. * arm-tdep.c (arm_is_thumb): Likewise. (displaced_in_arm_mode): Likewise. (bx_write_pc): Likewise. (arm_get_next_pcs_addr_bits_remove): Likewise. (arm_software_single_step): Likewise. (arm_extract_return_value): Likewise. (arm_store_return_value): Likewise. (arm_write_pc): Likewise. * bfin-tdep.c (bfin_extract_return_value): Likewise. * bsd-uthread.c (bsd_uthread_fetch_registers): Likewise. (bsd_uthread_store_registers): Likewise. * core-regset.c (fetch_core_registers): Likewise. * corelow.c (get_core_registers): Likewise. * cris-tdep.c (cris_store_return_value): Likewise. (cris_extract_return_value): Likewise. (find_step_target): Likewise. (find_step_target): Likewise. (cris_software_single_step): Likewise. * ctf.c (ctf_fetch_registers): Likewise. * darwin-nat.c (cancel_breakpoint): Likewise. * fbsd-tdep.c (fbsd_collect_thread_registers): Likewise. * frv-tdep.c (frv_extract_return_value): Likewise. * ft32-tdep.c (ft32_store_return_value): Likewise. (ft32_extract_return_value): Likewise. * go32-nat.c (fetch_register): Likewise. (go32_fetch_registers): Likewise. (go32_store_registers): Likewise. (store_register): Likewise. * h8300-tdep.c (h8300_extract_return_value): Likewise. (h8300_store_return_value): Likewise. * hppa-linux-nat.c (fetch_register): Likewise. (store_register): Likewise. (hppa_linux_fetch_inferior_registers): Likewise. (hppa_linux_store_inferior_registers): Likewise. * i386-darwin-nat.c (i386_darwin_fetch_inferior_registers): Likewise. (i386_darwin_store_inferior_registers): Likewise. * i386-gnu-nat.c (gnu_fetch_registers): Likewise. (gnu_store_registers): Likewise. * i386-linux-nat.c (fetch_register): Likewise. (store_register): Likewise. (supply_gregset): Likewise. (fill_gregset): Likewise. (i386_linux_fetch_inferior_registers): Likewise. (i386_linux_store_inferior_registers): Likewise. (i386_linux_resume): Likewise. * i386-linux-tdep.c (i386_linux_get_syscall_number_from_regcache): Likewise. * i386-nto-tdep.c (i386nto_supply_gregset): Likewise. * i386-obsd-nat.c (i386obsd_supply_pcb): Likewise. * i386-obsd-tdep.c (i386obsd_supply_uthread): Likewise. (i386obsd_collect_uthread): Likewise. * i386-tdep.c (i386_mmx_regnum_to_fp_regnum): Likewise. (i386_supply_gregset): Likewise. (i386_collect_gregset): Likewise. (i386_supply_fpregset): Likewise. (i386_collect_fpregset): Likewise. (i386_mpx_bd_base): Likewise. * i386-v4-nat.c (supply_fpregset): Likewise. (fill_fpregset): Likewise. * i387-tdep.c (i387_supply_fsave): Likewise. (i387_collect_fsave): Likewise. (i387_supply_fxsave): Likewise. (i387_collect_fxsave): Likewise. (i387_supply_xsave): Likewise. (i387_collect_xsave): Likewise. * ia64-linux-nat.c (ia64_linux_fetch_registers): Likewise. (ia64_linux_store_registers): Likewise. * ia64-tdep.c (ia64_access_rse_reg): Likewise. (ia64_extract_return_value): Likewise. (ia64_store_return_value): Likewise. (find_func_descr): Likewise. * inf-child.c (inf_child_fetch_inferior_registers): Likewise. * inf-ptrace.c (inf_ptrace_fetch_registers): Likewise. (inf_ptrace_store_registers): Likewise. * infrun.c (use_displaced_stepping): Likewise. (displaced_step_prepare_throw): Likewise. (resume): Likewise. (proceed): Likewise. (do_target_wait): Likewise. (adjust_pc_after_break): Likewise. (handle_inferior_event_1): Likewise. (handle_signal_stop): Likewise. (save_infcall_suspend_state): Likewise. (restore_infcall_suspend_state): Likewise. * iq2000-tdep.c (iq2000_extract_return_value): Likewise. * jit.c (jit_frame_prev_register): Likewise. * linux-nat.c (save_stop_reason): Likewise. (linux_nat_wait_1): Likewise. (resume_stopped_resumed_lwps): Likewise. * linux-record.c (record_linux_sockaddr): Likewise. (record_linux_msghdr): Likewise. (record_linux_system_call): Likewise. * linux-tdep.c (linux_collect_thread_registers): Likewise. * lm32-tdep.c (lm32_extract_return_value): Likewise. (lm32_store_return_value): Likewise. * m32c-tdep.c (m32c_read_flg): Likewise. (m32c_pseudo_register_read): Likewise. (m32c_pseudo_register_write): Likewise. * m32r-linux-tdep.c (m32r_linux_supply_gregset): Likewise. (m32r_linux_collect_gregset): Likewise. * m32r-tdep.c (m32r_store_return_value): Likewise. (m32r_extract_return_value): Likewise. * m68k-bsd-nat.c (m68kbsd_supply_fpregset): Likewise. (m68kbsd_collect_fpregset): Likewise. * m68k-bsd-tdep.c (m68kbsd_supply_fpregset): Likewise. * m68k-linux-nat.c (fetch_register): Likewise. (old_fetch_inferior_registers): Likewise. (old_store_inferior_registers): Likewise. (store_regs): Likewise. * m68k-tdep.c (m68k_svr4_extract_return_value): Likewise. (m68k_svr4_store_return_value): Likewise. * m88k-tdep.c (m88k_store_arguments): Likewise. * mi/mi-main.c (mi_cmd_data_list_changed_registers): Likewise. (mi_cmd_data_write_register_values): Likewise. * mips-fbsd-nat.c (mips_fbsd_fetch_inferior_registers): Likewise. (mips_fbsd_store_inferior_registers): Likewise. * mips-fbsd-tdep.c (mips_fbsd_supply_fpregs): Likewise. (mips_fbsd_supply_gregs): Likewise. (mips_fbsd_collect_fpregs): Likewise. (mips_fbsd_collect_gregs): Likewise. (mips_fbsd_supply_fpregset): Likewise. (mips_fbsd_collect_fpregset): Likewise. (mips_fbsd_supply_gregset): Likewise. (mips_fbsd_collect_gregset): Likewise. * mips-linux-nat.c (supply_gregset): Likewise. (fill_gregset): Likewise. (supply_fpregset): Likewise. (fill_fpregset): Likewise. * mips-linux-tdep.c (mips_supply_gregset): Likewise. (mips_fill_gregset): Likewise. (mips_supply_fpregset): Likewise. (mips_fill_fpregset): Likewise. (mips64_supply_gregset): Likewise. (micromips_linux_sigframe_validate): Likewise. * mips-nbsd-nat.c (mipsnbsd_fetch_inferior_registers): Likewise. (mipsnbsd_fetch_inferior_registers): Likewise. (mipsnbsd_store_inferior_registers): Likewise. * mips-nbsd-tdep.c (mipsnbsd_supply_fpregset): Likewise. (mipsnbsd_supply_gregset): Likewise. (mipsnbsd_iterate_over_regset_sections): Likewise. (mipsnbsd_supply_reg): Likewise. (mipsnbsd_supply_fpreg): Likewise. * mips-tdep.c (mips_in_frame_stub): Likewise. (mips_dummy_id): Likewise. (is_octeon_bbit_op): Likewise. (micromips_bc1_pc): Likewise. (extended_mips16_next_pc): Likewise. (mips16_next_pc): Likewise. (deal_with_atomic_sequence): Likewise. * moxie-tdep.c (moxie_process_readu): Likewise. * nios2-tdep.c (nios2_get_next_pc): Likewise. * nto-procfs.c (procfs_store_registers): Likewise. * ppc-fbsd-nat.c (ppcfbsd_fetch_inferior_registers): Likewise. (ppcfbsd_store_inferior_registers): Likewise. * ppc-linux-nat.c (fetch_vsx_register): Likewise. (fetch_altivec_register): Likewise. (get_spe_registers): Likewise. (fetch_spe_register): Likewise. (fetch_altivec_registers): Likewise. (fetch_all_gp_regs): Likewise. (fetch_all_fp_regs): Likewise. (store_vsx_register): Likewise. (store_altivec_register): Likewise. (set_spe_registers): Likewise. (store_spe_register): Likewise. (store_altivec_registers): Likewise. (store_all_gp_regs): Likewise. (store_all_fp_regs): Likewise. * ppc-linux-tdep.c (ppc_linux_supply_gregset): Likewise. (ppc_linux_collect_gregset): Likewise. (ppc_canonicalize_syscall): Likewise. (ppc_linux_record_signal): Likewise. (ppu2spu_prev_register): Likewise. * ppc-nbsd-nat.c (ppcnbsd_supply_pcb): Likewise. * ppc-obsd-nat.c (ppcobsd_fetch_registers): Likewise. (ppcobsd_store_registers): Likewise. * ppc-ravenscar-thread.c (ppc_ravenscar_generic_fetch_registers): Likewise. (ppc_ravenscar_generic_store_registers): Likewise. * procfs.c (procfs_fetch_registers): Likewise. (procfs_store_registers): Likewise. * ravenscar-thread.c (ravenscar_fetch_registers): Likewise. (ravenscar_store_registers): Likewise. (ravenscar_prepare_to_store): Likewise. * record-btrace.c (record_btrace_fetch_registers): Likewise. * record-full.c (record_full_wait_1): Likewise. (record_full_registers_change): Likewise. (record_full_store_registers): Likewise. (record_full_core_fetch_registers): Likewise. (record_full_save): Likewise. (record_full_goto_insn): Likewise. * regcache.c (regcache_register_size): Likewise. (get_regcache_arch): Remove. (regcache_read_pc): Likewise. * regcache.h (get_regcache_arch): Remove. * remote-sim.c (gdbsim_fetch_register): Likewise. (gdbsim_store_register): Likewise. * remote.c (fetch_register_using_p): Likewise. (send_g_packet): Likewise. (remote_prepare_to_store): Likewise. (store_registers_using_G): Likewise. * reverse.c (save_bookmark_command): Likewise. (goto_bookmark_command): Likewise. * rs6000-aix-tdep.c (branch_dest): Likewise. * rs6000-nat.c (rs6000_ptrace64): Likewise. (fetch_register): Likewise. * rs6000-tdep.c (ppc_supply_reg): Likewise. (ppc_collect_reg): Likewise. (ppc_collect_gregset): Likewise. (ppc_collect_fpregset): Likewise. (ppc_collect_vsxregset): Likewise. (ppc_collect_vrregset): Likewise. (ppc_displaced_step_hw_singlestep): Likewise. (rs6000_pseudo_register_read): Likewise. (rs6000_pseudo_register_write): Likewise. * s390-linux-nat.c (supply_gregset): Likewise. (fill_gregset): Likewise. (s390_linux_fetch_inferior_registers): Likewise. * s390-linux-tdep.c (s390_write_pc): Likewise. (s390_software_single_step): Likewise. (s390_all_but_pc_registers_record): Likewise. (s390_linux_syscall_record): Likewise. * sentinel-frame.c (sentinel_frame_prev_arch): Likewise. * sh-nbsd-nat.c (shnbsd_fetch_inferior_registers): Likewise. (shnbsd_store_inferior_registers): Likewise. * sh-tdep.c (sh_extract_return_value_nofpu): Likewise. (sh_extract_return_value_fpu): Likewise. (sh_store_return_value_nofpu): Likewise. (sh_corefile_supply_regset): Likewise. (sh_corefile_collect_regset): Likewise. * sh64-tdep.c (sh64_extract_return_value): Likewise. (sh64_store_return_value): Likewise. * sparc-linux-tdep.c (sparc32_linux_collect_core_fpregset): Likewise. * sparc-nat.c (sparc_fetch_inferior_registers): Likewise. (sparc_store_inferior_registers): Likewise. * sparc-ravenscar-thread.c (register_in_thread_descriptor_p): Likewise. (sparc_ravenscar_prepare_to_store): Likewise. * sparc-tdep.c (sparc32_store_arguments): Likewise. (sparc_analyze_control_transfer): Likewise. (sparc_step_trap): Likewise. (sparc_software_single_step): Likewise. (sparc32_gdbarch_init): Likewise. (sparc_supply_rwindow): Likewise. (sparc_collect_rwindow): Likewise. * sparc64-linux-tdep.c (sparc64_linux_collect_core_fpregset): Likewise. * sparc64-nbsd-nat.c (sparc64nbsd_supply_gregset): Likewise. (sparc64nbsd_collect_gregset): Likewise. (sparc64nbsd_supply_fpregset): Likewise. (sparc64nbsd_collect_fpregset): Likewise. * sparc64-tdep.c (sparc64_store_arguments): Likewise. (sparc64_supply_gregset): Likewise. (sparc64_collect_gregset): Likewise. (sparc64_supply_fpregset): Likewise. (sparc64_collect_fpregset): Likewise. * spu-linux-nat.c (spu_fetch_inferior_registers): Likewise. * spu-tdep.c (spu_unwind_sp): Likewise. (spu2ppu_prev_register): Likewise. (spu_memory_remove_breakpoint): Likewise. * stack.c (return_command): Likewise. * tic6x-tdep.c (tic6x_extract_signed_field): Likewise. * tracefile-tfile.c (tfile_fetch_registers): Likewise. * tracefile.c (trace_save_ctf): Likewise. * windows-nat.c (do_windows_fetch_inferior_registers): Likewise. (do_windows_store_inferior_registers): Likewise. (windows_resume): Likewise. * xtensa-linux-nat.c (fill_gregset): Likewise. (supply_gregset_reg): Likewise. * xtensa-tdep.c (xtensa_register_write_masked): Likewise. (xtensa_register_read_masked): Likewise. (xtensa_supply_gregset): Likewise. (xtensa_extract_return_value): Likewise. (xtensa_store_return_value): Likewise.
2017-10-25 23:37:03 +08:00
struct gdbarch *gdbarch = regcache->arch ();
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
ULONGEST tmpulongest;
CORE_ADDR tmpaddr;
int tmpint;
switch (syscall)
{
case gdb_sys_restart_syscall:
break;
case gdb_sys_exit:
Do target_terminal_ours in query & friends instead of in all callers Any time a caller calls query & friends / prompt_for_continue without ensuring that gdb owns the terminal for input is a bug. So do that in defaulted_query / prompt_for_continue directly instead. An example of a case where we currently miss calling target_terminal_ours is internal_error. Ever since defaulted_query was made to use gdb_readline_callback, there's no way to answer the internal error query if the internal error happens while the target is has the terminal: (gdb) c Continuing. .../src/gdb/linux-nat.c:1676: internal-error: linux_nat_resume: Assertion `dummy_counter < 10' failed. A problem internal to GDB has been detected, further debugging may prove unreliable. Quit this debugging session? (y or n) _ Entering 'y' or 'n' does not work, GDB does not respond. gdb/ChangeLog: 2016-04-12 Pedro Alves <palves@redhat.com> PR gdb/19828 * gnu-nat.c (inf_validate_task_sc): Don't call target_terminal_ours / target_terminal_inferior around query. * i386-tdep.c (i386_record_lea_modrm, i386_process_record): Don't call target_terminal_ours / target_terminal_inferior around yquery. * linux-record.c (record_linux_system_call): Don't call target_terminal_ours / target_terminal_inferior around yquery. * nto-procfs.c (interrupt_query): Don't call target_terminal_ours / target_terminal_inferior around query. * record-full.c (record_full_check_insn_num): Remove 'set_terminal' parameter. Don't call target_terminal_ours / target_terminal_inferior around query. (record_full_message, record_full_registers_change) (record_full_xfer_partial): Adjust. * remote.c (interrupt_query): Don't call target_terminal_ours / target_terminal_inferior around query. * utils.c (defaulted_query): Install cleanup to restore target terminal. Put target_terminal_ours_for_output in effect while defaulted producing, and target_terminal_ours in in effect while handling input. (prompt_for_continue): Install cleanup to restore target terminal. Put target_terminal_ours in in effect while handling input.
2016-04-12 23:49:32 +08:00
if (yquery (_("The next instruction is syscall exit. "
"It will make the program exit. "
"Do you want to stop the program?")))
return 1;
break;
case gdb_sys_fork:
break;
case gdb_sys_read:
case gdb_sys_readlink:
case gdb_sys_recv:
regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
if (record_mem_at_reg (regcache, tdep->arg2, (int) tmpulongest))
return -1;
break;
case gdb_sys_write:
case gdb_sys_open:
case gdb_sys_close:
break;
case gdb_sys_waitpid:
regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
if (tmpulongest)
if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
tdep->size_int))
return -1;
break;
case gdb_sys_creat:
case gdb_sys_link:
case gdb_sys_unlink:
case gdb_sys_execve:
case gdb_sys_chdir:
break;
case gdb_sys_time:
regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
if (tmpulongest)
if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
tdep->size_time_t))
return -1;
break;
case gdb_sys_mknod:
case gdb_sys_chmod:
case gdb_sys_lchown16:
case gdb_sys_ni_syscall17:
break;
case gdb_sys_stat:
case gdb_sys_fstat:
case gdb_sys_lstat:
if (record_mem_at_reg (regcache, tdep->arg2,
tdep->size__old_kernel_stat))
return -1;
break;
case gdb_sys_lseek:
case gdb_sys_getpid:
case gdb_sys_mount:
case gdb_sys_oldumount:
case gdb_sys_setuid16:
case gdb_sys_getuid16:
case gdb_sys_stime:
break;
case gdb_sys_ptrace:
regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
if (tmpulongest == RECORD_PTRACE_PEEKTEXT
|| tmpulongest == RECORD_PTRACE_PEEKDATA
|| tmpulongest == RECORD_PTRACE_PEEKUSR)
{
if (record_mem_at_reg (regcache, tdep->arg4, 4))
return -1;
}
break;
case gdb_sys_alarm:
case gdb_sys_pause:
case gdb_sys_utime:
case gdb_sys_ni_syscall31:
case gdb_sys_ni_syscall32:
case gdb_sys_access:
case gdb_sys_nice:
case gdb_sys_ni_syscall35:
case gdb_sys_sync:
case gdb_sys_kill:
case gdb_sys_rename:
case gdb_sys_mkdir:
case gdb_sys_rmdir:
case gdb_sys_dup:
break;
case gdb_sys_pipe:
case gdb_sys_pipe2:
if (record_mem_at_reg (regcache, tdep->arg1, tdep->size_int * 2))
return -1;
break;
case gdb_sys_getrandom:
regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
if (record_mem_at_reg (regcache, tdep->arg1, tmpulongest))
return -1;
break;
case gdb_sys_times:
if (record_mem_at_reg (regcache, tdep->arg1, tdep->size_tms))
return -1;
break;
case gdb_sys_ni_syscall44:
case gdb_sys_brk:
case gdb_sys_setgid16:
case gdb_sys_getgid16:
case gdb_sys_signal:
case gdb_sys_geteuid16:
case gdb_sys_getegid16:
case gdb_sys_acct:
case gdb_sys_umount:
case gdb_sys_ni_syscall53:
break;
case gdb_sys_ioctl:
/* XXX Need to add a lot of support of other ioctl requests. */
regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
if (tmpulongest == tdep->ioctl_FIOCLEX
|| tmpulongest == tdep->ioctl_FIONCLEX
|| tmpulongest == tdep->ioctl_FIONBIO
|| tmpulongest == tdep->ioctl_FIOASYNC
|| tmpulongest == tdep->ioctl_TCSETS
|| tmpulongest == tdep->ioctl_TCSETSW
|| tmpulongest == tdep->ioctl_TCSETSF
|| tmpulongest == tdep->ioctl_TCSETA
|| tmpulongest == tdep->ioctl_TCSETAW
|| tmpulongest == tdep->ioctl_TCSETAF
|| tmpulongest == tdep->ioctl_TCSBRK
|| tmpulongest == tdep->ioctl_TCXONC
|| tmpulongest == tdep->ioctl_TCFLSH
|| tmpulongest == tdep->ioctl_TIOCEXCL
|| tmpulongest == tdep->ioctl_TIOCNXCL
|| tmpulongest == tdep->ioctl_TIOCSCTTY
|| tmpulongest == tdep->ioctl_TIOCSPGRP
|| tmpulongest == tdep->ioctl_TIOCSTI
|| tmpulongest == tdep->ioctl_TIOCSWINSZ
|| tmpulongest == tdep->ioctl_TIOCMBIS
|| tmpulongest == tdep->ioctl_TIOCMBIC
|| tmpulongest == tdep->ioctl_TIOCMSET
|| tmpulongest == tdep->ioctl_TIOCSSOFTCAR
|| tmpulongest == tdep->ioctl_TIOCCONS
|| tmpulongest == tdep->ioctl_TIOCSSERIAL
|| tmpulongest == tdep->ioctl_TIOCPKT
|| tmpulongest == tdep->ioctl_TIOCNOTTY
|| tmpulongest == tdep->ioctl_TIOCSETD
|| tmpulongest == tdep->ioctl_TCSBRKP
|| tmpulongest == tdep->ioctl_TIOCTTYGSTRUCT
|| tmpulongest == tdep->ioctl_TIOCSBRK
|| tmpulongest == tdep->ioctl_TIOCCBRK
|| tmpulongest == tdep->ioctl_TCSETS2
|| tmpulongest == tdep->ioctl_TCSETSW2
|| tmpulongest == tdep->ioctl_TCSETSF2
|| tmpulongest == tdep->ioctl_TIOCSPTLCK
|| tmpulongest == tdep->ioctl_TIOCSERCONFIG
|| tmpulongest == tdep->ioctl_TIOCSERGWILD
|| tmpulongest == tdep->ioctl_TIOCSERSWILD
|| tmpulongest == tdep->ioctl_TIOCSLCKTRMIOS
|| tmpulongest == tdep->ioctl_TIOCSERGETMULTI
|| tmpulongest == tdep->ioctl_TIOCSERSETMULTI
|| tmpulongest == tdep->ioctl_TIOCMIWAIT
|| tmpulongest == tdep->ioctl_TIOCSHAYESESP)
{
/* Nothing to do. */
}
else if (tmpulongest == tdep->ioctl_TCGETS
|| tmpulongest == tdep->ioctl_TCGETA
|| tmpulongest == tdep->ioctl_TIOCGLCKTRMIOS)
{
if (record_mem_at_reg (regcache, tdep->arg3,
tdep->size_termios))
return -1;
}
else if (tmpulongest == tdep->ioctl_TIOCGPGRP
|| tmpulongest == tdep->ioctl_TIOCGSID)
{
if (record_mem_at_reg (regcache, tdep->arg3, tdep->size_pid_t))
return -1;
}
else if (tmpulongest == tdep->ioctl_TIOCOUTQ
|| tmpulongest == tdep->ioctl_TIOCMGET
|| tmpulongest == tdep->ioctl_TIOCGSOFTCAR
|| tmpulongest == tdep->ioctl_FIONREAD
|| tmpulongest == tdep->ioctl_TIOCINQ
|| tmpulongest == tdep->ioctl_TIOCGETD
|| tmpulongest == tdep->ioctl_TIOCGPTN
|| tmpulongest == tdep->ioctl_TIOCSERGETLSR)
{
if (record_mem_at_reg (regcache, tdep->arg3, tdep->size_int))
return -1;
}
else if (tmpulongest == tdep->ioctl_TIOCGWINSZ)
{
if (record_mem_at_reg (regcache, tdep->arg3,
tdep->size_winsize))
return -1;
}
else if (tmpulongest == tdep->ioctl_TIOCLINUX)
{
/* This syscall affects a char-size memory. */
if (record_mem_at_reg (regcache, tdep->arg3, 1))
return -1;
}
else if (tmpulongest == tdep->ioctl_TIOCGSERIAL)
{
if (record_mem_at_reg (regcache, tdep->arg3,
tdep->size_serial_struct))
return -1;
}
else if (tmpulongest == tdep->ioctl_TCGETS2)
{
if (record_mem_at_reg (regcache, tdep->arg3,
tdep->size_termios2))
return -1;
}
else if (tmpulongest == tdep->ioctl_FIOQSIZE)
{
if (record_mem_at_reg (regcache, tdep->arg3, tdep->size_loff_t))
return -1;
}
else if (tmpulongest == tdep->ioctl_TIOCGICOUNT)
{
if (record_mem_at_reg (regcache, tdep->arg3,
tdep->size_serial_icounter_struct))
return -1;
}
else if (tmpulongest == tdep->ioctl_TIOCGHAYESESP)
{
if (record_mem_at_reg (regcache, tdep->arg3,
tdep->size_hayes_esp_config))
return -1;
}
else if (tmpulongest == tdep->ioctl_TIOCSERGSTRUCT)
{
gdb_printf (gdb_stderr,
_("Process record and replay target doesn't "
"support ioctl request TIOCSERGSTRUCT\n"));
return 1;
}
else
{
gdb_printf (gdb_stderr,
_("Process record and replay target doesn't "
"support ioctl request 0x%s.\n"),
OUTPUT_REG (tmpulongest, tdep->arg2));
return 1;
}
break;
case gdb_sys_fcntl:
/* XXX */
regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
sys_fcntl:
if (tmpulongest == tdep->fcntl_F_GETLK)
{
if (record_mem_at_reg (regcache, tdep->arg3, tdep->size_flock))
return -1;
}
break;
case gdb_sys_ni_syscall56:
case gdb_sys_setpgid:
case gdb_sys_ni_syscall58:
break;
case gdb_sys_olduname:
if (record_mem_at_reg (regcache, tdep->arg1,
tdep->size_oldold_utsname))
return -1;
break;
case gdb_sys_umask:
case gdb_sys_chroot:
break;
case gdb_sys_ustat:
if (record_mem_at_reg (regcache, tdep->arg2, tdep->size_ustat))
return -1;
break;
case gdb_sys_dup2:
case gdb_sys_getppid:
case gdb_sys_getpgrp:
case gdb_sys_setsid:
break;
case gdb_sys_sigaction:
if (record_mem_at_reg (regcache, tdep->arg3,
tdep->size_old_sigaction))
return -1;
break;
case gdb_sys_sgetmask:
case gdb_sys_ssetmask:
case gdb_sys_setreuid16:
case gdb_sys_setregid16:
case gdb_sys_sigsuspend:
break;
case gdb_sys_sigpending:
if (record_mem_at_reg (regcache, tdep->arg1,
tdep->size_old_sigset_t))
return -1;
break;
case gdb_sys_sethostname:
case gdb_sys_setrlimit:
break;
case gdb_sys_old_getrlimit:
if (record_mem_at_reg (regcache, tdep->arg2, tdep->size_rlimit))
return -1;
break;
case gdb_sys_getrusage:
if (record_mem_at_reg (regcache, tdep->arg2, tdep->size_rusage))
return -1;
break;
case gdb_sys_gettimeofday:
if (record_mem_at_reg (regcache, tdep->arg1, tdep->size_timeval)
|| record_mem_at_reg (regcache, tdep->arg2, tdep->size_timezone))
return -1;
break;
case gdb_sys_settimeofday:
break;
case gdb_sys_getgroups16:
regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
if (tmpulongest)
{
ULONGEST gidsetsize;
regcache_raw_read_unsigned (regcache, tdep->arg1,
&gidsetsize);
tmpint = tdep->size_old_gid_t * (int) gidsetsize;
if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest, tmpint))
return -1;
}
break;
case gdb_sys_setgroups16:
break;
case gdb_old_select:
{
unsigned long sz_sel_arg = tdep->size_long + tdep->size_pointer * 4;
gdb_byte *a = (gdb_byte *) alloca (sz_sel_arg);
CORE_ADDR inp, outp, exp, tvp;
regcache_raw_read_unsigned (regcache, tdep->arg1,
&tmpulongest);
if (tmpulongest)
{
if (target_read_memory (tmpulongest, a, sz_sel_arg))
{
if (record_debug)
gdb_printf (gdb_stdlog,
"Process record: error reading memory "
"at addr = 0x%s len = %lu.\n",
OUTPUT_REG (tmpulongest, tdep->arg1),
sz_sel_arg);
return -1;
}
/* Skip n. */
a += tdep->size_long;
inp = extract_unsigned_integer (a, tdep->size_pointer, byte_order);
a += tdep->size_pointer;
outp = extract_unsigned_integer (a, tdep->size_pointer, byte_order);
a += tdep->size_pointer;
exp = extract_unsigned_integer (a, tdep->size_pointer, byte_order);
a += tdep->size_pointer;
tvp = extract_unsigned_integer (a, tdep->size_pointer, byte_order);
if (inp)
if (record_full_arch_list_add_mem (inp, tdep->size_fd_set))
return -1;
if (outp)
if (record_full_arch_list_add_mem (outp, tdep->size_fd_set))
return -1;
if (exp)
if (record_full_arch_list_add_mem (exp, tdep->size_fd_set))
return -1;
if (tvp)
if (record_full_arch_list_add_mem (tvp, tdep->size_timeval))
return -1;
}
}
break;
case gdb_sys_symlink:
break;
case gdb_sys_uselib:
case gdb_sys_swapon:
break;
case gdb_sys_reboot:
Do target_terminal_ours in query & friends instead of in all callers Any time a caller calls query & friends / prompt_for_continue without ensuring that gdb owns the terminal for input is a bug. So do that in defaulted_query / prompt_for_continue directly instead. An example of a case where we currently miss calling target_terminal_ours is internal_error. Ever since defaulted_query was made to use gdb_readline_callback, there's no way to answer the internal error query if the internal error happens while the target is has the terminal: (gdb) c Continuing. .../src/gdb/linux-nat.c:1676: internal-error: linux_nat_resume: Assertion `dummy_counter < 10' failed. A problem internal to GDB has been detected, further debugging may prove unreliable. Quit this debugging session? (y or n) _ Entering 'y' or 'n' does not work, GDB does not respond. gdb/ChangeLog: 2016-04-12 Pedro Alves <palves@redhat.com> PR gdb/19828 * gnu-nat.c (inf_validate_task_sc): Don't call target_terminal_ours / target_terminal_inferior around query. * i386-tdep.c (i386_record_lea_modrm, i386_process_record): Don't call target_terminal_ours / target_terminal_inferior around yquery. * linux-record.c (record_linux_system_call): Don't call target_terminal_ours / target_terminal_inferior around yquery. * nto-procfs.c (interrupt_query): Don't call target_terminal_ours / target_terminal_inferior around query. * record-full.c (record_full_check_insn_num): Remove 'set_terminal' parameter. Don't call target_terminal_ours / target_terminal_inferior around query. (record_full_message, record_full_registers_change) (record_full_xfer_partial): Adjust. * remote.c (interrupt_query): Don't call target_terminal_ours / target_terminal_inferior around query. * utils.c (defaulted_query): Install cleanup to restore target terminal. Put target_terminal_ours_for_output in effect while defaulted producing, and target_terminal_ours in in effect while handling input. (prompt_for_continue): Install cleanup to restore target terminal. Put target_terminal_ours in in effect while handling input.
2016-04-12 23:49:32 +08:00
if (yquery (_("The next instruction is syscall reboot. "
"It will restart the computer. "
"Do you want to stop the program?")))
return 1;
break;
case gdb_old_readdir:
if (record_mem_at_reg (regcache, tdep->arg2, tdep->size_old_dirent))
return -1;
break;
case gdb_old_mmap:
break;
case gdb_sys_munmap:
{
ULONGEST len;
regcache_raw_read_unsigned (regcache, tdep->arg1,
&tmpulongest);
regcache_raw_read_unsigned (regcache, tdep->arg2, &len);
if (record_full_memory_query)
{
Do target_terminal_ours in query & friends instead of in all callers Any time a caller calls query & friends / prompt_for_continue without ensuring that gdb owns the terminal for input is a bug. So do that in defaulted_query / prompt_for_continue directly instead. An example of a case where we currently miss calling target_terminal_ours is internal_error. Ever since defaulted_query was made to use gdb_readline_callback, there's no way to answer the internal error query if the internal error happens while the target is has the terminal: (gdb) c Continuing. .../src/gdb/linux-nat.c:1676: internal-error: linux_nat_resume: Assertion `dummy_counter < 10' failed. A problem internal to GDB has been detected, further debugging may prove unreliable. Quit this debugging session? (y or n) _ Entering 'y' or 'n' does not work, GDB does not respond. gdb/ChangeLog: 2016-04-12 Pedro Alves <palves@redhat.com> PR gdb/19828 * gnu-nat.c (inf_validate_task_sc): Don't call target_terminal_ours / target_terminal_inferior around query. * i386-tdep.c (i386_record_lea_modrm, i386_process_record): Don't call target_terminal_ours / target_terminal_inferior around yquery. * linux-record.c (record_linux_system_call): Don't call target_terminal_ours / target_terminal_inferior around yquery. * nto-procfs.c (interrupt_query): Don't call target_terminal_ours / target_terminal_inferior around query. * record-full.c (record_full_check_insn_num): Remove 'set_terminal' parameter. Don't call target_terminal_ours / target_terminal_inferior around query. (record_full_message, record_full_registers_change) (record_full_xfer_partial): Adjust. * remote.c (interrupt_query): Don't call target_terminal_ours / target_terminal_inferior around query. * utils.c (defaulted_query): Install cleanup to restore target terminal. Put target_terminal_ours_for_output in effect while defaulted producing, and target_terminal_ours in in effect while handling input. (prompt_for_continue): Install cleanup to restore target terminal. Put target_terminal_ours in in effect while handling input.
2016-04-12 23:49:32 +08:00
if (yquery (_("\
The next instruction is syscall munmap.\n\
It will free the memory addr = 0x%s len = %u.\n\
It will make record target cannot record some memory change.\n\
Do you want to stop the program?"),
Do target_terminal_ours in query & friends instead of in all callers Any time a caller calls query & friends / prompt_for_continue without ensuring that gdb owns the terminal for input is a bug. So do that in defaulted_query / prompt_for_continue directly instead. An example of a case where we currently miss calling target_terminal_ours is internal_error. Ever since defaulted_query was made to use gdb_readline_callback, there's no way to answer the internal error query if the internal error happens while the target is has the terminal: (gdb) c Continuing. .../src/gdb/linux-nat.c:1676: internal-error: linux_nat_resume: Assertion `dummy_counter < 10' failed. A problem internal to GDB has been detected, further debugging may prove unreliable. Quit this debugging session? (y or n) _ Entering 'y' or 'n' does not work, GDB does not respond. gdb/ChangeLog: 2016-04-12 Pedro Alves <palves@redhat.com> PR gdb/19828 * gnu-nat.c (inf_validate_task_sc): Don't call target_terminal_ours / target_terminal_inferior around query. * i386-tdep.c (i386_record_lea_modrm, i386_process_record): Don't call target_terminal_ours / target_terminal_inferior around yquery. * linux-record.c (record_linux_system_call): Don't call target_terminal_ours / target_terminal_inferior around yquery. * nto-procfs.c (interrupt_query): Don't call target_terminal_ours / target_terminal_inferior around query. * record-full.c (record_full_check_insn_num): Remove 'set_terminal' parameter. Don't call target_terminal_ours / target_terminal_inferior around query. (record_full_message, record_full_registers_change) (record_full_xfer_partial): Adjust. * remote.c (interrupt_query): Don't call target_terminal_ours / target_terminal_inferior around query. * utils.c (defaulted_query): Install cleanup to restore target terminal. Put target_terminal_ours_for_output in effect while defaulted producing, and target_terminal_ours in in effect while handling input. (prompt_for_continue): Install cleanup to restore target terminal. Put target_terminal_ours in in effect while handling input.
2016-04-12 23:49:32 +08:00
OUTPUT_REG (tmpulongest, tdep->arg1), (int) len))
return 1;
}
}
break;
case gdb_sys_truncate:
case gdb_sys_ftruncate:
case gdb_sys_fchmod:
case gdb_sys_fchown16:
case gdb_sys_getpriority:
case gdb_sys_setpriority:
case gdb_sys_ni_syscall98:
break;
case gdb_sys_statfs:
case gdb_sys_fstatfs:
if (record_mem_at_reg (regcache, tdep->arg2, tdep->size_statfs))
return -1;
break;
case gdb_sys_ioperm:
break;
case gdb_sys_socket:
case gdb_sys_sendto:
case gdb_sys_sendmsg:
case gdb_sys_shutdown:
case gdb_sys_bind:
case gdb_sys_connect:
case gdb_sys_listen:
case gdb_sys_setsockopt:
break;
case gdb_sys_accept:
case gdb_sys_getsockname:
case gdb_sys_getpeername:
{
ULONGEST len;
regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
regcache_raw_read_unsigned (regcache, tdep->arg3, &len);
if (record_linux_sockaddr (regcache, tdep, tmpulongest, len))
return -1;
}
break;
case gdb_sys_recvfrom:
{
ULONGEST len;
regcache_raw_read_unsigned (regcache, tdep->arg4, &tmpulongest);
regcache_raw_read_unsigned (regcache, tdep->arg5, &len);
if (record_linux_sockaddr (regcache, tdep, tmpulongest, len))
return -1;
}
break;
case gdb_sys_recvmsg:
regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
if (record_linux_msghdr (regcache, tdep, tmpulongest))
return -1;
break;
case gdb_sys_socketpair:
if (record_mem_at_reg (regcache, tdep->arg4, tdep->size_int))
return -1;
break;
case gdb_sys_getsockopt:
regcache_raw_read_unsigned (regcache, tdep->arg5, &tmpulongest);
if (tmpulongest)
{
ULONGEST optvalp;
gdb_byte *optlenp = (gdb_byte *) alloca (tdep->size_int);
if (target_read_memory ((CORE_ADDR) tmpulongest, optlenp,
tdep->size_int))
{
if (record_debug)
gdb_printf (gdb_stdlog,
"Process record: error reading "
"memory at addr = 0x%s "
"len = %d.\n",
OUTPUT_REG (tmpulongest, tdep->arg5),
tdep->size_int);
return -1;
}
regcache_raw_read_unsigned (regcache, tdep->arg4, &optvalp);
tmpint = (int) extract_signed_integer (optlenp, tdep->size_int,
byte_order);
if (record_full_arch_list_add_mem ((CORE_ADDR) optvalp, tmpint))
return -1;
if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
tdep->size_int))
return -1;
}
break;
case gdb_sys_socketcall:
regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
switch (tmpulongest)
{
case RECORD_SYS_SOCKET:
case RECORD_SYS_BIND:
case RECORD_SYS_CONNECT:
case RECORD_SYS_LISTEN:
break;
case RECORD_SYS_ACCEPT:
case RECORD_SYS_GETSOCKNAME:
case RECORD_SYS_GETPEERNAME:
{
regcache_raw_read_unsigned (regcache, tdep->arg2,
&tmpulongest);
if (tmpulongest)
{
gdb_byte *a = (gdb_byte *) alloca (tdep->size_ulong * 2);
ULONGEST len;
tmpulongest += tdep->size_ulong;
if (target_read_memory ((CORE_ADDR) tmpulongest, a,
tdep->size_ulong * 2))
{
if (record_debug)
gdb_printf (gdb_stdlog,
"Process record: error reading "
"memory at addr = 0x%s len = %d.\n",
OUTPUT_REG (tmpulongest, tdep->arg2),
tdep->size_ulong * 2);
return -1;
}
tmpulongest = extract_unsigned_integer (a,
tdep->size_ulong,
byte_order);
len = extract_unsigned_integer (a + tdep->size_ulong,
tdep->size_ulong, byte_order);
if (record_linux_sockaddr (regcache, tdep, tmpulongest, len))
return -1;
}
}
break;
case RECORD_SYS_SOCKETPAIR:
{
gdb_byte *a = (gdb_byte *) alloca (tdep->size_ulong);
regcache_raw_read_unsigned (regcache, tdep->arg2,
&tmpulongest);
if (tmpulongest)
{
tmpulongest += tdep->size_ulong * 3;
if (target_read_memory ((CORE_ADDR) tmpulongest, a,
tdep->size_ulong))
{
if (record_debug)
gdb_printf (gdb_stdlog,
"Process record: error reading "
"memory at addr = 0x%s len = %d.\n",
OUTPUT_REG (tmpulongest, tdep->arg2),
tdep->size_ulong);
return -1;
}
tmpaddr
= (CORE_ADDR) extract_unsigned_integer (a, tdep->size_ulong,
byte_order);
if (record_full_arch_list_add_mem (tmpaddr, tdep->size_int))
return -1;
}
}
break;
case RECORD_SYS_SEND:
case RECORD_SYS_SENDTO:
break;
case RECORD_SYS_RECVFROM:
regcache_raw_read_unsigned (regcache, tdep->arg2,
&tmpulongest);
if (tmpulongest)
{
gdb_byte *a = (gdb_byte *) alloca (tdep->size_ulong * 2);
ULONGEST len;
tmpulongest += tdep->size_ulong * 4;
if (target_read_memory ((CORE_ADDR) tmpulongest, a,
tdep->size_ulong * 2))
{
if (record_debug)
gdb_printf (gdb_stdlog,
"Process record: error reading "
"memory at addr = 0x%s len = %d.\n",
OUTPUT_REG (tmpulongest, tdep->arg2),
tdep->size_ulong * 2);
return -1;
}
tmpulongest = extract_unsigned_integer (a, tdep->size_ulong,
byte_order);
len = extract_unsigned_integer (a + tdep->size_ulong,
tdep->size_ulong, byte_order);
if (record_linux_sockaddr (regcache, tdep, tmpulongest, len))
return -1;
}
break;
case RECORD_SYS_RECV:
regcache_raw_read_unsigned (regcache, tdep->arg2,
&tmpulongest);
if (tmpulongest)
{
gdb_byte *a = (gdb_byte *) alloca (tdep->size_ulong * 2);
tmpulongest += tdep->size_ulong;
if (target_read_memory ((CORE_ADDR) tmpulongest, a,
tdep->size_ulong))
{
if (record_debug)
gdb_printf (gdb_stdlog,
"Process record: error reading "
"memory at addr = 0x%s len = %d.\n",
OUTPUT_REG (tmpulongest, tdep->arg2),
tdep->size_ulong);
return -1;
}
tmpulongest = extract_unsigned_integer (a, tdep->size_ulong,
byte_order);
if (tmpulongest)
{
a += tdep->size_ulong;
tmpint = (int) extract_unsigned_integer (a, tdep->size_ulong,
byte_order);
if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
tmpint))
return -1;
}
}
break;
case RECORD_SYS_SHUTDOWN:
case RECORD_SYS_SETSOCKOPT:
break;
case RECORD_SYS_GETSOCKOPT:
{
gdb_byte *a = (gdb_byte *) alloca (tdep->size_ulong * 2);
gdb_byte *av = (gdb_byte *) alloca (tdep->size_int);
regcache_raw_read_unsigned (regcache, tdep->arg2,
&tmpulongest);
if (tmpulongest)
{
tmpulongest += tdep->size_ulong * 3;
if (target_read_memory ((CORE_ADDR) tmpulongest, a,
tdep->size_ulong * 2))
{
if (record_debug)
gdb_printf (gdb_stdlog,
"Process record: error reading "
"memory at addr = 0x%s len = %d.\n",
OUTPUT_REG (tmpulongest, tdep->arg2),
tdep->size_ulong * 2);
return -1;
}
tmpulongest = extract_unsigned_integer (a + tdep->size_ulong,
tdep->size_ulong,
byte_order);
if (tmpulongest)
{
if (target_read_memory ((CORE_ADDR) tmpulongest, av,
tdep->size_int))
{
if (record_debug)
gdb_printf (gdb_stdlog,
"Process record: error reading "
"memory at addr = 0x%s "
"len = %d.\n",
phex_nz (tmpulongest,
tdep->size_ulong),
tdep->size_int);
return -1;
}
tmpaddr
= (CORE_ADDR) extract_unsigned_integer (a,
tdep->size_ulong,
byte_order);
tmpint = (int) extract_unsigned_integer (av,
tdep->size_int,
byte_order);
if (record_full_arch_list_add_mem (tmpaddr, tmpint))
return -1;
a += tdep->size_ulong;
tmpaddr
= (CORE_ADDR) extract_unsigned_integer (a,
tdep->size_ulong,
byte_order);
if (record_full_arch_list_add_mem (tmpaddr,
tdep->size_int))
return -1;
}
}
}
break;
case RECORD_SYS_SENDMSG:
break;
case RECORD_SYS_RECVMSG:
{
gdb_byte *a = (gdb_byte *) alloca (tdep->size_ulong);
regcache_raw_read_unsigned (regcache, tdep->arg2,
&tmpulongest);
if (tmpulongest)
{
tmpulongest += tdep->size_ulong;
if (target_read_memory ((CORE_ADDR) tmpulongest, a,
tdep->size_ulong))
{
if (record_debug)
gdb_printf (gdb_stdlog,
"Process record: error reading "
"memory at addr = 0x%s len = %d.\n",
OUTPUT_REG (tmpulongest, tdep->arg2),
tdep->size_ulong);
return -1;
}
tmpulongest = extract_unsigned_integer (a, tdep->size_ulong,
byte_order);
if (record_linux_msghdr (regcache, tdep, tmpulongest))
return -1;
}
}
break;
default:
gdb_printf (gdb_stderr,
_("Process record and replay target "
"doesn't support socketcall call 0x%s\n"),
OUTPUT_REG (tmpulongest, tdep->arg1));
return -1;
break;
}
break;
case gdb_sys_syslog:
break;
case gdb_sys_setitimer:
if (record_mem_at_reg (regcache, tdep->arg3, tdep->size_itimerval))
return -1;
break;
case gdb_sys_getitimer:
if (record_mem_at_reg (regcache, tdep->arg2, tdep->size_itimerval))
return -1;
break;
case gdb_sys_newstat:
case gdb_sys_newlstat:
case gdb_sys_newfstat:
if (record_mem_at_reg (regcache, tdep->arg2, tdep->size_stat))
return -1;
break;
case gdb_sys_newfstatat:
regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
tdep->size_stat))
return -1;
break;
case gdb_sys_statx:
regcache_raw_read_unsigned (regcache, tdep->arg5, &tmpulongest);
if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest, 256))
return -1;
break;
case gdb_sys_uname:
if (record_mem_at_reg (regcache, tdep->arg1,
tdep->size_old_utsname))
return -1;
break;
case gdb_sys_iopl:
case gdb_sys_vhangup:
case gdb_sys_ni_syscall112:
case gdb_sys_vm86old:
break;
case gdb_sys_wait4:
if (record_mem_at_reg (regcache, tdep->arg2, tdep->size_int)
|| record_mem_at_reg (regcache, tdep->arg4, tdep->size_rusage))
return -1;
break;
case gdb_sys_swapoff:
break;
case gdb_sys_sysinfo:
if (record_mem_at_reg (regcache, tdep->arg1, tdep->size_sysinfo))
return -1;
break;
case gdb_sys_shmget:
case gdb_sys_semget:
case gdb_sys_semop:
case gdb_sys_msgget:
/* XXX maybe need do some record works with sys_shmdt. */
case gdb_sys_shmdt:
case gdb_sys_msgsnd:
case gdb_sys_semtimedop:
break;
case gdb_sys_shmat:
if (record_mem_at_reg (regcache, tdep->arg3, tdep->size_ulong))
return -1;
break;
case gdb_sys_shmctl:
if (record_mem_at_reg (regcache, tdep->arg3, tdep->size_shmid_ds))
return -1;
break;
/* XXX sys_semctl 525 still not supported. */
/* sys_semctl */
case gdb_sys_msgrcv:
{
LONGEST l;
regcache_raw_read_signed (regcache, tdep->arg3, &l);
tmpint = l + tdep->size_long;
if (record_mem_at_reg (regcache, tdep->arg2, tmpint))
return -1;
}
break;
case gdb_sys_msgctl:
if (record_mem_at_reg (regcache, tdep->arg3, tdep->size_msqid_ds))
return -1;
break;
case gdb_sys_ipc:
regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
tmpulongest &= 0xffff;
switch (tmpulongest)
{
case RECORD_SEMOP:
case RECORD_SEMGET:
case RECORD_SEMTIMEDOP:
case RECORD_MSGSND:
case RECORD_MSGGET:
/* XXX maybe need do some record works with RECORD_SHMDT. */
case RECORD_SHMDT:
case RECORD_SHMGET:
break;
case RECORD_MSGRCV:
{
LONGEST second;
regcache_raw_read_signed (regcache, tdep->arg3, &second);
tmpint = (int) second + tdep->size_long;
if (record_mem_at_reg (regcache, tdep->arg5, tmpint))
return -1;
}
break;
case RECORD_MSGCTL:
if (record_mem_at_reg (regcache, tdep->arg5,
tdep->size_msqid_ds))
return -1;
break;
case RECORD_SHMAT:
if (record_mem_at_reg (regcache, tdep->arg4, tdep->size_ulong))
return -1;
break;
case RECORD_SHMCTL:
if (record_mem_at_reg (regcache, tdep->arg5,
tdep->size_shmid_ds))
return -1;
break;
default:
/* XXX RECORD_SEMCTL still not supported. */
gdb_printf (gdb_stderr,
_("Process record and replay target doesn't "
"support ipc number %s\n"),
pulongest (tmpulongest));
break;
}
break;
case gdb_sys_fsync:
case gdb_sys_sigreturn:
case gdb_sys_clone:
case gdb_sys_setdomainname:
break;
case gdb_sys_newuname:
if (record_mem_at_reg (regcache, tdep->arg1,
tdep->size_new_utsname))
return -1;
break;
case gdb_sys_modify_ldt:
regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
if (tmpulongest == 0 || tmpulongest == 2)
{
ULONGEST bytecount;
regcache_raw_read_unsigned (regcache, tdep->arg3, &bytecount);
if (record_mem_at_reg (regcache, tdep->arg2, (int) bytecount))
return -1;
}
break;
case gdb_sys_adjtimex:
if (record_mem_at_reg (regcache, tdep->arg1, tdep->size_timex))
return -1;
break;
case gdb_sys_mprotect:
break;
case gdb_sys_sigprocmask:
if (record_mem_at_reg (regcache, tdep->arg3,
tdep->size_old_sigset_t))
return -1;
break;
case gdb_sys_ni_syscall127:
case gdb_sys_init_module:
case gdb_sys_delete_module:
case gdb_sys_ni_syscall130:
break;
case gdb_sys_quotactl:
regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
switch (tmpulongest)
{
case RECORD_Q_GETFMT:
/* __u32 */
if (record_mem_at_reg (regcache, tdep->arg4, 4))
return -1;
break;
case RECORD_Q_GETINFO:
if (record_mem_at_reg (regcache, tdep->arg4,
tdep->size_mem_dqinfo))
return -1;
break;
case RECORD_Q_GETQUOTA:
if (record_mem_at_reg (regcache, tdep->arg4,
tdep->size_if_dqblk))
return -1;
break;
case RECORD_Q_XGETQSTAT:
case RECORD_Q_XGETQUOTA:
if (record_mem_at_reg (regcache, tdep->arg4,
tdep->size_fs_quota_stat))
return -1;
break;
}
break;
case gdb_sys_getpgid:
case gdb_sys_fchdir:
case gdb_sys_bdflush:
break;
case gdb_sys_sysfs:
regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
if (tmpulongest == 2)
{
/*XXX the size of memory is not very clear. */
if (record_mem_at_reg (regcache, tdep->arg3, 10))
return -1;
}
break;
case gdb_sys_personality:
case gdb_sys_ni_syscall137:
case gdb_sys_setfsuid16:
case gdb_sys_setfsgid16:
break;
case gdb_sys_llseek:
if (record_mem_at_reg (regcache, tdep->arg4, tdep->size_loff_t))
return -1;
break;
case gdb_sys_getdents:
case gdb_sys_getdents64:
regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
if (record_mem_at_reg (regcache, tdep->arg2, tmpulongest))
return -1;
break;
case gdb_sys_select:
if (record_mem_at_reg (regcache, tdep->arg2, tdep->size_fd_set)
|| record_mem_at_reg (regcache, tdep->arg3, tdep->size_fd_set)
|| record_mem_at_reg (regcache, tdep->arg4, tdep->size_fd_set)
|| record_mem_at_reg (regcache, tdep->arg5, tdep->size_timeval))
return -1;
break;
case gdb_sys_flock:
case gdb_sys_msync:
break;
case gdb_sys_readv:
{
ULONGEST vec, vlen;
regcache_raw_read_unsigned (regcache, tdep->arg2, &vec);
if (vec)
{
gdb_byte *iov = (gdb_byte *) alloca (tdep->size_iovec);
regcache_raw_read_unsigned (regcache, tdep->arg3, &vlen);
for (tmpulongest = 0; tmpulongest < vlen; tmpulongest++)
{
if (target_read_memory ((CORE_ADDR) vec, iov,
tdep->size_iovec))
{
if (record_debug)
gdb_printf (gdb_stdlog,
"Process record: error reading "
"memory at addr = 0x%s len = %d.\n",
OUTPUT_REG (vec, tdep->arg2),
tdep->size_iovec);
return -1;
}
tmpaddr
= (CORE_ADDR) extract_unsigned_integer (iov,
tdep->size_pointer,
byte_order);
tmpint
= (int) extract_unsigned_integer (iov + tdep->size_pointer,
tdep->size_size_t,
byte_order);
if (record_full_arch_list_add_mem (tmpaddr, tmpint))
return -1;
vec += tdep->size_iovec;
}
}
}
break;
case gdb_sys_writev:
case gdb_sys_getsid:
case gdb_sys_fdatasync:
case gdb_sys_sysctl:
case gdb_sys_mlock:
case gdb_sys_munlock:
case gdb_sys_mlockall:
case gdb_sys_munlockall:
case gdb_sys_sched_setparam:
break;
case gdb_sys_sched_getparam:
if (record_mem_at_reg (regcache, tdep->arg2, tdep->size_int))
return -1;
break;
case gdb_sys_sched_setscheduler:
case gdb_sys_sched_getscheduler:
case gdb_sys_sched_yield:
case gdb_sys_sched_get_priority_max:
case gdb_sys_sched_get_priority_min:
break;
case gdb_sys_sched_rr_get_interval:
case gdb_sys_nanosleep:
if (record_mem_at_reg (regcache, tdep->arg2, tdep->size_timespec))
return -1;
break;
case gdb_sys_mremap:
case gdb_sys_setresuid16:
break;
case gdb_sys_getresuid16:
if (record_mem_at_reg (regcache, tdep->arg1, tdep->size_old_uid_t)
|| record_mem_at_reg (regcache, tdep->arg2,
tdep->size_old_uid_t)
|| record_mem_at_reg (regcache, tdep->arg3,
tdep->size_old_uid_t))
return -1;
break;
case gdb_sys_vm86:
case gdb_sys_ni_syscall167:
break;
case gdb_sys_poll:
regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
if (tmpulongest)
{
ULONGEST nfds;
regcache_raw_read_unsigned (regcache, tdep->arg2, &nfds);
if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
tdep->size_pollfd * nfds))
return -1;
}
break;
case gdb_sys_nfsservctl:
regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
if (tmpulongest == 7 || tmpulongest == 8)
{
int rsize;
if (tmpulongest == 7)
rsize = tdep->size_NFS_FHSIZE;
else
rsize = tdep->size_knfsd_fh;
if (record_mem_at_reg (regcache, tdep->arg3, rsize))
return -1;
}
break;
case gdb_sys_setresgid16:
break;
case gdb_sys_getresgid16:
if (record_mem_at_reg (regcache, tdep->arg1, tdep->size_old_gid_t)
|| record_mem_at_reg (regcache, tdep->arg2,
tdep->size_old_gid_t)
|| record_mem_at_reg (regcache, tdep->arg3,
tdep->size_old_gid_t))
return -1;
break;
case gdb_sys_prctl:
regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
switch (tmpulongest)
{
case 2:
if (record_mem_at_reg (regcache, tdep->arg2, tdep->size_int))
return -1;
break;
case 16:
if (record_mem_at_reg (regcache, tdep->arg2,
tdep->size_TASK_COMM_LEN))
return -1;
break;
}
break;
case gdb_sys_rt_sigreturn:
break;
case gdb_sys_rt_sigaction:
if (record_mem_at_reg (regcache, tdep->arg3, tdep->size_sigaction))
return -1;
break;
case gdb_sys_rt_sigprocmask:
if (record_mem_at_reg (regcache, tdep->arg3, tdep->size_sigset_t))
return -1;
break;
case gdb_sys_rt_sigpending:
regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
if (tmpulongest)
{
ULONGEST sigsetsize;
regcache_raw_read_unsigned (regcache, tdep->arg2,&sigsetsize);
if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
(int) sigsetsize))
return -1;
}
break;
case gdb_sys_rt_sigtimedwait:
if (record_mem_at_reg (regcache, tdep->arg2, tdep->size_siginfo_t))
return -1;
break;
case gdb_sys_rt_sigqueueinfo:
case gdb_sys_rt_sigsuspend:
break;
case gdb_sys_pread64:
regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
if (tmpulongest)
{
ULONGEST count;
regcache_raw_read_unsigned (regcache, tdep->arg3,&count);
if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
(int) count))
return -1;
}
break;
case gdb_sys_pwrite64:
case gdb_sys_chown16:
break;
case gdb_sys_getcwd:
regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
if (tmpulongest)
{
ULONGEST size;
regcache_raw_read_unsigned (regcache, tdep->arg2, &size);
if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
(int) size))
return -1;
}
break;
case gdb_sys_capget:
if (record_mem_at_reg (regcache, tdep->arg2,
tdep->size_cap_user_data_t))
return -1;
break;
case gdb_sys_capset:
break;
case gdb_sys_sigaltstack:
if (record_mem_at_reg (regcache, tdep->arg2, tdep->size_stack_t))
return -1;
break;
case gdb_sys_sendfile:
if (record_mem_at_reg (regcache, tdep->arg3, tdep->size_off_t))
return -1;
break;
case gdb_sys_ni_syscall188:
case gdb_sys_ni_syscall189:
case gdb_sys_vfork:
break;
case gdb_sys_getrlimit:
if (record_mem_at_reg (regcache, tdep->arg2, tdep->size_rlimit))
return -1;
break;
case gdb_sys_mmap2:
break;
case gdb_sys_truncate64:
case gdb_sys_ftruncate64:
break;
case gdb_sys_stat64:
case gdb_sys_lstat64:
case gdb_sys_fstat64:
if (record_mem_at_reg (regcache, tdep->arg2, tdep->size_stat64))
return -1;
break;
case gdb_sys_lchown:
case gdb_sys_getuid:
case gdb_sys_getgid:
case gdb_sys_geteuid:
case gdb_sys_getegid:
case gdb_sys_setreuid:
case gdb_sys_setregid:
break;
case gdb_sys_getgroups:
regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
if (tmpulongest)
{
ULONGEST gidsetsize;
regcache_raw_read_unsigned (regcache, tdep->arg1,
&gidsetsize);
tmpint = tdep->size_gid_t * (int) gidsetsize;
if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest, tmpint))
return -1;
}
break;
case gdb_sys_setgroups:
case gdb_sys_fchown:
case gdb_sys_setresuid:
break;
case gdb_sys_getresuid:
if (record_mem_at_reg (regcache, tdep->arg1, tdep->size_uid_t)
|| record_mem_at_reg (regcache, tdep->arg2, tdep->size_uid_t)
|| record_mem_at_reg (regcache, tdep->arg3, tdep->size_uid_t))
return -1;
break;
case gdb_sys_setresgid:
break;
case gdb_sys_getresgid:
if (record_mem_at_reg (regcache, tdep->arg1, tdep->size_gid_t)
|| record_mem_at_reg (regcache, tdep->arg2, tdep->size_gid_t)
|| record_mem_at_reg (regcache, tdep->arg3, tdep->size_gid_t))
return -1;
break;
case gdb_sys_chown:
case gdb_sys_setuid:
case gdb_sys_setgid:
case gdb_sys_setfsuid:
case gdb_sys_setfsgid:
case gdb_sys_pivot_root:
break;
case gdb_sys_mincore:
if (record_mem_at_reg (regcache, tdep->arg3, tdep->size_PAGE_SIZE))
return -1;
break;
case gdb_sys_madvise:
break;
case gdb_sys_fcntl64:
regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
if (tmpulongest == tdep->fcntl_F_GETLK64)
{
if (record_mem_at_reg (regcache, tdep->arg3,
tdep->size_flock64))
return -1;
}
else if (tmpulongest != tdep->fcntl_F_SETLK64
&& tmpulongest != tdep->fcntl_F_SETLKW64)
{
goto sys_fcntl;
}
break;
case gdb_sys_ni_syscall222:
case gdb_sys_ni_syscall223:
case gdb_sys_gettid:
case gdb_sys_readahead:
case gdb_sys_setxattr:
case gdb_sys_lsetxattr:
case gdb_sys_fsetxattr:
break;
case gdb_sys_getxattr:
case gdb_sys_lgetxattr:
case gdb_sys_fgetxattr:
regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
if (tmpulongest)
{
ULONGEST size;
regcache_raw_read_unsigned (regcache, tdep->arg4, &size);
if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
(int) size))
return -1;
}
break;
case gdb_sys_listxattr:
case gdb_sys_llistxattr:
case gdb_sys_flistxattr:
regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
if (tmpulongest)
{
ULONGEST size;
regcache_raw_read_unsigned (regcache, tdep->arg3, &size);
if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
(int) size))
return -1;
}
break;
case gdb_sys_removexattr:
case gdb_sys_lremovexattr:
case gdb_sys_fremovexattr:
case gdb_sys_tkill:
break;
case gdb_sys_sendfile64:
if (record_mem_at_reg (regcache, tdep->arg3, tdep->size_loff_t))
return -1;
break;
case gdb_sys_futex:
case gdb_sys_sched_setaffinity:
break;
case gdb_sys_sched_getaffinity:
regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
if (tmpulongest)
{
ULONGEST len;
regcache_raw_read_unsigned (regcache, tdep->arg2, &len);
if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
(int) len))
return -1;
}
break;
case gdb_sys_set_thread_area:
if (record_mem_at_reg (regcache, tdep->arg1, tdep->size_int))
return -1;
break;
case gdb_sys_get_thread_area:
if (record_mem_at_reg (regcache, tdep->arg1, tdep->size_user_desc))
return -1;
break;
case gdb_sys_io_setup:
if (record_mem_at_reg (regcache, tdep->arg2, tdep->size_long))
return -1;
break;
case gdb_sys_io_destroy:
break;
case gdb_sys_io_getevents:
regcache_raw_read_unsigned (regcache, tdep->arg4, &tmpulongest);
if (tmpulongest)
{
ULONGEST nr;
regcache_raw_read_unsigned (regcache, tdep->arg3, &nr);
if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
nr * tdep->size_io_event))
return -1;
}
break;
case gdb_sys_io_submit:
regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
if (tmpulongest)
{
ULONGEST nr, i;
gdb_byte *iocbp;
regcache_raw_read_unsigned (regcache, tdep->arg2, &nr);
iocbp = (gdb_byte *) alloca (nr * tdep->size_pointer);
if (target_read_memory ((CORE_ADDR) tmpulongest, iocbp,
nr * tdep->size_pointer))
{
if (record_debug)
gdb_printf (gdb_stdlog,
"Process record: error reading memory "
"at addr = 0x%s len = %u.\n",
OUTPUT_REG (tmpulongest, tdep->arg2),
(int) (nr * tdep->size_pointer));
return -1;
}
for (i = 0; i < nr; i++)
{
tmpaddr
= (CORE_ADDR) extract_unsigned_integer (iocbp,
tdep->size_pointer,
byte_order);
if (record_full_arch_list_add_mem (tmpaddr, tdep->size_iocb))
return -1;
iocbp += tdep->size_pointer;
}
}
break;
case gdb_sys_io_cancel:
if (record_mem_at_reg (regcache, tdep->arg3, tdep->size_io_event))
return -1;
break;
case gdb_sys_fadvise64:
case gdb_sys_ni_syscall251:
break;
case gdb_sys_exit_group:
Do target_terminal_ours in query & friends instead of in all callers Any time a caller calls query & friends / prompt_for_continue without ensuring that gdb owns the terminal for input is a bug. So do that in defaulted_query / prompt_for_continue directly instead. An example of a case where we currently miss calling target_terminal_ours is internal_error. Ever since defaulted_query was made to use gdb_readline_callback, there's no way to answer the internal error query if the internal error happens while the target is has the terminal: (gdb) c Continuing. .../src/gdb/linux-nat.c:1676: internal-error: linux_nat_resume: Assertion `dummy_counter < 10' failed. A problem internal to GDB has been detected, further debugging may prove unreliable. Quit this debugging session? (y or n) _ Entering 'y' or 'n' does not work, GDB does not respond. gdb/ChangeLog: 2016-04-12 Pedro Alves <palves@redhat.com> PR gdb/19828 * gnu-nat.c (inf_validate_task_sc): Don't call target_terminal_ours / target_terminal_inferior around query. * i386-tdep.c (i386_record_lea_modrm, i386_process_record): Don't call target_terminal_ours / target_terminal_inferior around yquery. * linux-record.c (record_linux_system_call): Don't call target_terminal_ours / target_terminal_inferior around yquery. * nto-procfs.c (interrupt_query): Don't call target_terminal_ours / target_terminal_inferior around query. * record-full.c (record_full_check_insn_num): Remove 'set_terminal' parameter. Don't call target_terminal_ours / target_terminal_inferior around query. (record_full_message, record_full_registers_change) (record_full_xfer_partial): Adjust. * remote.c (interrupt_query): Don't call target_terminal_ours / target_terminal_inferior around query. * utils.c (defaulted_query): Install cleanup to restore target terminal. Put target_terminal_ours_for_output in effect while defaulted producing, and target_terminal_ours in in effect while handling input. (prompt_for_continue): Install cleanup to restore target terminal. Put target_terminal_ours in in effect while handling input.
2016-04-12 23:49:32 +08:00
if (yquery (_("The next instruction is syscall exit_group. "
"It will make the program exit. "
"Do you want to stop the program?")))
return 1;
break;
case gdb_sys_lookup_dcookie:
regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
if (tmpulongest)
{
ULONGEST len;
regcache_raw_read_unsigned (regcache, tdep->arg3, &len);
if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
(int) len))
return -1;
}
break;
case gdb_sys_epoll_create:
case gdb_sys_epoll_ctl:
break;
case gdb_sys_epoll_wait:
regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
if (tmpulongest)
{
ULONGEST maxevents;
regcache_raw_read_unsigned (regcache, tdep->arg3, &maxevents);
if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
(maxevents
* tdep->size_epoll_event)))
return -1;
}
break;
case gdb_sys_remap_file_pages:
case gdb_sys_set_tid_address:
break;
case gdb_sys_timer_create:
if (record_mem_at_reg (regcache, tdep->arg3, tdep->size_int))
return -1;
break;
case gdb_sys_timer_settime:
if (record_mem_at_reg (regcache, tdep->arg4, tdep->size_itimerspec))
return -1;
break;
case gdb_sys_timer_gettime:
if (record_mem_at_reg (regcache, tdep->arg2, tdep->size_itimerspec))
return -1;
break;
case gdb_sys_timer_getoverrun:
case gdb_sys_timer_delete:
case gdb_sys_clock_settime:
break;
case gdb_sys_clock_gettime:
if (record_mem_at_reg (regcache, tdep->arg2, tdep->size_timespec))
return -1;
break;
case gdb_sys_clock_gettime64:
/* Size of struct __timespec64 is 16. */
if (record_mem_at_reg (regcache, tdep->arg2, 16))
return -1;
break;
case gdb_sys_clock_getres:
if (record_mem_at_reg (regcache, tdep->arg2, tdep->size_timespec))
return -1;
break;
case gdb_sys_clock_nanosleep:
if (record_mem_at_reg (regcache, tdep->arg4, tdep->size_timespec))
return -1;
break;
case gdb_sys_statfs64:
case gdb_sys_fstatfs64:
if (record_mem_at_reg (regcache, tdep->arg3, tdep->size_statfs64))
return -1;
break;
case gdb_sys_tgkill:
case gdb_sys_utimes:
case gdb_sys_fadvise64_64:
case gdb_sys_ni_syscall273:
case gdb_sys_mbind:
break;
case gdb_sys_get_mempolicy:
if (record_mem_at_reg (regcache, tdep->arg1, tdep->size_int))
return -1;
regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
if (tmpulongest)
{
ULONGEST maxnode;
regcache_raw_read_unsigned (regcache, tdep->arg3, &maxnode);
if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
maxnode * tdep->size_long))
return -1;
}
break;
case gdb_sys_set_mempolicy:
case gdb_sys_mq_open:
case gdb_sys_mq_unlink:
case gdb_sys_mq_timedsend:
break;
case gdb_sys_mq_timedreceive:
regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
if (tmpulongest)
{
ULONGEST msg_len;
regcache_raw_read_unsigned (regcache, tdep->arg3, &msg_len);
if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
(int) msg_len))
return -1;
}
if (record_mem_at_reg (regcache, tdep->arg4, tdep->size_int))
return -1;
break;
case gdb_sys_mq_notify:
break;
case gdb_sys_mq_getsetattr:
if (record_mem_at_reg (regcache, tdep->arg3, tdep->size_mq_attr))
return -1;
break;
case gdb_sys_kexec_load:
break;
case gdb_sys_waitid:
if (record_mem_at_reg (regcache, tdep->arg3, tdep->size_siginfo_t)
|| record_mem_at_reg (regcache, tdep->arg5, tdep->size_rusage))
return -1;
break;
case gdb_sys_ni_syscall285:
case gdb_sys_add_key:
case gdb_sys_request_key:
break;
case gdb_sys_keyctl:
regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
if (tmpulongest == 6 || tmpulongest == 11)
{
regcache_raw_read_unsigned (regcache, tdep->arg3,
&tmpulongest);
if (tmpulongest)
{
ULONGEST buflen;
regcache_raw_read_unsigned (regcache, tdep->arg4, &buflen);
if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
(int) buflen))
return -1;
}
}
break;
case gdb_sys_ioprio_set:
case gdb_sys_ioprio_get:
case gdb_sys_inotify_init:
case gdb_sys_inotify_add_watch:
case gdb_sys_inotify_rm_watch:
case gdb_sys_migrate_pages:
case gdb_sys_openat:
case gdb_sys_mkdirat:
case gdb_sys_mknodat:
case gdb_sys_fchownat:
case gdb_sys_futimesat:
break;
case gdb_sys_fstatat64:
if (record_mem_at_reg (regcache, tdep->arg3, tdep->size_stat64))
return -1;
break;
case gdb_sys_unlinkat:
case gdb_sys_renameat:
case gdb_sys_linkat:
case gdb_sys_symlinkat:
break;
case gdb_sys_readlinkat:
regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
if (tmpulongest)
{
ULONGEST bufsiz;
regcache_raw_read_unsigned (regcache, tdep->arg4, &bufsiz);
if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
(int) bufsiz))
return -1;
}
break;
case gdb_sys_fchmodat:
case gdb_sys_faccessat:
break;
case gdb_sys_pselect6:
if (record_mem_at_reg (regcache, tdep->arg2, tdep->size_fd_set)
|| record_mem_at_reg (regcache, tdep->arg3, tdep->size_fd_set)
|| record_mem_at_reg (regcache, tdep->arg4, tdep->size_fd_set)
|| record_mem_at_reg (regcache, tdep->arg5, tdep->size_timespec))
return -1;
break;
case gdb_sys_ppoll:
regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
if (tmpulongest)
{
ULONGEST nfds;
regcache_raw_read_unsigned (regcache, tdep->arg2, &nfds);
if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
tdep->size_pollfd * nfds))
return -1;
}
if (record_mem_at_reg (regcache, tdep->arg3, tdep->size_timespec))
return -1;
break;
case gdb_sys_unshare:
case gdb_sys_set_robust_list:
break;
case gdb_sys_get_robust_list:
if (record_mem_at_reg (regcache, tdep->arg2, tdep->size_int)
|| record_mem_at_reg (regcache, tdep->arg3, tdep->size_int))
return -1;
break;
case gdb_sys_splice:
if (record_mem_at_reg (regcache, tdep->arg2, tdep->size_loff_t)
|| record_mem_at_reg (regcache, tdep->arg4, tdep->size_loff_t))
return -1;
break;
case gdb_sys_sync_file_range:
case gdb_sys_tee:
case gdb_sys_vmsplice:
break;
case gdb_sys_move_pages:
regcache_raw_read_unsigned (regcache, tdep->arg5, &tmpulongest);
if (tmpulongest)
{
ULONGEST nr_pages;
regcache_raw_read_unsigned (regcache, tdep->arg2, &nr_pages);
if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
nr_pages * tdep->size_int))
return -1;
}
break;
case gdb_sys_getcpu:
if (record_mem_at_reg (regcache, tdep->arg1, tdep->size_int)
|| record_mem_at_reg (regcache, tdep->arg2, tdep->size_int)
|| record_mem_at_reg (regcache, tdep->arg3,
tdep->size_ulong * 2))
return -1;
break;
case gdb_sys_epoll_pwait:
regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
if (tmpulongest)
{
ULONGEST maxevents;
regcache_raw_read_unsigned (regcache, tdep->arg3, &maxevents);
tmpint = (int) maxevents * tdep->size_epoll_event;
if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest, tmpint))
return -1;
}
break;
case gdb_sys_fallocate:
case gdb_sys_eventfd2:
case gdb_sys_epoll_create1:
case gdb_sys_dup3:
break;
case gdb_sys_inotify_init1:
break;
default:
gdb_printf (gdb_stderr,
_("Process record and replay target doesn't "
"support syscall number %d\n"), syscall);
return -1;
break;
}
return 0;
}