debug: generate core dump for FreeBSD.

from the 14.x (next) release, since the snapshot update, interface is available
 and allows enough flexibility thus here we re trying to dump data as much
 as possible.
This commit is contained in:
DC 2021-09-08 07:19:34 +01:00 committed by Riccardo Schirone
parent dba3fb0197
commit efee20738d
2 changed files with 4 additions and 4 deletions

View file

@ -123,10 +123,9 @@ int bsd_reg_write(RzDebug *dbg, int type, const ut8 *buf, int size) {
bool bsd_generate_corefile(RzDebug *dbg, char *path, RzBuffer *dest) {
#if defined(__NetBSD__)
return ptrace(PT_DUMPCORE, dbg->pid, path, strlen(path)) != -1;
#elif defined(__FreeBSD__)
// TODO when FreeBSD 14 is out or at least the interface stabilized
// and will most likely use the RzBuffer part
return false;
#elif defined(__FreeBSD__) && __FreeBSD_version >= 1400030
struct ptrace_coredump pc = { .pc_fd = dest->fd, .pc_flags = PC_ALL, .pc_limit = 0 };
return ptrace(PT_COREDUMP, dbg->pid, (void *)&pc, sizeof(pc)) != -1;
#else
return false;
#endif

View file

@ -340,6 +340,7 @@ userconf.set10('HAVE_DECL_PROCCTL_ASLR_CTL', ok)
if host_machine.system() == 'freebsd'
add_project_link_arguments('-Wl,--unresolved-symbols,ignore-in-object-files', language: 'c')
add_project_link_arguments('-Wl,--allow-shlib-undefined', language: 'c')
endif
lrt = []