trace.h 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. /*
  2. (c) Copyright 2001-2009 The world wide DirectFB Open Source Community (directfb.org)
  3. (c) Copyright 2000-2004 Convergence (integrated media) GmbH
  4. All rights reserved.
  5. Written by Denis Oliver Kropp <dok@directfb.org>,
  6. Andreas Hundt <andi@fischlustig.de>,
  7. Sven Neumann <neo@directfb.org>,
  8. Ville Syrjälä <syrjala@sci.fi> and
  9. Claudio Ciccani <klan@users.sf.net>.
  10. This library is free software; you can redistribute it and/or
  11. modify it under the terms of the GNU Lesser General Public
  12. License as published by the Free Software Foundation; either
  13. version 2 of the License, or (at your option) any later version.
  14. This library is distributed in the hope that it will be useful,
  15. but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  17. Lesser General Public License for more details.
  18. You should have received a copy of the GNU Lesser General Public
  19. License along with this library; if not, write to the
  20. Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  21. Boston, MA 02111-1307, USA.
  22. */
  23. #ifndef __DIRECT__TRACE_H__
  24. #define __DIRECT__TRACE_H__
  25. #include <direct/types.h>
  26. /***********************************************************************************************************************
  27. ** Symbols
  28. */
  29. /*
  30. * Returns filename on success or NULL.
  31. *
  32. * Stores load address of object in 'ret_base' on success.
  33. */
  34. const char *direct_trace_lookup_file ( void *address,
  35. void **ret_base );
  36. /*
  37. * Look up a symbol by filename and offset.
  38. *
  39. * Returns symbol name on success or NULL.
  40. */
  41. const char *direct_trace_lookup_symbol( const char *filename,
  42. long offset );
  43. /*
  44. * Convenience function combining direct_trace_lookup_file() and direct_trace_lookup_symbol().
  45. */
  46. static inline const char *
  47. direct_trace_lookup_symbol_at( void *address )
  48. {
  49. void *base;
  50. const char *filename;
  51. filename = direct_trace_lookup_file( address, &base );
  52. return direct_trace_lookup_symbol( filename, (unsigned long) address - (unsigned long) base );
  53. }
  54. /***********************************************************************************************************************
  55. ** Stacks
  56. */
  57. /*
  58. * Print stack in 'buffer' or current if NULL.
  59. */
  60. void direct_trace_print_stack( DirectTraceBuffer *buffer );
  61. /*
  62. * Print stack of each known thread.
  63. */
  64. void direct_trace_print_stacks( void );
  65. /*
  66. * Returns indent level for debug output.
  67. */
  68. int direct_trace_debug_indent( void );
  69. /*
  70. * Create a copy of a stack in 'buffer' or of current if NULL.
  71. */
  72. DirectTraceBuffer *direct_trace_copy_buffer( DirectTraceBuffer *buffer );
  73. /*
  74. * Free a (copied) stack buffer.
  75. */
  76. void direct_trace_free_buffer( DirectTraceBuffer *buffer );
  77. #endif