197403Sobrien// -*- C++ -*- Exception handling routines for catching.
297403Sobrien// Copyright (C) 2001 Free Software Foundation, Inc.
397403Sobrien//
4132720Skan// This file is part of GCC.
597403Sobrien//
6132720Skan// GCC is free software; you can redistribute it and/or modify
797403Sobrien// it under the terms of the GNU General Public License as published by
897403Sobrien// the Free Software Foundation; either version 2, or (at your option)
997403Sobrien// any later version.
1097403Sobrien//
11132720Skan// GCC is distributed in the hope that it will be useful,
1297403Sobrien// but WITHOUT ANY WARRANTY; without even the implied warranty of
1397403Sobrien// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1497403Sobrien// GNU General Public License for more details.
1597403Sobrien//
1697403Sobrien// You should have received a copy of the GNU General Public License
17132720Skan// along with GCC; see the file COPYING.  If not, write to
18169691Skan// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
19169691Skan// Boston, MA 02110-1301, USA.
2097403Sobrien
2197403Sobrien// As a special exception, you may use this file as part of a free software
2297403Sobrien// library without restriction.  Specifically, if other files instantiate
2397403Sobrien// templates or use macros or inline functions from this file, or you compile
2497403Sobrien// this file and link it with other files to produce an executable, this
2597403Sobrien// file does not by itself cause the resulting executable to be covered by
2697403Sobrien// the GNU General Public License.  This exception does not however
2797403Sobrien// invalidate any other reasons why the executable file might be covered by
2897403Sobrien// the GNU General Public License.
2997403Sobrien
3097403Sobrien
3197403Sobrien#include <typeinfo>
32169691Skan#include <cxxabi.h>
3397403Sobrien#include "unwind-cxx.h"
3497403Sobrien
3597403Sobriennamespace __cxxabiv1
3697403Sobrien{
3797403Sobrien
3897403Sobrien// Returns the type_info for the currently handled exception [15.3/8], or
3997403Sobrien// null if there is none.
4097403Sobrienextern "C"
4197403Sobrienstd::type_info *__cxa_current_exception_type ()
4297403Sobrien{
4397403Sobrien  __cxa_eh_globals *globals = __cxa_get_globals ();
4497403Sobrien  __cxa_exception *header = globals->caughtExceptions;
4597403Sobrien  if (header)
4697403Sobrien    return header->exceptionType;
4797403Sobrien  else
4897403Sobrien    return 0;
4997403Sobrien}
5097403Sobrien
5197403Sobrien} // namespace __cxxabiv1
52