コード例 #1
0
 /* (non-Javadoc)
  * @see org.eclipse.wst.jsdt.debug.core.jsdi.ScriptReference#source()
  */
 public synchronized String source() {
   if (source == null) {
     CFRequestPacket request = new CFRequestPacket(Commands.SCRIPTS, context_id);
     request.setArgument(Attributes.INCLUDE_SOURCE, Boolean.TRUE);
     request.setArgument(Attributes.URLS, Arrays.asList(new String[] {url}));
     CFResponsePacket response = crossfire().sendRequest(request);
     if (response.isSuccess()) {
       List list = (List) response.getBody().get(Attributes.SCRIPTS);
       if (list != null && list.size() > 0) {
         initializeScript((Map) list.get(0));
       }
     } else if (TRACE) {
       Tracing.writeString(
           "SCRIPTREF [failed source request]: " + JSON.serialize(request)); // $NON-NLS-1$
     }
   }
   return source;
 }
コード例 #2
0
 /* (non-Javadoc)
  * @see org.eclipse.wst.jsdt.debug.core.jsdi.ThreadReference#frames()
  */
 public synchronized List frames() {
   if (frames == null) {
     CFRequestPacket request = new CFRequestPacket(Commands.BACKTRACE, id);
     request.setArgument(Attributes.FROM_FRAME, new Integer(0));
     request.setArgument(Attributes.INCLUDE_SCOPES, Boolean.TRUE);
     CFResponsePacket response = crossfire().sendRequest(request);
     if (response.isSuccess()) {
       frames = new ArrayList();
       List frms = (List) response.getBody().get(Attributes.FRAMES);
       if (frms != null) {
         Map fmap = null;
         for (int i = 0; i < frms.size(); i++) {
           fmap = (Map) frms.get(i);
           // XXX hack to prevent http://code.google.com/p/fbug/issues/detail?id=4203
           if (fmap.containsKey(Attributes.URL)) {
             frames.add(new CFStackFrame(virtualMachine(), this, fmap));
           } else if (TRACE) {
             Tracing.writeString(
                 "STACKFRAME [got bogus stackframe infos]: "
                     + fmap.values().toString()); // $NON-NLS-1$
           }
         }
       }
     } else {
       if (TRACE) {
         Tracing.writeString(
             "STACKFRAME [backtrace request failed]: " + JSON.serialize(request)); // $NON-NLS-1$
       }
       if (frames != null) {
         frames.clear();
       }
       return Collections.EMPTY_LIST;
     }
   }
   return frames;
 }