Find the answer to your Linux question:
Results 1 to 2 of 2
When my c++ app crashes I would like to generate stackdump and display dumped register values. My app runs on Fedora Linux 2.6 . I would like my program to ...
  1. #1
    Just Joined!
    Join Date
    Mar 2011
    Posts
    7

    How to generate stackdump & dumped register when an app crashes in gcc

    When my c++ app crashes I would like to generate stackdump and display dumped register values.

    My app runs on Fedora Linux 2.6 .

    I would like my program to be able to generate stackdump and display dumped register values when it crashes and the next time the user run's it, it will ask them if it is ok to send these to me so I can track down the problem. I can handle the stacktrace info but I don't know how to generate these two things. Any ideas?

    Advance thanks to all repliers

    Thank you vlc

  2. #2
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
    Posts
    8,974
    You need to enable your system to dump core files when a crash occurs. From the 'core' man page:
    Code:
       Piping core dumps to a program
           Since kernel 2.6.19, Linux supports an alternate syntax for the  /proc/sys/kernel/core_pattern  file.   If  the
           first  character  of this file is a pipe symbol (|), then the remainder of the line is interpreted as a program
           to be executed.  Instead of being written to a disk file, the core dump is given as standard input to the  pro-
           gram.  Note the following points:
    
           *  The  program must be specified using an absolute pathname (or a pathname relative to the root directory, /),
              and must immediately follow the ’|’ character.
    
           *  The process created to run the program runs as user and group root.
    
           *  Command-line arguments can be supplied to the program (since kernel 2.6.24), delimited by white space (up to
              a total line length of 128 bytes).
    
           *  The  command-line  arguments can include any of the % specifiers listed above.  For example, to pass the PID
              of the process that is being dumped, specify %p in an argument.
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...