mirror of
https://github.com/mii443/qemu.git
synced 2025-12-16 17:18:49 +00:00
linux-user: implemented ELF coredump support for ARM target
When target process is killed with signal (such signal that should dump core) a coredump file is created. This file is similar than coredump generated by Linux (there are few exceptions though). Riku Voipio: added support for rlimit Signed-off-by: Mika Westerberg <mika.westerberg@iki.fi> Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
This commit is contained in:
committed by
Riku Voipio
parent
88a8c98455
commit
edf8e2af14
@@ -25,6 +25,7 @@
|
||||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/mman.h>
|
||||
#include <sys/syscall.h>
|
||||
|
||||
#include "qemu.h"
|
||||
#include "qemu-common.h"
|
||||
@@ -2319,6 +2320,27 @@ static void usage(void)
|
||||
|
||||
THREAD CPUState *thread_env;
|
||||
|
||||
void task_settid(TaskState *ts)
|
||||
{
|
||||
if (ts->ts_tid == 0) {
|
||||
#ifdef USE_NPTL
|
||||
ts->ts_tid = (pid_t)syscall(SYS_gettid);
|
||||
#else
|
||||
/* when no threads are used, tid becomes pid */
|
||||
ts->ts_tid = getpid();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
void stop_all_tasks(void)
|
||||
{
|
||||
/*
|
||||
* We trust that when using NPTL, start_exclusive()
|
||||
* handles thread stopping correctly.
|
||||
*/
|
||||
start_exclusive();
|
||||
}
|
||||
|
||||
/* Assumes contents are already zeroed. */
|
||||
void init_task_state(TaskState *ts)
|
||||
{
|
||||
@@ -2338,6 +2360,7 @@ int main(int argc, char **argv, char **envp)
|
||||
const char *cpu_model;
|
||||
struct target_pt_regs regs1, *regs = ®s1;
|
||||
struct image_info info1, *info = &info1;
|
||||
struct linux_binprm bprm;
|
||||
TaskState ts1, *ts = &ts1;
|
||||
CPUState *env;
|
||||
int optind;
|
||||
@@ -2467,6 +2490,8 @@ int main(int argc, char **argv, char **envp)
|
||||
/* Zero out image_info */
|
||||
memset(info, 0, sizeof(struct image_info));
|
||||
|
||||
memset(&bprm, 0, sizeof (bprm));
|
||||
|
||||
/* Scan interp_prefix dir for replacement files. */
|
||||
init_paths(interp_prefix);
|
||||
|
||||
@@ -2543,7 +2568,16 @@ int main(int argc, char **argv, char **envp)
|
||||
}
|
||||
target_argv[target_argc] = NULL;
|
||||
|
||||
if (loader_exec(filename, target_argv, target_environ, regs, info) != 0) {
|
||||
memset(ts, 0, sizeof(TaskState));
|
||||
init_task_state(ts);
|
||||
/* build Task State */
|
||||
ts->info = info;
|
||||
ts->bprm = &bprm;
|
||||
env->opaque = ts;
|
||||
task_settid(ts);
|
||||
|
||||
if (loader_exec(filename, target_argv, target_environ, regs,
|
||||
info, &bprm) != 0) {
|
||||
printf("Error loading %s\n", filename);
|
||||
_exit(1);
|
||||
}
|
||||
@@ -2579,12 +2613,6 @@ int main(int argc, char **argv, char **envp)
|
||||
syscall_init();
|
||||
signal_init();
|
||||
|
||||
/* build Task State */
|
||||
memset(ts, 0, sizeof(TaskState));
|
||||
init_task_state(ts);
|
||||
ts->info = info;
|
||||
env->opaque = ts;
|
||||
|
||||
#if defined(TARGET_I386)
|
||||
cpu_x86_set_cpl(env, 3);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user