Package flash.tools.debugger

Examples of flash.tools.debugger.SourceFile


       {
         cli.err(getLocalizationManager().getLocalizedTextString("key28")); //$NON-NLS-1$
       }
       else
       {
         SourceFile file = fileInfo.getFile(module1);
         numLines = file.getLineCount();
         // pressing return is ok, otherwise throw the exception
         if (line1 > numLines && arg1 != null)
           throw new IndexOutOfBoundsException();
         /* if no arg2 then user list a single line */
         if (arg2 == null)
           line2 = line1;
         /* adjust our range of lines to ensure we conform */
         if (line1 < 1)
         {
           /* shrink line 1, grow line2 */
           line2 += -(line1 - 1);
           line1 = 1;
         }
         if (line2 > numLines)
           line2 = numLines;
        //          System.out.println("1="+module1+":"+line1+",2="+module2+":"+line2+",num="+numLines+",half="+half);
         /* nothing to display */
         if (line1 > line2)
           throw new IndexOutOfBoundsException();
         /* now dump the mixed source / assembly */
         // now lets find which swf this in
         DSwfInfo swf = (DSwfInfo)fileInfo.swfForFile(file);
         ActionLocation lStart = null;
         ActionLocation lEnd = null;
         if (swf == null)
        {
          Map<String, String> args = new HashMap<String, String>();
          args.put("arg3", file.getName()); //$NON-NLS-1$
           cli.err(getLocalizationManager().getLocalizedTextString("key29", args)); //$NON-NLS-1$
        }
         else if (functionNamed)
         {
           // if we name a function just dump the whole thing without source.
           int offset = file.getOffsetForLine(line1);
           lStart = swf.locate(offset);
           if (lStart.function == null)
             cli.err(getLocalizationManager().getLocalizedTextString("key30")); //$NON-NLS-1$
           else
           {
             // create a psudeo action list from which to disasemble the function
             ActionList al = new ActionList(true);
             al.setActionOffset(0, lStart.function);
             lStart.actions = al;
             lStart.at = 0;
             lEnd = new ActionLocation();
             lEnd.actions = al;
             lEnd.at = 0;
             outputAssembly(cli, swf, lStart, lEnd);
           }
         }
         else
         {
           ActionLocation lastEnd = null;
           for(int i=line1; i<=line2; i++)
           {
             int offset = file.getOffsetForLine(i);
             // locate the action list associated with this of the swf
             if (offset != 0)
             {
               // get the starting point and try to locate a nice ending
               lStart = swf.locate(offset);
               lEnd = swf.locateSourceLineEnd(lStart);
               // now see if we skipped some assembly between source lines
               if (lastEnd != null)
               {
                 lastEnd.at++;  // point our pseudo start to the next action
                 // new actions list so attempt to find the end of source in the old actions list
                 if (lastEnd.actions != lStart.actions && lastEnd.actions.size() != lastEnd.at)
                 {
                   String atString = Integer.toHexString(lastEnd.actions.getOffset(lastEnd.at));
                  Map<String, String> args = new HashMap<String, String>();
                  args.put("arg4", atString); //$NON-NLS-1$
                   cli.out(getLocalizationManager().getLocalizedTextString("key31", args)); //$NON-NLS-1$
                    // we are missing some of the dissassembly, so back up a bit and dump it out
                   ActionLocation gapEnd = swf.locateSourceLineEnd(lastEnd);
                   outputAssembly(cli, swf, lastEnd, gapEnd);
                 }
                 else if (lastEnd.at < lStart.at)
                 {
                   // same action list but we skipped some instructions
                   ActionLocation gapEnd = new ActionLocation(lStart);
                   gapEnd.at--;
                   outputAssembly(cli, swf, lastEnd, gapEnd);
                 }
               }
               lastEnd = lEnd;
             }
             // dump source
             cli.outputSource(module1, i, file.getLine(i));
            
             // obtain the offset, locate it in the swf
             if (offset != 0)
               outputAssembly(cli, swf, lStart, lEnd);
           }
View Full Code Here


   * @param module the FIRST module to search; but we also search all the others if 'onlyThisModule' is false
   * @return two ints: first is the module, and second is the line
   */
    private int[] parseFunctionName(int module, String partialFunctionName, boolean onlyThisModule) throws NoMatchException, AmbiguousException
    {
        SourceFile m = m_fileInfo.getFile(module);
    ArrayList<ModuleFunctionPair> functionNames = new ArrayList<ModuleFunctionPair>(); // each member is a ModuleFunctionPair

        appendFunctionNamesMatching(functionNames, m, partialFunctionName);

        if (functionNames.size() == 0)
        {
      if (!onlyThisModule)
      {
        // not found in the specified module; search all the other modules
        Iterator fileIter = m_fileInfo.getAllFiles();
        while (fileIter.hasNext())
        {
          SourceFile nextFile = (SourceFile) ((Map.Entry)fileIter.next()).getValue();
          if (nextFile != m) // skip the one file we searched at the beginning
          {
            appendFunctionNamesMatching(functionNames, nextFile, partialFunctionName);
          }
        }
View Full Code Here

        err(getLocalizationManager().getLocalizedTextString("lineJunk")); //$NON-NLS-1$
      }
      else
      {
        int half = listsize/2;
        SourceFile file = m_fileInfo.getFile(module1);
        numLines = file.getLineCount();

        int newLine;
        if (numLines == 1 && file.getLine(1).equals("")) //$NON-NLS-1$
        {
          // there's no source in the file at all!
          // this presumably means that the source file isn't in the current directory
          err(getLocalizationManager().getLocalizedTextString("sourceFileNotFound")); //$NON-NLS-1$
          newLine = currentLine;
        }
        else
        {
          // pressing return is ok, otherwise throw the exception
          if (line1 > numLines && arg1 != null)
            throw new IndexOutOfBoundsException();
 
          /* if no arg2 then user requested the next N lines around something */
          if (arg2 == null)
          {
            line2 = line1 + (half) - 1;
            line1 = line1 - (listsize-half);
          }

          /* adjust our range of lines to ensure we conform */
          if (line1 < 1)
          {
            /* shrink line 1, grow line2 */
            line2 += -(line1 - 1);
            line1 = 1;
          }
 
          if (line2 > numLines)
            line2 = numLines;
 
//            System.out.println("1="+module1+":"+line1+",2="+module2+":"+line2+",num="+numLines+",half="+half);
 
          /* nothing to display */
          if (line1 > line2)
            throw new IndexOutOfBoundsException();
 
          /* now do it! */
          SourceFile source = m_fileInfo.getFile(module1);
          for(int i=line1; i<=line2; i++)
            outputSource(module1, i, source.getLine(i));
         
          newLine = line2 + half + (((listsize % 2) == 0) ? 1 : 2)// add one if even, 2 for odd;
        }
       
        /* save away valid context */
 
View Full Code Here

  {
    int largestAuthoredId = -1;
    SourceFile[] files = m_fileInfo.getFileList();
    for (int i=0; i<files.length; ++i)
    {
      SourceFile sf = files[i];
      if (sf.getId() > largestAuthoredId && getFileType(sf) == AUTHORED_FILE)
        largestAuthoredId = sf.getId();
    }
    if (largestAuthoredId != -1)
      setListingPosition(largestAuthoredId, 1);
  }
View Full Code Here

                module = parseFileArg(module, arg);
        currentLine = 1;
                setListingPosition(module, currentLine);
             }

            SourceFile sourceFile = m_fileInfo.getFile(module);
      StringBuilder sb = new StringBuilder();
      sb.append(sourceFile.getName());
      sb.append('#');
      sb.append(sourceFile.getId());
      sb.append(':');
      sb.append(currentLine);
      out( sb.toString() );
        }
    catch(NullPointerException npe)
View Full Code Here

  public String module2ClassName(int moduleId)
  {
    String pkg = null;
    try
    {
      SourceFile file = m_fileInfo.getFile(moduleId);
      pkg = file.getPackageName();
    }
    catch(Exception npe)
    {
      // didn't work ignore it.
    }
View Full Code Here

      StringBuilder sb = new StringBuilder();
      Iterator itr = m_fileInfo.getAllFiles();

      while(itr.hasNext())
      {
        SourceFile m = (SourceFile) ((Map.Entry)itr.next()).getValue();

        String name = m.getName();
        int id = m.getId();
        String path = m.getFullPath();

        sb.append(id);
        sb.append(' ');
        sb.append(path);
        sb.append(", "); //$NON-NLS-1$
View Full Code Here

      Iterator<Location> itr = b.getLocations().iterator();
      while(itr.hasNext())
      {
        Location l = itr.next();
        SourceFile file = l.getFile();
        String funcName = (file == null)
          ? getLocalizationManager().getLocalizedTextString("unknownBreakpointLocation") //$NON-NLS-1$
          : file.getFunctionNameForLine(m_session, l.getLine()) ;
        int offset = adjustOffsetForUnitTests((file == null) ? 0 : file.getOffsetForLine(l.getLine()));

        sb.append("0x"); //$NON-NLS-1$
        FieldFormat.formatLongToHex(sb, offset, 8);
        sb.append(' ');

        if (funcName != null)
        {
          Map<String, Object> funcArgs = new HashMap<String, Object>();
          funcArgs.put("functionName", funcName); //$NON-NLS-1$
          sb.append(getLocalizationManager().getLocalizedTextString("inFunctionAt", funcArgs)); //$NON-NLS-1$
        }

        sb.append(file.getName());
        if (file != null)
        {
          sb.append("#"); //$NON-NLS-1$
          sb.append(file.getId());
        }
        sb.append(':');
        sb.append(l.getLine());

        try
View Full Code Here

    // some formatting properties
    int i = frameNumber;

    Location loc = ctx.getLocation();
    SourceFile file = loc.getFile();
    int line = loc.getLine();
    String name = (file == null) ? "<null>" : file.getName(); //$NON-NLS-1$
    String sig = ctx.getCallSignature();
    String func = extractFunctionName(sig);

    // file == null or line < 0 appears to be a terminator for stack info
    if (file == null && line < 0)
        {
            validFrame = false;
        }
        else
    {
      Variable[] var = ctx.getArguments(m_session);
      Variable dis = ctx.getThis(m_session);
      boolean displayArgs = (func != null) || (var != null);

      sb.append('#');
      FieldFormat.formatLong(sb, i, 3);
      sb.append(' ');

      if (showThis && dis != null)
      {
                m_exprCache.appendVariable(sb, dis);
        sb.append("."); //$NON-NLS-1$
      }

      if (func != null)
        sb.append(func);

      if (displayArgs)
      {
        sb.append('(');
        for (int j=0; j<var.length; j++)
        {
          Variable v = var[j];
          sb.append(v.getName());
          sb.append('=');
                    m_exprCache.appendVariableValue(sb, v.getValue());
          if ((j+1)<var.length)
            sb.append(", "); //$NON-NLS-1$
        }
        sb.append(")"); //$NON-NLS-1$
        sb.append(getLocalizationManager().getLocalizedTextString("atFilename")); //$NON-NLS-1$
      }

      sb.append(name);

      // if this file is currently being filtered put the source file id after it
      if (file != null && (showFileId || !m_fileInfo.inFileList(file)))
      {
        sb.append('#');
        sb.append( file.getId() );

      }
      sb.append(':');
      sb.append(line);
    }
View Full Code Here

          SourceFile[] files = e.getSourceList(m_session);
          int max = Integer.MIN_VALUE;
          int min = Integer.MAX_VALUE;
          for(int j=0; j<files.length; j++)
          {
            SourceFile f = files[j];
            int id = f.getId();
            max = (id > max) ? id : max;
            min = (id < min) ? id : min;
          }

          args.put("scriptCount", Integer.toString(e.getSourceCount(m_session))); //$NON-NLS-1$
View Full Code Here

TOP

Related Classes of flash.tools.debugger.SourceFile

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.