Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | Friends | List of all members
dart::CodeBreakpoint Class Reference

#include <debugger.h>

Public Member Functions

 CodeBreakpoint (const Code &code, BreakpointLocation *loc, uword pc, UntaggedPcDescriptors::Kind kind)
 
 ~CodeBreakpoint ()
 
FunctionPtr function () const
 
uword pc () const
 
bool HasBreakpointLocation (BreakpointLocation *breakpoint_location)
 
bool FindAndDeleteBreakpointLocation (BreakpointLocation *breakpoint_location)
 
bool HasNoBreakpointLocations ()
 
void Enable ()
 
void Disable ()
 
bool IsEnabled () const
 
CodePtr OrigStubAddress () const
 
const char * ToCString () const
 

Friends

class Debugger
 
class GroupDebugger
 

Detailed Description

Definition at line 208 of file debugger.h.

Constructor & Destructor Documentation

◆ CodeBreakpoint()

dart::CodeBreakpoint::CodeBreakpoint ( const Code code,
BreakpointLocation loc,
uword  pc,
UntaggedPcDescriptors::Kind  kind 
)

Definition at line 1317 of file debugger.cc.

1321 : code_(code.ptr()),
1322 pc_(pc),
1323 enabled_count_(0),
1324 next_(nullptr),
1325 breakpoint_kind_(kind),
1326 saved_value_(Code::null()) {
1327 ASSERT(!code.IsNull());
1328 ASSERT(pc_ != 0);
1329 ASSERT((breakpoint_kind_ & kSafepointKind) != 0);
1330 AddBreakpointLocation(breakpoint_location);
1331 ASSERT(breakpoint_location->token_pos().IsReal());
1332}
uword pc() const
Definition debugger.h:224
static ObjectPtr null()
Definition object.h:433
#define ASSERT(E)
const uint8_t kSafepointKind
Definition debugger.cc:1313

◆ ~CodeBreakpoint()

dart::CodeBreakpoint::~CodeBreakpoint ( )

Definition at line 1334 of file debugger.cc.

1334 {
1335 // Make sure we don't leave patched code behind.
1336 ASSERT(!IsEnabled());
1337// Poison the data so we catch use after free errors.
1338#ifdef DEBUG
1339 code_ = Code::null();
1340 pc_ = 0ul;
1341 next_ = nullptr;
1342 breakpoint_kind_ = UntaggedPcDescriptors::kOther;
1343#endif
1344}
bool IsEnabled() const
Definition debugger.h:233

Member Function Documentation

◆ Disable()

void dart::CodeBreakpoint::Disable ( )

Definition at line 1353 of file debugger.cc.

1353 {
1354 if (enabled_count_ == 1) {
1355 RestoreCode();
1356 }
1357 --enabled_count_;
1358}

◆ Enable()

void dart::CodeBreakpoint::Enable ( )

Definition at line 1346 of file debugger.cc.

1346 {
1347 if (enabled_count_ == 0) {
1348 PatchCode();
1349 }
1350 ++enabled_count_;
1351}

◆ FindAndDeleteBreakpointLocation()

bool dart::CodeBreakpoint::FindAndDeleteBreakpointLocation ( BreakpointLocation breakpoint_location)

Definition at line 1370 of file debugger.cc.

1371 {
1372 for (intptr_t i = 0; i < breakpoint_locations_.length(); i++) {
1373 if (breakpoint_locations_[i] == breakpoint_location) {
1374 breakpoint_locations_.EraseAt(i);
1375 return true;
1376 }
1377 }
1378 return false;
1379}

◆ function()

FunctionPtr dart::CodeBreakpoint::function ( ) const
inline

Definition at line 222 of file debugger.h.

222{ return Code::Handle(code_).function(); }
static Object & Handle()
Definition object.h:407

◆ HasBreakpointLocation()

bool dart::CodeBreakpoint::HasBreakpointLocation ( BreakpointLocation breakpoint_location)

Definition at line 1360 of file debugger.cc.

1361 {
1362 for (intptr_t i = 0; i < breakpoint_locations_.length(); i++) {
1363 if (breakpoint_locations_[i] == breakpoint_location) {
1364 return true;
1365 }
1366 }
1367 return false;
1368}

◆ HasNoBreakpointLocations()

bool dart::CodeBreakpoint::HasNoBreakpointLocations ( )
inline

Definition at line 227 of file debugger.h.

227 {
228 return breakpoint_locations_.length() == 0;
229 }

◆ IsEnabled()

bool dart::CodeBreakpoint::IsEnabled ( ) const
inline

Definition at line 233 of file debugger.h.

233{ return enabled_count_ > 0; }

◆ OrigStubAddress()

CodePtr dart::CodeBreakpoint::OrigStubAddress ( ) const

◆ pc()

uword dart::CodeBreakpoint::pc ( ) const
inline

Definition at line 224 of file debugger.h.

224{ return pc_; }

◆ ToCString()

const char * dart::CodeBreakpoint::ToCString ( ) const

Definition at line 211 of file debugger.cc.

211 {
212 if (breakpoint_locations_.length() == 0) {
213 return "unlinked breakpoint";
214 }
215
216 char buffer[1024];
217 BufferFormatter f(buffer, sizeof(buffer));
218 // Pick the first, all other should have same script/line number.
219 BreakpointLocation* breakpoint_location = breakpoint_locations_.At(0);
220 String& source_url = String::Handle(breakpoint_location->url());
221 intptr_t line_number = breakpoint_location->line_number();
222
223 f.Printf("breakpoint at %s:%" Pd, source_url.ToCString(), line_number);
225}
Zone * zone() const
static Thread * Current()
Definition thread.h:361
char * MakeCopyOfString(const char *str)
Definition zone.cc:270
static const uint8_t buffer[]
#define Pd
Definition globals.h:408

Friends And Related Symbol Documentation

◆ Debugger

friend class Debugger
friend

Definition at line 273 of file debugger.h.

◆ GroupDebugger

friend class GroupDebugger
friend

Definition at line 274 of file debugger.h.


The documentation for this class was generated from the following files: