-
Notifications
You must be signed in to change notification settings - Fork 588
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move extra_regs to ReplayTask, use extra_regs_fallible in more places.
Fixes #3725
- Loading branch information
Showing
14 changed files
with
133 additions
and
93 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -108,7 +108,7 @@ static bool set_reg(Task* target, const GdbRegisterValue& reg) { | |
return true; | ||
} | ||
|
||
ExtraRegisters extra_regs = target->extra_regs(); | ||
ExtraRegisters extra_regs = *target->extra_regs_fallible(); | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
khuey
Author
Collaborator
|
||
if (extra_regs.write_register(reg.name, reg.value, reg.size)) { | ||
target->set_extra_regs(extra_regs); | ||
return true; | ||
|
@@ -166,10 +166,10 @@ static WatchType watchpoint_type(GdbRequestType req) { | |
} | ||
|
||
static void maybe_singlestep_for_event(Task* t, GdbRequest* req) { | ||
if (!t->session().is_replaying()) { | ||
ReplayTask* rt = ReplayTask::cast_or_null(t); | ||
if (!rt) { | ||
return; | ||
} | ||
auto rt = static_cast<ReplayTask*>(t); | ||
if (trace_instructions_up_to_event( | ||
rt->session().current_trace_frame().time())) { | ||
fputs("Stepping: ", stderr); | ||
|
@@ -218,7 +218,7 @@ class GdbBreakpointCondition : public BreakpointCondition { | |
expressions.push_back(GdbServerExpression(b.data(), b.size())); | ||
} | ||
} | ||
virtual bool evaluate(Task* t) const override { | ||
virtual bool evaluate(ReplayTask* t) const override { | ||
for (auto& e : expressions) { | ||
GdbServerExpression::Value v; | ||
// Break if evaluation fails or the result is nonzero | ||
|
@@ -638,12 +638,12 @@ void GdbServer::dispatch_debugger_request(Session& session, | |
} | ||
case DREQ_GET_REG: { | ||
GdbRegisterValue reg = | ||
get_reg(target->regs(), target->extra_regs(), req.reg().name); | ||
get_reg(target->regs(), *target->extra_regs_fallible(), req.reg().name); | ||
dbg->reply_get_reg(reg); | ||
return; | ||
} | ||
case DREQ_GET_REGS: { | ||
dispatch_regs_request(target->regs(), target->extra_regs()); | ||
dispatch_regs_request(target->regs(), *target->extra_regs_fallible()); | ||
return; | ||
} | ||
case DREQ_SET_REG: { | ||
|
@@ -768,7 +768,7 @@ void GdbServer::dispatch_debugger_request(Session& session, | |
} | ||
SavedRegisters& regs = saved_register_states[state_index]; | ||
regs.regs = target->regs(); | ||
regs.extra_regs = target->extra_regs(); | ||
regs.extra_regs = *target->extra_regs_fallible(); | ||
dbg->reply_save_register_state(true, state_index); | ||
return; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Wouldn't it be better to just call
extra_regs()
as before and get an ASSERT failure if the task is dead, instead of crashing with a null deref or worse here?