示例#1
0
JBoolean
CMBreakpointManager::GetBreakpoints
	(
	const CMLocation&			loc,
	JPtrArray<CMBreakpoint>*	list
	)
	const
{
	list->RemoveAll();
	list->SetCleanUpAction(JPtrArrayT::kForgetAll);

	if ((loc.GetFileID()).IsValid())
		{
		CMBreakpoint target(loc.GetFileName(), loc.GetLineNumber());
		JBoolean found;
		const JIndex startIndex =
			itsBPList->SearchSorted1(&target, JOrderedSetT::kFirstMatch, &found);

		const JSize count = itsBPList->GetElementCount();
		for (JIndex i=startIndex; i<=count; i++)
			{
			CMBreakpoint* bp = itsBPList->NthElement(i);
			if (bp->GetLocation() == loc)
				{
				list->Append(bp);
				}
			else
				{
				break;
				}
			}
		}
	else if (!loc.GetFunctionName().IsEmpty())
		{
		const JSize count = itsBPList->GetElementCount();
		for (JIndex i=1; i<=count; i++)
			{
			CMBreakpoint* bp = itsBPList->NthElement(i);
			if (bp->GetFunctionName() == loc.GetFunctionName())
				{
				list->Append(bp);
				}
			}
		}

	return !list->IsEmpty();
}
void
CMSourceDirector::DisplayDisassembly
	(
	const CMLocation& loc
	)
{
	const JString& fnName = loc.GetFunctionName();
	const JString& addr   = loc.GetMemoryAddress();

	assert( !JStringEmpty(fnName) );
	assert( !JStringEmpty(addr) );

	if (fnName == itsCurrentFn)
		{
		JIndex i;
		if (dynamic_cast<CMLineAddressTable*>(itsTable)->FindAddressLineNumber(addr, &i))
			{
			DisplayLine(i);
			}
		else
			{
			itsTable->SetCurrentLine(0);
			}

		UpdateWindowTitle(NULL);
		}
	else
		{
		itsCurrentFn = fnName;

		if (itsGetAssemblyCmd == NULL)
			{
			itsGetAssemblyCmd = (CMGetLink())->CreateGetAssembly(this);
			}

		if (itsGetAssemblyCmd != NULL)
			{
			itsAsmLocation = loc;
			itsGetAssemblyCmd->Send();
			}

		UpdateWindowTitle(NULL);
		}
}