本文整理汇总了C++中ThreadInfo::GPRegisters方法的典型用法代码示例。如果您正苦于以下问题:C++ ThreadInfo::GPRegisters方法的具体用法?C++ ThreadInfo::GPRegisters怎么用?C++ ThreadInfo::GPRegisters使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ThreadInfo
的用法示例。
在下文中一共展示了ThreadInfo::GPRegisters方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: memset
bool
DumpWriter::WriteThread(const ThreadInfo& thread, int fatal_signal)
{
prstatus_t pr;
memset(&pr, 0, sizeof(pr));
pr.pr_info.si_signo = fatal_signal;
pr.pr_cursig = fatal_signal;
pr.pr_pid = thread.Tid();
pr.pr_ppid = thread.Ppid();
pr.pr_pgrp = thread.Tgid();
memcpy(&pr.pr_reg, thread.GPRegisters(), sizeof(user_regs_struct));
Nhdr nhdr;
memset(&nhdr, 0, sizeof(nhdr));
// Name size is CORE plus the NULL terminator
// The format requires 4 byte alignment so the
// value written in 8 bytes. Stuff the last 3
// bytes with the type of NT_PRSTATUS so it is
// easier to debug in a hex editor.
nhdr.n_namesz = 5;
nhdr.n_descsz = sizeof(prstatus_t);
nhdr.n_type = NT_PRSTATUS;
if (!WriteData(&nhdr, sizeof(nhdr)) ||
!WriteData("CORE\0THR", 8) ||
!WriteData(&pr, sizeof(prstatus_t))) {
return false;
}
#if defined(__i386__) || defined(__x86_64__)
nhdr.n_descsz = sizeof(user_fpregs_struct);
nhdr.n_type = NT_FPREGSET;
if (!WriteData(&nhdr, sizeof(nhdr)) ||
!WriteData("CORE\0FLT", 8) ||
!WriteData(thread.FPRegisters(), sizeof(user_fpregs_struct))) {
return false;
}
#endif
#if defined(__i386__)
nhdr.n_descsz = sizeof(user_fpxregs_struct);
nhdr.n_type = NT_PRXFPREG;
if (!WriteData(&nhdr, sizeof(nhdr)) ||
!WriteData("LINUX\0\0\0", 8) ||
!WriteData(&thread.FPXRegisters(), sizeof(user_fpxregs_struct))) {
return false;
}
#endif
return true;
}