* Introduced a per-team counter that is incremented whenever an image

is created or deleted (or exec*() has been invoked). The counter is
  sent with several debugger messages.
* Track the image event counter that is used when samples are added to
  the profiling buffer. If the current team counter differs, we flush
  the buffer first (sending an update message to the debugger), so that
  the debugger has a chance to match the addresses to the correct images.
* Disable profiling for a thread while it runs in the debugger support
  code. This fixes potential deadlocks which could occur when a
  profiling timer event occurred that would require the buffer to be
  flushed while the thread was just sending something to the debugger or
  waiting for a command. As it turns out, this is not sufficient either,
  since we should never try to flush the buffer when the timer event
  occurred in the kernel, since the thread might hold a lock that the
  debugger thread could try to acquire. Will implement a more general
  solution later.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27656 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold
2008-09-20 20:37:10 +00:00
parent 18fe1bf6fb
commit eba9a4c3ee
3 changed files with 170 additions and 44 deletions
+7
View File
@@ -54,6 +54,8 @@ struct team_debug_info {
sem_id debugger_write_lock;
// synchronizes writes to the debugger port with the setting (but not
// clearing) of the B_TEAM_DEBUG_DEBUGGER_HANDOVER flag
vint32 image_event;
// counter incremented whenever an image is created/deleted
struct arch_team_debug_info arch_info;
};
@@ -86,6 +88,11 @@ struct thread_debug_info {
// number of samples the buffer currently holds
int32 stack_depth;
// number of return addresses to record per timer interval
int32 image_event;
// number of the image event when the first sample was written into
// the buffer
int32 disabled;
// if > 0, profiling is temporarily disabled for the thread
bool buffer_full;
// indicates that the sample buffer is full
union {