コード例 #1
0
status_t
DebugReportGenerator::_DumpLoadedImages(BString& _output)
{
	AutoLocker< ::Team> locker(fTeam);

	_output << "\nLoaded Images:\n";
	BString data;
	for (ImageList::ConstIterator it = fTeam->Images().GetIterator();
		 Image* image = it.Next();) {
		const ImageInfo& info = image->Info();
		char buffer[32];
		try {
			target_addr_t textBase = info.TextBase();
			target_addr_t dataBase = info.DataBase();

			data.SetToFormat("\t%s (%" B_PRId32 ", %s) "
				"Text: %#08" B_PRIx64 " - %#08" B_PRIx64 ", Data: %#08"
				B_PRIx64 " - %#08" B_PRIx64 "\n", info.Name().String(),
				info.ImageID(), UiUtils::ImageTypeToString(info.Type(),
					buffer, sizeof(buffer)), textBase,
				textBase + info.TextSize(), dataBase,
				dataBase + info.DataSize());

			_output << data;
		} catch (...) {
			return B_NO_MEMORY;
		}
	}

	return B_OK;
}
コード例 #2
0
ファイル: Thread.cpp プロジェクト: AmirAbrams/haiku
ImageProfileResult*
Thread::VisitImages(Visitor& visitor) const
{
	ImageList::ConstIterator it = fOldImages.GetIterator();
	while (ThreadImage* image = it.Next()) {
		if (visitor.VisitImage(image->Result()))
			return image->Result();
	}

	it = fImages.GetIterator();
	while (ThreadImage* image = it.Next()) {
		if (visitor.VisitImage(image->Result()))
			return image->Result();
	}

	return NULL;
}
コード例 #3
0
	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;
	}
コード例 #4
0
ファイル: Team.cpp プロジェクト: AmirAbrams/haiku
Image*
Team::ImageByAddress(target_addr_t address) const
{
	for (ImageList::ConstIterator it = fImages.GetIterator();
			Image* image = it.Next();) {
		if (image->ContainsAddress(address))
			return image;
	}

	return NULL;
}
コード例 #5
0
ファイル: Team.cpp プロジェクト: AmirAbrams/haiku
Image*
Team::ImageByID(image_id imageID) const
{
	for (ImageList::ConstIterator it = fImages.GetIterator();
			Image* image = it.Next();) {
		if (image->ID() == imageID)
			return image;
	}

	return NULL;
}
コード例 #6
0
ファイル: Thread.cpp プロジェクト: AmirAbrams/haiku
ImageProfileResult*
Thread::FindImage(addr_t address, addr_t& _loadDelta) const
{
	ImageList::ConstIterator it = fImages.GetIterator();
	while (ThreadImage* image = it.Next()) {
		if (image->GetImage()->ContainsAddress(address)) {
			_loadDelta = image->GetImage()->LoadDelta();
			return image->Result();
		}
	}
	return NULL;
}
コード例 #7
0
status_t
DebugReportGenerator::_DumpLoadedImages(BFile& _output)
{
	AutoLocker< ::Team> locker(fTeam);

	BString data("\nLoaded Images:\n");
	WRITE_AND_CHECK(_output, data);
	BObjectList<Image> images;
	for (ImageList::ConstIterator it = fTeam->Images().GetIterator();
		 Image* image = it.Next();) {
		 images.AddItem(image);
	}

	images.SortItems(&_CompareImages);

	Image* image = NULL;
	data.SetToFormat("\tID\t\tText Base\tText End\tData Base\tData"
		" End\tType\tName\n\t");
	WRITE_AND_CHECK(_output, data);
	data.Truncate(0L);
	data.Append('-', 80);
	data.Append("\n");
	WRITE_AND_CHECK(_output, data);
	for (int32 i = 0; (image = images.ItemAt(i)) != NULL; i++) {
		const ImageInfo& info = image->Info();
		char buffer[32];
		try {
			target_addr_t textBase = info.TextBase();
			target_addr_t dataBase = info.DataBase();

			data.SetToFormat("\t%" B_PRId32 "\t0x%08" B_PRIx64 "\t"
				"0x%08" B_PRIx64 "\t0x%08" B_PRIx64 "\t0x%08" B_PRIx64 "\t"
				"%-7s\t%s\n", info.ImageID(), textBase, textBase + info.TextSize(),
				dataBase, dataBase + info.DataSize(),
				UiUtils::ImageTypeToString(info.Type(), buffer,
					sizeof(buffer)), info.Name().String());

			WRITE_AND_CHECK(_output, data);
		} catch (...) {
			return B_NO_MEMORY;
		}
	}

	return B_OK;
}
コード例 #8
0
void
BreakConditionConfigWindow::_UpdateExceptionState()
{
	// check if the exception breakpoints are already installed
	for (ImageList::ConstIterator it = fTeam->Images().GetIterator();
		it.HasNext();) {
		Image* image = it.Next();

		ImageDebugInfo* info = image->GetImageDebugInfo();
		target_addr_t address;
		if (_FindExceptionFunction(info, address) != B_OK)
			continue;

		if (fTeam->BreakpointAtAddress(address) != NULL) {
			fExceptionThrown->SetValue(B_CONTROL_ON);
			break;
		}
	}
}
コード例 #9
0
void
BreakConditionConfigWindow::_UpdateThrownBreakpoints(bool enable)
{
	AutoLocker< ::Team> teamLocker(fTeam);
	for (ImageList::ConstIterator it = fTeam->Images().GetIterator();
		it.HasNext();) {
		Image* image = it.Next();

		ImageDebugInfo* info = image->GetImageDebugInfo();
		target_addr_t address;
		if (_FindExceptionFunction(info, address) != B_OK)
			continue;

		if (enable)
			fListener->SetBreakpointRequested(address, true, true);
		else
			fListener->ClearBreakpointRequested(address);
	}
}