e: simplify logic.

SVN revision: 78737
This commit is contained in:
Cedric BAIL 2012-11-01 01:09:22 +00:00
parent 1e3ac4150c
commit 0b5db2653e
1 changed files with 9 additions and 32 deletions

View File

@ -156,43 +156,20 @@ main(int argc,
if (!strcmp(action, "gdb")) if (!strcmp(action, "gdb"))
{ {
Eina_Prefix *pfx = NULL;
char buffer[4096]; char buffer[4096];
char *tmp;
char *enlightenment_gdb;
int fd;
int r; int r;
pfx = eina_prefix_new(argv[0], main, snprintf(buffer, 4096,
"E", "enlightenment", "AUTHORS", "%s --pid=%i "
PACKAGE_BIN_DIR, PACKAGE_LIB_DIR, "-ex 'set logging file %s' "
PACKAGE_DATA_DIR, LOCALE_DIR); "-ex 'set logging on' "
if (!pfx) exit(-1); "-ex 'thread apply all backtrace full' "
"-ex detach -ex quit > /dev/null 2> /dev/null",
snprintf(buffer, 4096,
"set logging file %s\nset logging on\nbacktrace full\n",
output);
tmp = strdup("/tmp/e-gdb-XXXXXX");
fd = mkstemp(tmp);
if (fd < 0) exit(-1);
write(fd, buffer, strlen(buffer));
close(fd);
snprintf(buffer, 4096,
"cat %s | %s %s/enlightenment %i > /dev/null 2> /dev/null",
tmp,
cmd, cmd,
eina_prefix_bin_get(pfx), pid,
pid); output);
enlightenment_gdb = strdup(buffer);
r = system(enlightenment_gdb); r = system(buffer);
unlink(tmp);
free(enlightenment_gdb);
free(tmp);
exit(WEXITSTATUS(r)); exit(WEXITSTATUS(r));
} }