summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSon Dinh <dinhs@objectcomputing.com>2022-04-28 18:22:28 -0500
committerSon Dinh <dinhs@objectcomputing.com>2022-04-28 18:22:28 -0500
commitc3dea08e83126e36b99d919ddcd0c8cf333092d8 (patch)
treee619dc208922583c4d2ed41c2a59e2bc797ea261
parenta45738d60e2ffe6792f4c3d582eaa369bac8b82d (diff)
downloadATCD-c3dea08e83126e36b99d919ddcd0c8cf333092d8.tar.gz
Update logs
-rw-r--r--ACE/bin/PerlACE/Process_Unix.pm20
1 files changed, 12 insertions, 8 deletions
diff --git a/ACE/bin/PerlACE/Process_Unix.pm b/ACE/bin/PerlACE/Process_Unix.pm
index 3f1776a0b0a..dbd0c2516b3 100644
--- a/ACE/bin/PerlACE/Process_Unix.pm
+++ b/ACE/bin/PerlACE/Process_Unix.pm
@@ -580,13 +580,13 @@ sub print_stacktrace_linux
# Get the core file pattern
my $core_pattern_file = "/proc/sys/kernel/core_pattern";
if (!(-e $core_pattern_file)) {
- print STDOUT "WARNING: Core file pattern $core_pattern_file does not exist\n";
+ print STDERR "WARNING: print_stacktrace_linux: Core file pattern $core_pattern_file does not exist\n";
return;
}
my $pattern_fh;
if (!open ($pattern_fh, "<", "$core_pattern_file")) {
- print STDOUT "WARNING: Could not open $core_pattern_file\n";
+ print STDERR "WARNING: print_stacktrace_linux: Could not open $core_pattern_file: $!\n";
return;
}
@@ -610,9 +610,10 @@ sub print_stacktrace_linux
my $uses_pid_file = "/proc/sys/kernel/core_uses_pid";
my $uses_pid = 0;
if (!open (my $uses_pid_fh, "<", "$uses_pid_file")) {
- print STDOUT "WARNING: Could not open $uses_pid_file\n";
+ print STDERR "WARNING: print_stacktrace_linux: Could not open $uses_pid_file: $!\n";
} else {
$line = <$uses_pid_fh>;
+ chomp ($line);
if ($line ne "" || $line ne "\n") {
$uses_pid = $line;
}
@@ -650,7 +651,10 @@ sub print_stacktrace_linux
my $suffix = substr ($pattern, $timestamp_idx + 2, $suffix_len);
# Get the core file with latest timestamp.
- opendir (my $dh, $path);
+ if (!opendir (my $dh, $path)) {
+ print STDERR "WARNING: print_stacktrace_linux: Couldn't opendir $path: $!\n";
+ return;
+ }
my @files = grep (/$prefix[0-9]+$suffix/, readdir ($dh));
my $latest_timestamp;
my $chosen_core_file;
@@ -669,7 +673,7 @@ sub print_stacktrace_linux
if (defined $chosen_core_file) {
$core_file_path = $path . "/" . $chosen_core_file;
} else {
- print STDOUT "WARNING: Could not determine a core file with timestamp\n";
+ print STDERR "WARNING: print_stacktrace_linux: Could not determine a core file with timestamp\n";
return;
}
} else {
@@ -677,7 +681,7 @@ sub print_stacktrace_linux
}
if (!(-e $core_file_path)) {
- print STDOUT "WARNING: Core file $core_file_path does not exist\n";
+ print STDERR "WARNING: print_stacktrace_linux: Core file $core_file_path does not exist\n";
return;
}
@@ -686,10 +690,10 @@ sub print_stacktrace_linux
if (system ("gdb --version") != -1) {
$stack_trace = `gdb $exec_path -c $core_file_path -ex bt -ex quit`;
} elsif (system ("lldb --version") != -1) {
- print STDOUT "WARNING: Failed printing stack trace with gdb. Trying lldb...\n";
+ print STDERR "WARNING: print_stacktrace_linux: Failed printing stack trace with gdb. Trying lldb...\n";
$stack_trace = `lldb $exec_path -c $core_file_path -o bt -o quit`;
} else {
- print STDOUT "WARNING: Failed printing stack trace with both gdb and lldb\n";
+ print STDERR "WARNING: print_stacktrace_linux: Failed printing stack trace with both gdb and lldb\n";
}
if (defined $stack_trace) {