Exemple #1
0
// Add a breakpoint using the 'Properties' dialog
void BreakptMgr::AddBreakpoint()
{
    BreakptPropertiesDlg dlg(NULL);
    dlg.SetTitle(_("Create a breakpoint or watchpoint"));

    LEditor* const editor = clMainFrame::Get()->GetMainBook()->GetActiveEditor();
    BreakpointInfo bp;
    bp.Create(editor ? editor->GetFileName().GetFullPath() : wxString(), editor ? editor->GetCurrentLine() : -1, GetNextID());
    dlg.EnterBPData(bp);

    if (dlg.ShowModal() != wxID_OK) {
        return;
    }

    if (AddBreakpoint(dlg.b)) {
        IDebugger *dbgr = DebuggerMgr::Get().GetActiveDebugger();
        if ((!dlg.b.is_enabled) && dbgr && dbgr->IsRunning()) {
            SetBPEnabledState(dlg.b.debugger_id, dlg.b.is_enabled);
        }
        wxString msg;
        if (dlg.b.bp_type == BP_type_watchpt) {
            msg = _("Watchpoint successfully added");
        } else {
            msg = _("Breakpoint successfully added");
        }
        clMainFrame::Get()->SetStatusMessage(msg, 0);
    }
}
Exemple #2
0
// ------------------------------------------------------------------
// ciMethod::load_code
//
// Load the bytecodes and exception handler table for this method.
void ciMethod::load_code() {
  VM_ENTRY_MARK;
  assert(is_loaded(), "only loaded methods have code");

  methodOop me = get_methodOop();
  Arena* arena = CURRENT_THREAD_ENV->arena();

  // Load the bytecodes.
  _code = (address)arena->Amalloc(code_size());
  memcpy(_code, me->code_base(), code_size());

  // Revert any breakpoint bytecodes in ci's copy
  if (me->number_of_breakpoints() > 0) {
    BreakpointInfo* bp = instanceKlass::cast(me->method_holder())->breakpoints();
    for (; bp != NULL; bp = bp->next()) {
      if (bp->match(me)) {
        code_at_put(bp->bci(), bp->orig_bytecode());
      }
    }
  }

  // And load the exception table.
  typeArrayOop exc_table = me->exception_table();

  // Allocate one extra spot in our list of exceptions.  This
  // last entry will be used to represent the possibility that
  // an exception escapes the method.  See ciExceptionHandlerStream
  // for details.
  _exception_handlers =
    (ciExceptionHandler**)arena->Amalloc(sizeof(ciExceptionHandler*)
                                         * (_handler_count + 1));
  if (_handler_count > 0) {
    for (int i=0; i<_handler_count; i++) {
      int base = i*4;
      _exception_handlers[i] = new (arena) ciExceptionHandler(
                                holder(),
            /* start    */      exc_table->int_at(base),
            /* limit    */      exc_table->int_at(base+1),
            /* goto pc  */      exc_table->int_at(base+2),
            /* cp index */      exc_table->int_at(base+3));
    }
  }

  // Put an entry at the end of our list to represent the possibility
  // of exceptional exit.
  _exception_handlers[_handler_count] =
    new (arena) ciExceptionHandler(holder(), 0, code_size(), -1, 0);

  if (CIPrintMethodCodes) {
    print_codes();
  }
}
Exemple #3
0
bool BreakptMgr::AddBreakpointByLineno(const wxString& file, const int lineno, const wxString& conditions/*=wxT("")*/, const bool is_temp, bool is_disabled)
{
    BreakpointInfo bp;
    bp.Create(file, lineno, GetNextID());
    bp.origin = BO_Editor;
    if (is_temp) {
        bp.bp_type = BP_type_tempbreak;
        bp.is_temp = true;
        
    } 
    bp.is_enabled = !is_disabled;
    bp.conditions = conditions;
    return AddBreakpoint(bp);
}
Exemple #4
0
BreakpointInfo::Vec_t LLDBBreakpoint::ToBreakpointInfoVector(const LLDBBreakpoint::Vec_t& breakpoints)
{
    BreakpointInfo::Vec_t bps;
    for(size_t i=0; i<breakpoints.size(); ++i) {

        LLDBBreakpoint::Ptr_t bp = breakpoints.at(i);
        BreakpointInfo gdbBp;
        gdbBp.Create(bp->GetFilename(), bp->GetLineNumber(), ++ s_internalGdbBpId);
        gdbBp.bp_type = BP_type_break;

        // dont add breakpoints to a non existent location
        bps.push_back( gdbBp );
    }
    return bps;
}
Exemple #5
0
void BreakptMgr::SetBestBPType(BreakpointInfo& bp)
{
    if (bp.bp_type == BP_type_watchpt) {
        return;
    }

    if (bp.ignore_number > 0) {
        bp.bp_type = BP_type_ignoredbreak;
        return;
    }

    if (bp.IsConditional()) {
        bp.bp_type = BP_type_condbreak;
        return;
    }

    if (!bp.commandlist.IsEmpty()) {
        bp.bp_type = BP_type_cmdlistbreak;
        return;
    }

    if (bp.is_temp) {
        bp.bp_type = BP_type_tempbreak;
        return;
    }

    bp.bp_type = BP_type_break; // Default option
}
Exemple #6
0
void BreakptMgr::DropBreakpoint(const BreakpointInfo& bp, int newline)
{
    if ( DelBreakpoint(bp.GetId()) ) {
        BreakpointInfo new_bp = bp;
        new_bp.lineno = newline;
        AddBreakpoint( new_bp );
    }
}
Exemple #7
0
bool DbgGdb::Jump(wxString filename, int line)
{
    BreakpointInfo bp;
    bp.Create(filename, line, -1);
    bp.bp_type = BP_type_tempbreak;
    Break(bp);

    // by default, use full paths for the file name
    wxFileName fn( filename );
    wxString tmpfileName( fn.GetFullPath() );
    if ( m_info.useRelativeFilePaths ) {
        // user set the option to use relative paths (file name w/o the full path)
        tmpfileName = fn.GetFullName();
    }

    tmpfileName.Replace( wxT( "\\" ), wxT( "/" ) );

    wxString command;
    command << wxT( "-exec-jump " ) << wxT( "\"\\\"" ) << tmpfileName << wxT( ":" ) << line << wxT( "\\\"\"" );
    //return WriteCommand( command, new DbgCmdHandlerAsyncCmd( m_observer, this ) );
    return ExecCLICommand( command, new DbgCmdJumpHandler( m_observer ) );
}