Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

abort core dump message into a user file as log message

63 views
Skip to first unread message

kushal bhattacharya

unread,
Aug 23, 2017, 7:55:50 AM8/23/17
to
Hi,
Is it possible in Linux,that I can dump the abort message to my own named file when the program crashes?
Thanks

kushal bhattacharya

unread,
Aug 23, 2017, 8:31:37 AM8/23/17
to
I am developing a user program which will ge notified about the crash and the crash stacktrace would be shown to him

Scott Lurndal

unread,
Aug 23, 2017, 8:33:12 AM8/23/17
to
What "abort message" are you referring to?

When an Operting System handles an uncaught signal that has default
termination semantics (e.g. SIGSEGV), it will terminate
the process. The process status is passed to the parent process
(generally a shell) via the waitpid(2), waitid(2) or wait(2)
system calls. The parent process is free to handle this in
any fashion. Most shells will print a message to stderr.

kushal bhattacharya

unread,
Aug 23, 2017, 8:37:39 AM8/23/17
to
Suppose if the program aborts with a message like
Terminate called with active exception ,i want to dump this message into a file.I want to do this because the user program is runing as a daemon so no message would be printed on the terminal and the user wont be notified normally in this case

kushal bhattacharya

unread,
Aug 23, 2017, 8:38:56 AM8/23/17
to
On Wednesday, August 23, 2017 at 6:03:12 PM UTC+5:30, Scott Lurndal wrote:
In this case the parent process is not notified at all so how would i handle this situation

red floyd

unread,
Aug 23, 2017, 11:45:15 AM8/23/17
to
You are off-topic here. The ISO C++ standard does not discuss "Linux".
Try asking in a Linux group. This is OS specific.

A good way to determine if you are on topic here is to ask yourself,
"If I changed the language, would it still be the same question?"
Or "If I changed the OS, would the question still be relevant?"

For the first, if the answer was yes, you would be off-topic.
For the second, if the answer was no, you would be off-topic.

Scott Lurndal

unread,
Aug 23, 2017, 12:25:14 PM8/23/17
to
So find the code that prints that message and fix it to
print the message to a file. It's either the program itself
or some library that the program is linking with (or the C++
runtime for e.g. uncaught C++ exceptions).

Generally, a daemon will either use the 'syslog' library function
or will print a message to stderr. In the latter case, one simply
needs to redirect stderr to a disk file, presumable one opened with
O_APPEND.

kushal bhattacharya

unread,
Aug 24, 2017, 12:44:11 AM8/24/17
to
that message is printed from the system itself in this case it comes suppose if i dont pass the correct json key on the boost json parser in this case that is thrwon by the boost json library itself as abort message

kushal bhattacharya

unread,
Aug 24, 2017, 12:45:13 AM8/24/17
to
but its a facilty of c++ too i guess.I am mainly concerned about dumping the abort message from the program to my own custom file .

red floyd

unread,
Aug 24, 2017, 1:38:54 PM8/24/17
to
The ISO standard does not discuss it. You yourself have said it's
generated by the OS. Therefore by definition, it's out of scope here.

kushal bhattacharya

unread,
Aug 27, 2017, 8:19:32 AM8/27/17
to
Actually i want to use that from a c++ program itself so i really want some pointers here :-( since i am not getting any clue from my end

red floyd

unread,
Aug 28, 2017, 12:24:13 PM8/28/17
to
The problem is that it is system specific. You will not get any help
from a C++ group, since the answer would be the same for C, Pascal,
or any other language.

You need to ask in a group that has "Linux" in its name.


kushal bhattacharya

unread,
Aug 29, 2017, 1:59:28 AM8/29/17
to
ok thanx i am going to ask this on a linux forum
0 new messages