MCPcopy Create free account
hub / github.com/AppleWin/AppleWin / _CmdBreakpointAddCommonArg

Function _CmdBreakpointAddCommonArg

source/Debugger/Debug.cpp:1760–1816  ·  view source on GitHub ↗

@return Number of args processed ===========================================================================

Source from the content-addressed store, hash-verified

1758// @return Number of args processed
1759//===========================================================================
1760int _CmdBreakpointAddCommonArg ( const int nArg, int iArg, BreakpointSource_t iSrc, BreakpointOperator_t iCmp, bool bIsTempBreakpoint )
1761{
1762 int dArgPrefix = 0;
1763 int dArg = 0;
1764
1765 int iBreakpoint = 0;
1766 Breakpoint_t *pBP = & g_aBreakpoints[ iBreakpoint ];
1767
1768 while ((iBreakpoint < MAX_BREAKPOINTS) && g_aBreakpoints[iBreakpoint].bSet) //g_aBreakpoints[iBreakpoint].nLength)
1769 {
1770 iBreakpoint++;
1771 pBP++;
1772 }
1773
1774 if (iBreakpoint >= MAX_BREAKPOINTS)
1775 {
1776 ConsoleDisplayError("All Breakpoint slots are currently in use.");
1777 return 0; // error
1778 }
1779
1780 pBP->Clear();
1781
1782 //
1783
1784 if (iArg <= nArg)
1785 {
1786 if (!Range_GetAllPrefixes(iArg, nArg, dArgPrefix, &pBP->addrPrefix))
1787 return 0; // error
1788
1789#if DEBUG_VAL_2
1790 int nLen = g_aArgs[iArg].nVal2;
1791#endif
1792 WORD nAddress = 0;
1793 WORD nAddress2 = 0;
1794 int nLen = 0;
1795
1796 dArg = 1;
1797 RangeType_t eRange = Range_Get( nAddress, nAddress2, iArg);
1798 if ((eRange == RANGE_HAS_END) ||
1799 (eRange == RANGE_HAS_LEN))
1800 {
1801 WORD nEnd = 0; // unused
1802 Range_CalcEndLen( eRange, nAddress, nAddress2, nEnd, nLen );
1803 dArg = 3;
1804 }
1805
1806 if (!nLen)
1807 nLen = 1;
1808
1809 if (!_CmdBreakpointAddReg( pBP, iSrc, iCmp, nAddress, nLen, bIsTempBreakpoint ))
1810 dArgPrefix = dArg = 0; // error
1811 else
1812 g_nBreakpoints++;
1813 }
1814
1815 return dArgPrefix + dArg;
1816}
1817

Callers 4

CmdBreakpointAddRegFunction · 0.85
CmdBreakpointAddPCFunction · 0.85
CmdBreakpointAddMemFunction · 0.85
CmdBreakpointAddVideoFunction · 0.85

Calls 6

ConsoleDisplayErrorFunction · 0.85
Range_GetAllPrefixesFunction · 0.85
Range_GetFunction · 0.85
Range_CalcEndLenFunction · 0.85
_CmdBreakpointAddRegFunction · 0.85
ClearMethod · 0.45

Tested by

no test coverage detected