StackTrace.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /*
  2. * Copyright (c) 2001 Jani Kajala
  3. *
  4. * Permission to use, copy, modify, distribute and sell this
  5. * software and its documentation for any purpose is hereby
  6. * granted without fee, provided that the above copyright notice
  7. * appear in all copies and that both that copyright notice and
  8. * this permission notice appear in supporting documentation.
  9. * Jani Kajala makes no representations about the suitability
  10. * of this software for any purpose. It is provided "as is"
  11. * without express or implied warranty.
  12. */
  13. #ifndef _DEV_STACKTRACE_H
  14. #define _DEV_STACKTRACE_H
  15. namespace dev
  16. {
  17. class MapFile;
  18. /** Stack tracing utility. */
  19. class StackTrace
  20. {
  21. public:
  22. /**
  23. * Prints formatted call stack to the user buffer.
  24. * Always terminates the user buffer with 0.
  25. *
  26. * @param map Array of pointers to map files.
  27. * @param maps Number of map files.
  28. * @param initLevel Number of functions to skip before starting the tracing.
  29. * @param maxDepth Maximum number of levels in the stack trace.
  30. * @param buffer [out] Output buffer for the formatted stack trace.
  31. * @param bufferSize Size of the output buffer.
  32. * @return Needed buffer size.
  33. */
  34. static int printStackTrace( MapFile** map, int maps,
  35. int initLevel, int maxDepth,
  36. char* buffer, int bufferSize );
  37. };
  38. } /* dev */
  39. #endif /* _DEV_STACKTRACE_H */