static bool is_last_aligned_frame(struct unwind_state *state)
{
	unsigned long *last_bp = last_frame(state);
	unsigned long *aligned_bp = last_aligned_frame(state);

	/*
	 * GCC can occasionally decide to realign the stack pointer and change
	 * the offset of the stack frame in the prologue of a function called
	 * by head/entry code.  Examples:
	 *
	 * <start_secondary>:
	 *      push   %edi
	 *      lea    0x8(%esp),%edi
	 *      and    $0xfffffff8,%esp
	 *      pushl  -0x4(%edi)
	 *      push   %ebp
	 *      mov    %esp,%ebp
	 *
	 * <x86_64_start_kernel>:
	 *      lea    0x8(%rsp),%r10
	 *      and    $0xfffffffffffffff0,%rsp
	 *      pushq  -0x8(%r10)
	 *      push   %rbp
	 *      mov    %rsp,%rbp
	 *
	 * After aligning the stack, it pushes a duplicate copy of the return
	 * address before pushing the frame pointer.
	 */
	return (state->bp == aligned_bp && *(aligned_bp + 1) == *(last_bp + 1));
}
void Libdc1394SequenceGrabber::idle()
{
	dc1394error_t err;
	dc1394video_frame_t *last_frame(NULL), *frame(NULL);
	if (!_camera) {
		fakeTracking();
		return;
	}
    do{     
        err = dc1394_capture_dequeue(_camera, DC1394_CAPTURE_POLICY_POLL, &frame);
        if (frame) { 
            if (last_frame)
                err=dc1394_capture_enqueue(_camera, last_frame);
            last_frame = frame; 
        }
    } while (frame);
    
	checkSuccess(err, "dc1394_capture_dequeue failed");
	
    if (_firstFrame) {
		setupBayer();
		_firstFrame = false;
	}
	
	if (last_frame) {
		processCameraImageData( last_frame->image );
		newFrameAvailable();
		
		err=dc1394_capture_enqueue(_camera, last_frame);
        checkSuccess(err, "dc1394_capture_enqueue failed");
	}
}
Exemple #3
0
deltaVFrame* DeltaProcess::last_delta_vframe() {
  // If no stack is present return NULL
  if (!has_stack()) return NULL;

  frame f = last_frame();
  for (vframe* vf = vframe::new_vframe(&f); vf; vf = vf->sender() ) {
    if (vf->is_delta_frame()) return (deltaVFrame*) vf;
  }
  return NULL;
}
Exemple #4
0
void DeltaProcess::deoptimized_wrt_marked_nmethods() {
  // chop the stack into stretches of frames in need for deoptimization
  if (!has_stack()) return;

  frame v = last_frame();
  do {
    if (v.should_be_deoptimized())
      deoptimize_stretch(&v, &v);
    v = v.sender();
  } while (!v.is_first_frame());
}
Exemple #5
0
void DeltaProcess::follow_roots() {
  MarkSweep::follow_root((oop*) &_receiver);
  MarkSweep::follow_root((oop*) &_selector);
  MarkSweep::follow_root((oop*) &_processObj);

  if (has_stack()) {
    frame v = last_frame();
    do {
      v.follow_roots();
      v = v.sender();
    } while (!v.is_first_frame());
  }
}
Exemple #6
0
void DeltaProcess::frame_iterate(FrameClosure* blk) {
  blk->begin_process(this);
  
  if (has_stack()) {
    frame v = last_frame();
    do {
      blk->do_frame(&v);
      v = v.sender();
    } while (!v.is_first_frame());
  }

  blk->end_process(this);
}
Exemple #7
0
void DeltaProcess::trace_stack_for_deoptimization(frame* f) {
  if (has_stack()) {
    int  vframe_no   = 1;
    frame v = f ? *f : last_frame();
    do {
      v.print_for_deoptimization(std);
      v = v.sender();
      if (vframe_no == StackPrintLimit) {
        std->print_cr("...<more frames>...");
        return;
      }
      vframe_no++;
    } while (!v.is_first_frame());
  }
}
Exemple #8
0
void DeltaProcess::oop_iterate(OopClosure* blk) {
  blk->do_oop((oop*) &_receiver);
  blk->do_oop((oop*) &_selector);
  blk->do_oop((oop*) &_processObj);

  for (unwindInfo* p = _unwind_head; p; p = p->next())
    blk->do_oop((oop*) &p->_nlr_result);

  if (has_stack()) {
    frame v = last_frame();
    do {
      v.oop_iterate(blk);
      v = v.sender();
    } while (!v.is_first_frame());
  }
}
static bool is_last_ftrace_frame(struct unwind_state *state)
{
	unsigned long *last_bp = last_frame(state);
	unsigned long *last_ftrace_bp = last_bp - 3;

	/*
	 * When unwinding from an ftrace handler of a function called by entry
	 * code, the stack layout of the last frame is:
	 *
	 *   bp
	 *   parent ret addr
	 *   bp
	 *   function ret addr
	 *   parent ret addr
	 *   pt_regs
	 *   -----------------
	 */
	return (state->bp == last_ftrace_bp &&
		*state->bp == *(state->bp + 2) &&
		*(state->bp + 1) == *(state->bp + 4));
}
 static int       bci(JavaThread *thread)           { return last_frame(thread).interpreter_frame_bci(); }
 static address   bcp(JavaThread *thread)           { return last_frame(thread).interpreter_frame_bcp(); }
 static methodOop method(JavaThread *thread)        { return last_frame(thread).interpreter_frame_method(); }
Exemple #13
0
static inline unsigned long *last_aligned_frame(struct unwind_state *state)
{
	return last_frame(state) - GCC_REALIGN_WORDS;
}
Exemple #14
0
int DeltaProcess::depth() {
  int d = 0;
  for(frame v = last_frame(); v.link(); v = v.sender()) d++;
  return d;
}
Exemple #15
0
static bool is_last_frame(struct unwind_state *state)
{
	return state->bp == last_frame(state);
}
bool Packet::addFrame(RoutedFrame f)
{
    /* Description:
     * Add the frame to the frame list of the packet, if the frame belongs to
     * the packet.
     * This method is needed to build up the packet on the receiver side.
     * The method also checks, if frames are received in the right order.
     *
     *
     * Returns:
     * 		(true) if packet is complete and ready to publish
     *
     * 		(false) in every other case
     */

    this->ts_ = getMillisecondsTime();

    if (this->size_ == this->frames_l_.size())
        return true;

    if (this->highest_seq < f.header_.packet_sequence_num)
        this->highest_seq = f.header_.packet_sequence_num;

    if (this->isMcFrame() && this->frameAlreadyExsits(f) == true)
    {
        this->refreshLists();
        return false;
    }

    if (frames_l_.size() == 0 && f.header_.packet_sequence_num != 0)
    {
        for (uint32_t mis_seq = 0; mis_seq < f.header_.packet_sequence_num;
             mis_seq++)
            missed_sequences_l_.push_back(mis_seq);
    }

    if (f.header_.packet_id != this->id_)
    {
        ROS_ERROR("packet error");
        exit(22);
    }

    if ((unsigned)frames_l_.size() < size_)
    {
        bool missed_sequence_frame = false;

        /* check if frame is on with a missed sequence*/
        for (std::list<uint32_t>::iterator it = missed_sequences_l_.begin();
             it != missed_sequences_l_.end(); ++it)
        {
            if (f.header_.packet_sequence_num == *it)
            {
                // ROS_ERROR("Frame was in missed squ
                // %u",f.header_.packet_sequence_num);
                missed_sequence_frame = true;
                missed_sequences_l_.erase(it); // todo try remove
                break;
            }
        }

        if (!missed_sequence_frame)
        {
            // std::list<RoutedFrame>::reverse_iterator iter =
            // frames_l_.rbegin(); //points to the last instered frame

            RoutedFrame &last_frame(*frames_l_.rbegin());

            /*Check if the new frame has the expected sequence*/
            if (last_frame.header_.packet_sequence_num ==
                    f.header_.packet_sequence_num - 1 ||
                frames_l_.size() == 0)
            {
                frames_l_.push_back(f);
            }
            else if (last_frame.header_.packet_sequence_num <
                     f.header_.packet_sequence_num)
            {

                /*Insert all sequence numbers between the current incoming frame
                 * and the last inserted one*/
                for (uint32_t i = 1;
                     i < f.header_.packet_sequence_num -
                             last_frame.header_.packet_sequence_num;
                     i++)
                {
                    missed_sequences_l_.push_front(
                        last_frame.header_.packet_sequence_num + i);
                }

                frames_l_.push_back(f);
            }
            else
            {

                //	this->refreshLists();
                // return this->addFrame(f);
            }
        }
        /*Missed sequence frame*/
        else
        {
            frames_l_.push_front(f);
        }

        if (frames_l_.size() == size_)
        {
            this->wrong_sequence_ = true;
            sortFrameList();

            return frames_l_.size() == size_;
        }
        else
            return false;
    }

    return false;
}
 static Method* method(JavaThread *thread) {
   return last_frame(thread)->method();
 }