Guest User

Untitled

a guest
Aug 28th, 2012
34
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 1.54 KB | None | 0 0
  1. commit b548c8098fcc954056a68bc9cc7f755262402254
  2. Author: Ivan Dives <[email protected]>
  3. Date:   Wed Aug 15 03:23:56 2012 +0300
  4.  
  5.     foo
  6.  
  7. diff --git a/dbus/backtrace.h b/dbus/backtrace.h
  8. new file mode 100644
  9. index 0000000..3c09622
  10. --- /dev/null
  11. +++ b/dbus/backtrace.h
  12. @@ -0,0 +1,26 @@
  13. +#ifndef BACKTRACE_H
  14. +#define BACKTRACE_H
  15. +
  16. +#include <execinfo.h>
  17. +#include <stdlib.h>
  18. +#include <syslog.h>
  19. +
  20. +#define BACKTRACE_BUFFER_SIZE 100
  21. +#define BACKTRACE() { \
  22. +  int j, nptrs; \
  23. +  void *buffer[BACKTRACE_BUFFER_SIZE]; \
  24. +  char ** strings; \
  25. +  nptrs = backtrace(buffer, BACKTRACE_BUFFER_SIZE); \
  26. +  syslog(LOG_NOTICE, "%s(): backtrace() returned %d addresses\n", __func__, nptrs); \
  27. +  strings = backtrace_symbols(buffer, nptrs); \
  28. +  if (strings == NULL) { \
  29. +    syslog(LOG_NOTICE, "strings == NULL"); \
  30. +  } else { \
  31. +    for (j = 0; j < nptrs; j++) \
  32. +      syslog(LOG_NOTICE, "%s\n", strings[j]); \
  33. +    free(strings); \
  34. +  } \
  35. +}
  36. +
  37. +#endif /* BACKTRACE_H */
  38. +
  39. diff --git a/dbus/dbus-server-socket.c b/dbus/dbus-server-socket.c
  40. index ae4b602..a1f2f60 100644
  41. --- a/dbus/dbus-server-socket.c
  42. +++ b/dbus/dbus-server-socket.c
  43. @@ -22,6 +22,7 @@
  44.   */
  45.  
  46.  #include <config.h>
  47. +#include "backtrace.h"
  48.  #include "dbus-internals.h"
  49.  #include "dbus-server-socket.h"
  50.  #include "dbus-transport-socket.h"
  51. @@ -162,6 +163,8 @@ socket_handle_watch (DBusWatch    *watch,
  52.    DBusServer *server = data;
  53.    DBusServerSocket *socket_server = data;
  54.  
  55. +  BACKTRACE();
  56. +
  57.  #ifndef DBUS_DISABLE_ASSERT
  58.    int i;
  59.    dbus_bool_t found = FALSE;
Advertisement
Add Comment
Please, Sign In to add comment