示例#1
0
    void SetStackTrace(StackTrace* stackTrace)
    {
        // unset old frames
        if (fStackTrace != NULL && fStackTrace->CountFrames())
            NotifyRowsRemoved(0, fStackTrace->CountFrames());

        fStackTrace = stackTrace;

        // set new frames
        if (fStackTrace != NULL && fStackTrace->CountFrames() > 0)
            NotifyRowsAdded(0, fStackTrace->CountFrames());
    }
示例#2
0
	bool Update(UserBreakpoint* changedBreakpoint)
	{
		if (fTeam == NULL) {
			for (int32 i = 0;
				UserBreakpoint* breakpoint = fBreakpoints.ItemAt(i);
				i++) {
				breakpoint->ReleaseReference();
			}
			fBreakpoints.MakeEmpty();

			return true;
		}

		AutoLocker<Team> locker(fTeam);

		UserBreakpointList::ConstIterator it
			= fTeam->UserBreakpoints().GetIterator();
		UserBreakpoint* newBreakpoint = it.Next();
		int32 index = 0;

		// remove no longer existing breakpoints
		while (UserBreakpoint* oldBreakpoint = fBreakpoints.ItemAt(index)) {
			if (oldBreakpoint == newBreakpoint) {
				if (oldBreakpoint == changedBreakpoint)
					NotifyRowsChanged(index, 1);
				index++;
				newBreakpoint = it.Next();
			} else {
				// TODO: Not particularly efficient!
				fBreakpoints.RemoveItemAt(index);
				oldBreakpoint->ReleaseReference();
				NotifyRowsRemoved(index, 1);
			}
		}

		// add new breakpoints
		int32 countBefore = fBreakpoints.CountItems();
		while (newBreakpoint != NULL) {
			if (!fBreakpoints.AddItem(newBreakpoint))
				return false;

			newBreakpoint->AcquireReference();
			newBreakpoint = it.Next();
		}

		int32 count = fBreakpoints.CountItems();
		if (count > countBefore)
			NotifyRowsAdded(countBefore, count - countBefore);

		return true;
	}
示例#3
0
	bool Update(thread_id threadID)
	{
		if (fTeam == NULL) {
			for (int32 i = 0; Thread* thread = fThreads.ItemAt(i); i++)
				thread->ReleaseReference();
			fThreads.MakeEmpty();

			return true;
		}

		AutoLocker<Team> locker(fTeam);

		ThreadList::ConstIterator it = fTeam->Threads().GetIterator();
		Thread* newThread = it.Next();
		int32 index = 0;

		// remove no longer existing threads
		while (Thread* oldThread = fThreads.ItemAt(index)) {
			if (oldThread == newThread) {
				if (threadID >= 0 && oldThread->ID() == threadID)
					NotifyRowsChanged(index, 1);
				index++;
				newThread = it.Next();
			} else {
				// TODO: Not particularly efficient!
				fThreads.RemoveItemAt(index);
				oldThread->ReleaseReference();
				NotifyRowsRemoved(index, 1);
			}
		}

		// add new threads
		int32 countBefore = fThreads.CountItems();
		while (newThread != NULL) {
			if (!fThreads.AddItem(newThread))
				return false;

			newThread->AcquireReference();
			newThread = it.Next();
		}

		int32 count = fThreads.CountItems();
		if (count > countBefore)
			NotifyRowsAdded(countBefore, count - countBefore);

		return true;
	}
	bool Update()
	{
		if (fTeam == NULL) {
			for (int32 i = 0; Image* image = fImages.ItemAt(i); i++)
				image->ReleaseReference();
			fImages.MakeEmpty();

			return true;
		}

		AutoLocker<Team> locker(fTeam);

		ImageList::ConstIterator it = fTeam->Images().GetIterator();
		Image* newImage = it.Next();
		int32 index = 0;

		// remove no longer existing images
		while (Image* oldImage = fImages.ItemAt(index)) {
			if (oldImage == newImage) {
				index++;
				newImage = it.Next();
			} else {
				// TODO: Not particularly efficient!
				fImages.RemoveItemAt(index);
				oldImage->ReleaseReference();
				NotifyRowsRemoved(index, 1);
			}
		}

		// add new images
		int32 countBefore = fImages.CountItems();
		while (newImage != NULL) {
			if (!fImages.AddItem(newImage))
				return false;

			newImage->AcquireReference();
			newImage = it.Next();
		}

		int32 count = fImages.CountItems();
		if (count > countBefore)
			NotifyRowsAdded(countBefore, count - countBefore);

		return true;
	}
示例#5
0
	bool UpdateBreakpoint(BreakpointProxy* proxy)
	{
		if (fTeam == NULL) {
			for (int32 i = 0;
				BreakpointProxy* proxy = fBreakpointProxies.ItemAt(i);
				i++) {
				proxy->ReleaseReference();
			}
			fBreakpointProxies.MakeEmpty();

			return true;
		}

		AutoLocker<Team> locker(fTeam);

		UserBreakpointList::ConstIterator it
			= fTeam->UserBreakpoints().GetIterator();
		int32 watchpointIndex = 0;
		UserBreakpoint* newBreakpoint = it.Next();
		Watchpoint* newWatchpoint = fTeam->WatchpointAt(watchpointIndex);
		int32 index = 0;
		bool remove;

		// remove no longer existing breakpoints
		while (BreakpointProxy* oldProxy = fBreakpointProxies.ItemAt(index)) {
			remove = false;
			switch (oldProxy->Type()) {
				case BREAKPOINT_PROXY_TYPE_BREAKPOINT:
				{
					UserBreakpoint* breakpoint = oldProxy->GetBreakpoint();
					if (breakpoint == newBreakpoint) {
						if (breakpoint == proxy->GetBreakpoint())
							NotifyRowsChanged(index, 1);
						++index;
						newBreakpoint = it.Next();
					} else
						remove = true;
				}
				break;

				case BREAKPOINT_PROXY_TYPE_WATCHPOINT:
				{
					Watchpoint* watchpoint = oldProxy->GetWatchpoint();
					if (watchpoint == newWatchpoint) {
						if (watchpoint == proxy->GetWatchpoint())
							NotifyRowsChanged(index, 1);
						++watchpointIndex;
						++index;
						newWatchpoint = fTeam->WatchpointAt(watchpointIndex);
					} else
						remove = true;
				}
				break;
			}

			if (remove) {
				// TODO: Not particularly efficient!
				fBreakpointProxies.RemoveItemAt(index);
				oldProxy->ReleaseReference();
				NotifyRowsRemoved(index, 1);
			}
		}

		// add new breakpoints
		int32 countBefore = fBreakpointProxies.CountItems();
		BreakpointProxy* newProxy = NULL;
		BReference<BreakpointProxy> proxyReference;
		while (newBreakpoint != NULL) {
			newProxy = new(std::nothrow) BreakpointProxy(newBreakpoint, NULL);
			if (newProxy == NULL)
				return false;

			proxyReference.SetTo(newProxy, true);
			if (!fBreakpointProxies.AddItem(newProxy))
				return false;

			proxyReference.Detach();
			newBreakpoint = it.Next();
		}

		// add new watchpoints
		while (newWatchpoint != NULL) {
			newProxy = new(std::nothrow) BreakpointProxy(NULL, newWatchpoint);
			if (newProxy == NULL)
				return false;

			proxyReference.SetTo(newProxy, true);
			if (!fBreakpointProxies.AddItem(newProxy))
				return false;

			proxyReference.Detach();
			newWatchpoint = fTeam->WatchpointAt(++watchpointIndex);
		}


		int32 count = fBreakpointProxies.CountItems();
		if (count > countBefore)
			NotifyRowsAdded(countBefore, count - countBefore);

		return true;
	}