debugging - C++ variable assignment using 'this' -
i debugging c++ software, in particular, trying work out why field on gui populated after particular button pressed, when should set dashes. have found functions being called when button pressed, , while debugging these functions, particular switch statement run:
switch (seltype){ case wptmanager::pointandfromitemselection: case wptmanager::pointselection:{ //on entry page, there should single //waypoint in filter list in wptmanager. //this have been populated prior gaining //access page. int wpindex; cuserrp wpobj; thewptmanager->getfilteredwaypointbyindex(1, &wpindex, &wpobj); //once selected item has been read, reset filter list //to put of waypoints it... , sort them ready //for scrolling (page fwd/page back) thewptmanager->setwaypointfiltertext("", wptmanager::filwptsonly); //copy data 'scratchpad' object display reloadscratchpad(&wpobj); this->wptrngbrgupdatereqd = true; //find number of waypoint in sorted/ordered list this->wptdetailsindex = thewptmanager->finditeminfilteredlist(scratchwp->m_number); } //break if interested in 'point selection' if (seltype == wptmanager::pointselection) break; case wptmanager::fromitemselection: this->processfromitemselection(true); thewptmanager->setwaypointfiltertext("", wptmanager::filwptsonly); this->wptrngbrgupdatereqd = true; break; }
i put breakpoints on each case
, , while stepping through code, line this->wptrngbrgupdatereqd = true;
hit. had added 'watch' variable wptrngbrgupdatereqd
, , showed before line hit, value false
, however, when breakpoint hit, showing line being run, , 'continued', breakpoint on next line hit, this->wptdetailsindex = thewptmanager->finditeminfilteredlist(scratchwp->m_number);
, 'watch' frame in visual studio showed value of wptrngbrgupdatereqd
still false- although greyed out.
i expected value of wptrngbrgupdatereqd
change true when line run... reason wouldn't?
when hovered cursor on refresh button, said:
the value of expression may incorrect. not evaluated because: 'cxx0030: error: expression cannot evaluated'
msdn.microsoft.com says cxx0030 means:
the debugger's expression evaluator not obtain value expression written. 1 cause expression refers memory outside program's address space (dereferencing null pointer 1 example). windows not allow access memory outside of program's address space.
but given happens while code still executing same function (it's literally next line), wouldn't have thought trying access memory outside program's address space...?
another example of problem i'm trying describe happens later in same function switch
i've included above... next few lines of code are:
this->wptfromitemselected = false; //set page 'mode' according whether or not waypoint //already has speed. may have arrived on page/layout pressing //"crs/spd" on static waypoint page - in case, defaults different //to selecting "crs/spd" on moving waypoint page. if (this->scratchwp->ismoving()){ this->curtimemode=currenttimemode; this->wptmovingcrsspdselected = false; this->wptorigtimeinfocus = false; this->wptmovingshowpov = false; } else { this->curtimemode=currenttimemode; this->wptmovingcrsspdselected = true; this->wptorigtimeinfocus = false; this->wptmovingshowpov = false; this->scratchwp->resetinittime(); this->scratchwp->invalidateinittime(); this->wptmovingorigtimeforceupdate = true; }
when breakpoint on if
above hit, value of wptrngbrgupdatereqd
true
, however, continue, , next line run- this->curtimemode=currenttimemode;
, value of wptrngbrgupdatereqd
changes false
does have fact assignment being made using this
keyword?
Comments
Post a Comment