Leosac  0.8.0
Open Source Access Control
Stacktrace.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2014-2016 Leosac
3 
4  This file is part of Leosac.
5 
6  Leosac is free software: you can redistribute it and/or modify
7  it under the terms of the GNU Affero General Public License as published by
8  the Free Software Foundation, either version 3 of the License, or
9  (at your option) any later version.
10 
11  Leosac is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU Affero General Public License for more details.
15 
16  You should have received a copy of the GNU Affero General Public License
17  along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19 
20 #pragma once
21 
22 #include <string>
23 #include <vector>
24 
25 namespace Leosac
26 {
27 namespace Tools
28 {
43 {
44  public:
50  Stacktrace(uint skip /* = 0 */);
51 
52  struct Frame
53  {
55  : suppressed_(false)
56  , line_(0)
57  {
58  }
59 
65  std::string function_;
66  std::string file_;
67  int line_;
68  };
69 
70  std::string str(int max_frames = 10) const;
71 
72  private:
77  std::vector<Frame> stack_;
78 };
79 }
80 }
Leosac::Tools::Stacktrace
Store information about a stacktrace at a given point in the program execution.
Definition: Stacktrace.hpp:42
Leosac::Tools::Stacktrace::Frame::file_
std::string file_
Definition: Stacktrace.hpp:66
Leosac::Tools::Stacktrace::str
std::string str(int max_frames=10) const
Definition: Stacktrace.cpp:68
Leosac
This is the header file for a generated source file, GitSHA1.cpp.
Definition: APIStatusCode.hpp:22
Leosac::Tools::Stacktrace::Frame::suppressed_
bool suppressed_
Flagged as true if the frame represents an unknown function.
Definition: Stacktrace.hpp:64
Leosac::Tools::Stacktrace::Frame::line_
int line_
Definition: Stacktrace.hpp:67
Leosac::Tools::Stacktrace::Frame::Frame
Frame()
Definition: Stacktrace.hpp:54
Leosac::Tools::Stacktrace::stack_
std::vector< Frame > stack_
We use a vector to represent the stack so we can iterate on the frames.
Definition: Stacktrace.hpp:77
Leosac::Tools::Stacktrace::Frame
Definition: Stacktrace.hpp:52
Leosac::Tools::Stacktrace::Stacktrace
Stacktrace(uint skip)
Build a new stacktrace.
Definition: Stacktrace.cpp:36
Leosac::Tools::Stacktrace::Frame::function_
std::string function_
Definition: Stacktrace.hpp:65