Skip to content

Commit 5623fe7

Browse files
Refactor opt_gencore to imply allow_coredump
1 parent 45b69dc commit 5623fe7

File tree

1 file changed

+19
-18
lines changed

1 file changed

+19
-18
lines changed

src/fiat/drhook/drhook.c

+19-18
Original file line numberDiff line numberDiff line change
@@ -2239,24 +2239,6 @@ process_options()
22392239
OPTPRINT(fp,"%s %s [%s@%s:%d] ATP_IGNORE_SIGTERM=%d\n",pfx,TIMESTR(tid),FFL,atp_ignore_sigterm);
22402240
}
22412241

2242-
env = getenv("DR_HOOK_ALLOW_COREDUMP");
2243-
if (env) {
2244-
ienv = atoi(env);
2245-
allow_coredump = (ienv == -1 || ienv == myproc) ? ienv : 0;
2246-
}
2247-
OPTPRINT(fp,"%s %s [%s@%s:%d] DR_HOOK_ALLOW_COREDUMP=%d\n",pfx,TIMESTR(tid),FFL,allow_coredump);
2248-
#if 0
2249-
// Postponed until DrHook actully has caught the signal
2250-
if (allow_coredump) {
2251-
unsigned long long int hardlimit = 0;
2252-
int rc = set_corefile_to_hard_limit(&hardlimit,1);
2253-
if (rc == 0) {
2254-
OPTPRINT(fp,"%s %s [%s@%s:%d] Hardlimit for core file is now %llu (0x%llx)\n",
2255-
pfx,TIMESTR(tid),FFL,hardlimit,hardlimit);
2256-
}
2257-
}
2258-
#endif
2259-
22602242
env = getenv("DR_HOOK_PROFILE");
22612243
if (env) {
22622244
char *s = calloc_drhook(strlen(env) + 15, sizeof(*s));
@@ -2494,6 +2476,25 @@ process_options()
24942476
OPTPRINT(fp,"%s %s [%s@%s:%d] DR_HOOK_GENCORE_SIGNAL=%d\n",pfx,TIMESTR(tid),FFL,opt_gencore_signal);
24952477
}
24962478

2479+
env = getenv("DR_HOOK_ALLOW_COREDUMP");
2480+
if (env) {
2481+
ienv = atoi(env);
2482+
allow_coredump = (ienv == -1 || ienv == myproc) ? ienv : 0;
2483+
}
2484+
2485+
/* opt_gencore implies allow_coredump */
2486+
allow_coredump |= opt_gencore;
2487+
OPTPRINT(fp,"%s %s [%s@%s:%d] DR_HOOK_ALLOW_COREDUMP=%d\n",pfx,TIMESTR(tid),FFL,allow_coredump);
2488+
2489+
if (allow_coredump) {
2490+
unsigned long long int hardlimit = 0;
2491+
int rc = set_corefile_to_hard_limit(&hardlimit,1);
2492+
if (rc == 0) {
2493+
OPTPRINT(fp,"%s %s [%s@%s:%d] Hardlimit for core file is now %llu (0x%llx)\n",
2494+
pfx,TIMESTR(tid),FFL,hardlimit,hardlimit);
2495+
}
2496+
}
2497+
24972498
newline = 0;
24982499
env = getenv("DR_HOOK_OPT");
24992500
if (env) {

0 commit comments

Comments
 (0)