예제 #1
0
// Generate an estimated breakpoint from mapping positions of discordant reads.  New breakpoint is
// added to MEI_bps.  This function assumes that objects in cluster are already ordered by position.
// Another assumption is that there are at least 2 reads in the cluster (i.e. 
// user setting MIN_DD_CLUSTER_SIZE > 1).
void get_breakpoint_estimation(std::vector<simple_read*>& cluster, int insert_size, int cluster_tid, 
                               char cluster_strand, std::vector<MEI_breakpoint>& MEI_bps) {
    // Compute average distance between read mapping positions.
    float dist_mean = 0;
    for (unsigned int i = 0; i < (cluster.size() - 1); i++) {
        dist_mean += (1.0 / (i+1)) * ((cluster.at(i+1)->pos - cluster.at(i)->pos) - dist_mean);
    }

    // Compute mean read lenght in cluster.
    float read_len_mean = 0;
    for (unsigned int i = 0; i < cluster.size(); i++) {
        read_len_mean += (1.0 / (i+1)) * (cluster.at(i)->sequence.length() - read_len_mean);
    }
    
    int outer_pos_high = cluster.at(cluster.size()-1)->pos + cluster.at(cluster.size()-1)->sequence.length();
    int outer_pos_low = cluster.at(0)->pos;
    
    int estimation = (cluster_strand == Plus)? outer_pos_high + dist_mean : outer_pos_low - dist_mean;

    MEI_breakpoint new_bp(cluster_tid, estimation, cluster_strand);
    // Link associated discordant reads (all reads from cluster) and split reads.
    std::vector<simple_read*>::iterator read_iter;
    for (read_iter = cluster.begin(); read_iter != cluster.end(); ++read_iter) {
        new_bp.associated_reads.push_back(*(*read_iter));
    }
    MEI_bps.push_back(new_bp);
}
예제 #2
0
파일: breakpoint.c 프로젝트: zfjsail/nemu
/*设置断点*/
void set_b(unsigned x)
{
	BP* newb = new_bp();//从free中找到一个新的可使用的断点
	if(newb == NULL) { assert(0);}//free为空
	newb -> b_or_w = true;
	newb -> addr = x;//储存内存地址
	newb -> sav_istr = swaddr_read(x,1);//储存原指令
	swaddr_write(x,1,INT3_CODE);
	newb -> enb = true;//enable
	newb -> isUsed = true;
	printf("Breakpoint %d at 0x%x\n",(newb -> NO)+1,x);
}
예제 #3
0
void CodeLiteLLDBApp::NotifyBreakpointsUpdated()
{
    LLDBBreakpoint::Vec_t breakpoints;
    int num = m_target.GetNumBreakpoints();
    wxPrintf("codelite-lldb: Calling NotifyBreakpointsUpdated(). Got %d breakpoints\n", num);
    for(int i=0; i<num; ++i) {
        lldb::SBBreakpoint bp = m_target.GetBreakpointAtIndex(i);
        if ( bp.IsValid() && bp.GetNumResolvedLocations() ) {
            
            // Add the parent breakpoint
            LLDBBreakpoint::Ptr_t mainBreakpoint( new LLDBBreakpoint() );
            mainBreakpoint->SetId( bp.GetID() );
            if ( bp.GetNumLocations() >  1 ) {

                // add all the children locations to the main breakpoint
                for(size_t i=0; i<bp.GetNumLocations(); ++i) {
                    lldb::SBBreakpointLocation loc = bp.GetLocationAtIndex(i);
                    
                    lldb::SBFileSpec fileLoc = loc.GetAddress().GetLineEntry().GetFileSpec();
                    wxFileName bpFile( fileLoc.GetDirectory(), fileLoc.GetFilename() );

                    // Create a breakpoint for this location
                    LLDBBreakpoint::Ptr_t new_bp(new LLDBBreakpoint());
                    new_bp->SetType( LLDBBreakpoint::kLocation );
                    new_bp->SetFilename( bpFile.GetFullPath() );
                    new_bp->SetLineNumber( loc.GetAddress().GetLineEntry().GetLine() );
                    new_bp->SetName( loc.GetAddress().GetFunction().GetName() );
                    mainBreakpoint->GetChildren().push_back( new_bp );
            }

            } else {
                lldb::SBBreakpointLocation loc = bp.GetLocationAtIndex(0);
                lldb::SBFileSpec fileLoc = loc.GetAddress().GetLineEntry().GetFileSpec();
                wxFileName bpFile( fileLoc.GetDirectory(), fileLoc.GetFilename() );
                
                mainBreakpoint->SetType( LLDBBreakpoint::kFileLine );
                mainBreakpoint->SetName( loc.GetAddress().GetFunction().GetName() );
                mainBreakpoint->SetFilename( bpFile.GetFullPath() );
                mainBreakpoint->SetLineNumber( loc.GetAddress().GetLineEntry().GetLine() );
                
            }
            breakpoints.push_back( mainBreakpoint );
        }
    }
    
    LLDBReply reply;
    reply.SetReplyType( kReplyTypeBreakpointsUpdated );
    reply.SetBreakpoints( breakpoints );
    SendReply( reply );
}
예제 #4
0
파일: breakpoint.c 프로젝트: zfjsail/nemu
void set_w(char *e)
{
	   BP* neww = new_bp();
	   if(neww == NULL) {assert(0);}
	   neww -> b_or_w = false;
	   strcpy(neww -> e,e);
	   bool success = true;
	   neww -> last_value = expr(e,&success);
	   if(success)
	   {
			neww -> enb = true;
			neww -> isUsed = true;
			printf("Hardware watchpoint %d:%s\n",(neww->NO)+1,e);
	   }
	   else
			printf("Invalid expression!\n");
}
예제 #5
0
void watchpoint_start(swaddr_t n){
	int m;
	BP* temp;
	BP* p;
	m=swaddr_read(n,1);
	new_bp();
	temp=head;
	p=head;
	assert(head!=NULL);
	while(temp->next!=NULL)
		temp=temp->next;
	temp->instr=m;
	temp->address=n;
	temp->type=false;
	head=p;
	watchpoint_continue(n);
}
예제 #6
0
파일: breakpoint.c 프로젝트: XuanBQ/NEMU
/* add new breakpoint in the rear position */
void add_bp(swaddr_t addr) {
    BP* temp = new_bp();

    /* add to the rear */
    if (head == NULL) {
        head = temp;
    } else {
        /* travel to the rear */
        BP* rear = head;
        while (rear->next != NULL)
            rear = rear->next;
        rear->next = temp;
    }
    
    /* init */
    temp->next = NULL;
    temp->addr = addr;
    temp->value = swaddr_read(addr, 1);
    swaddr_write(addr, 1, INT3_CODE);
    assert(temp->expr[0] == '\0');
}
예제 #7
0
파일: breakpoint.c 프로젝트: XuanBQ/NEMU
/* add new watchpoint in the rear position */
void add_watchpoint(char* expr) {
    BP* new_wp = new_bp();

    /* add to the rear */
    if (head == NULL) {
        head = new_wp;
    } else {
        /* travel to rear */
        BP* rear = head;
        while (rear->next != NULL) {
            rear = rear->next;
        }
        rear->next = new_wp;
    }

    /* init */
    new_wp->next = NULL;
    new_wp->value = calculate(expr);
    strncpy(new_wp->expr, expr, 32);
    assert(new_wp->addr == 0);
}
예제 #8
0
// Update breakpoint information
bool BreakPoint::update(string& info_output,
			std::ostream& undo_commands,
			bool& need_total_undo)
{
    string file = file_name();
    BreakPoint new_bp(info_output, arg(), number(), file);

    bool changed       = false;
    myenabled_changed  = false;
    myposition_changed = false;
    myfile_changed     = false;
    myaddress_changed  = false;
    need_total_undo    = false;

    const string num = "@" + itostring(number()) + "@";

    if (new_bp.number() != number())
    {
	mynumber = new_bp.number();
	need_total_undo = changed = true;
    }

    if (new_bp.type() != type())
    {
	mytype = new_bp.type();
	need_total_undo = changed = myenabled_changed = true;
    }

    if (new_bp.dispo() != dispo())
    {
	need_total_undo = changed = myenabled_changed = true;
	mydispo = new_bp.dispo();
    }

    if (new_bp.watch_mode() != watch_mode())
    {
	need_total_undo = changed = myenabled_changed = true;
	mywatch_mode = new_bp.watch_mode();
    }

    if (new_bp.myenabled != myenabled)
    {
	changed = myenabled_changed = true;
	myenabled = new_bp.myenabled;

	if (myenabled)
	{
	    if (gdb->has_disable_command())
		undo_commands << gdb->disable_command(num) << "\n";
	    else
		need_total_undo = true;
	}
	else
	{
	    if (gdb->has_enable_command())
		undo_commands << gdb->enable_command(num) << "\n";
	    else
		need_total_undo = true;
	}
    }

    if (type() == BREAKPOINT)
    {
	if (new_bp.address() != address())
	{
	    changed = myaddress_changed = true;
	    myaddress = new_bp.address();
	}

	if (new_bp.func() != func())
	{
	    changed = myposition_changed = true;
	    myfunc = new_bp.func();
	}

	if (new_bp.file_name() != file_name())
	{
	    changed = myposition_changed = myfile_changed = true;
	    myfile_name = new_bp.file_name();
	}

	if (new_bp.line_nr() != line_nr())
	{
	    changed = myposition_changed = true;
	    myline_nr = new_bp.line_nr();
	}
    }
    else if (type() == WATCHPOINT)
    {
	if (new_bp.expr() != expr())
	{
	    changed = true;
	    myexpr = new_bp.expr();
	}
    }

    if (new_bp.infos() != infos())
    {
	changed = true;
	myinfos = new_bp.infos();
    }

    if (new_bp.ignore_count() != ignore_count())
    {
	if (gdb->has_ignore_command())
	    undo_commands << gdb->ignore_command(num, myignore_count) << "\n";
	else
	    need_total_undo = true;

	changed = myenabled_changed = true;
	myignore_count = new_bp.ignore_count();
    }

    if (new_bp.mycondition != mycondition)
    {
	if (gdb->has_condition_command())
	    undo_commands << gdb->condition_command(num, condition()) << "\n";
	else
	    need_total_undo = true;

	changed = myenabled_changed = true;
	mycondition = new_bp.mycondition;
    }

    if (!equal(new_bp.commands(), commands()))
    {
        if (gdb->type() == GDB || gdb->type() == PYDB || gdb->type() == BASH)
	{
	    undo_commands << "commands " << num << '\n';
	    for (int i = 0; i < commands().size(); i++)
		undo_commands << commands()[i] << '\n';
	    undo_commands << "end\n";
	}

	changed = myenabled_changed = true;
	mycommands = new_bp.commands();
    }

    return changed;
}