Changeset 0f481ad in rtems-tools


Ignore:
Timestamp:
May 24, 2018, 6:02:59 AM (11 months ago)
Author:
Chris Johns <chrisj@…>
Branches:
master
Children:
1318c11
Parents:
1cab261
git-author:
Chris Johns <chrisj@…> (05/24/18 06:02:59)
git-committer:
Chris Johns <chrisj@…> (06/18/18 02:26:16)
Message:

rtemstoolkit: Add an output routine for a std::exception.

The output routine is used by a number of tools.

Location:
rtemstoolkit
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • rtemstoolkit/rld.cpp

    r1cab261 r0f481ad  
    2929#include <iostream>
    3030
     31#include <cxxabi.h>
    3132#include <sys/stat.h>
    3233
     
    8182   */
    8283  static uint64_t _version_revision;
     84
     85  void
     86  output_std_exception (std::exception e, std::ostream& out)
     87  {
     88    int   status;
     89    char* realname;
     90    realname = abi::__cxa_demangle (e.what(), 0, 0, &status);
     91    out << "error: exception: " << realname << " [";
     92    ::free (realname);
     93    const std::type_info &ti = typeid (e);
     94    realname = abi::__cxa_demangle (ti.name(), 0, 0, &status);
     95    out << realname << "] " << e.what () << std::endl;
     96    ::free (realname);
     97  }
    8398
    8499  bool
  • rtemstoolkit/rld.h

    r1cab261 r0f481ad  
    106106
    107107  /**
     108   * Handle a standard exception.
     109   */
     110  void output_std_exception (std::exception e, std::ostream& out);
     111
     112  /**
    108113   * A convenience macro to make where a file and line number.
    109114   */
Note: See TracChangeset for help on using the changeset viewer.