Extension Modules > COM

Debugger: Determine is a source line has executable code

(1/2) > >>

dzzie:
Hi,

I am working on the debugger GUI now. Most things are working nicely

if i set a breakpoint or Run2Line on an empty source line or variable declaration
the debugger will never stop because execution never touches this line.

I need to figure out a function such as the following:


--- Code: ---isValidExecutableLine(int lineNo)

--- End code ---

pDO->cSourceLines is just an array of all lines. I can put something together by
manually parsing the pDO->SourceLines[j].line but it wont be as robust as the syntax
parser.

Would conclusive information of this kind be available somewhere?

screenshot attached for the curious

Support:
Hi Dave,

Will you be dealing with array variables as well with the debugger? Both DBG and SDBG doesn't.  :'(

I'll ping Peter and see if he can offer some direction on your issue.

John

dzzie:
for an array, I was thinking if they double click the variable name, it could pop up a another form which lists all of its elements
I havent looked into how to walk an array yet

Support:

--- Quote ---I havent looked into how to walk an array yet
--- End quote ---

 :)

A good look at scriba is about the only example you will have. On a positive note, under the covers an indexed based array looks no different than an associative array or a combination of both.


--- Quote --- it could pop up a another form which lists all of its elements
--- End quote ---

Maybe popping a window showing the elements and their L/UBOUND ranges first then allow them to select an element's index to traverse showing the data it contains. If you get that working, I would like to chat about REF mappings.  ;)
 

dzzie:
ok got the array walking working with flat and multidimensional arrays. dumping will work to any level deep. Method I used was double click on lower variable list to look up top level array object elements by name. they are dumped to separate window. If any of those elements are arrays, then you double click on those and it will look up the array element by pointer to dump its contents.

couple useful code snips


--- Code: ---void __stdcall dbg_EnumAryVarsByPointer(pDebuggerObject pDO, VARIABLE v)
{
#pragma EXPORT
VARIABLE v2=NULL;
int low, high, i;
unsigned long sz;
    char cBuffer[2050];
    char buf[1025];

if(v==NULL) return;
if(TYPE(v) != VTYPE_ARRAY) return;

low = ARRAYLOW(v);
high = ARRAYHIGH(v);

for(i = low; i <= high; i++){
v2 = v->Value.aValue[i-low]; //even if lbound(v) = 3 first element is at .aValue[0]
if(v2 != NULL){
sz = 1024;
SPrintVariable(pDO, v2, buf, &sz);
sprintf(cBuffer,"Array-Variable:%d:%d:%s", i, TYPE(v2), buf);
vbStdOut(cb_debugger, cBuffer, strlen(cBuffer));
}
}
}


void __stdcall dbg_EnumCallStack(pDebuggerObject pDO)
{
#pragma EXPORT

  pDebugCallStack_t p;
  pDebugCallStack_t np;
  pUserFunction_t   uf;
  char buf[1024];
  long i;

  if( pDO == NULL )return;

  sprintf(buf, "Call-Stack:%d:%s", LineNumberForNode(pDO,pDO->lPC), "CurrentLine");
  vbStdOut(cb_debugger,buf,strlen(buf));

  if( pDO->StackListPointer == NULL )return;
 
  p = pDO->StackListPointer;
  if(p->pUF && p->pUF->pszFunctionName ){
  sprintf(buf, "Call-Stack:%d:%s", LineNumberForNode(pDO,p->Node), p->pUF->pszFunctionName);
  }else{
  sprintf(buf, "Call-Stack:%d:Unknown", LineNumberForNode(pDO,p->Node) );
  }
  vbStdOut(cb_debugger,buf,strlen(buf));
 
  for(i=0; i < pDO->CallStackDepth; i++){
    if(p->up == NULL) return;
p = p->up;
if(p->pUF && p->pUF->pszFunctionName ){
  sprintf(buf, "Call-Stack:%d:%s", LineNumberForNode(pDO,p->Node) , p->pUF->pszFunctionName);
}else{
sprintf(buf, "Call-Stack:%d:Unknown", LineNumberForNode(pDO,p->Node));
}
vbStdOut(cb_debugger,buf,strlen(buf));
  }


  return;
}


--- End code ---

Navigation

[0] Message Index

[#] Next page

Go to full version