-
Notifications
You must be signed in to change notification settings - Fork 63
Implement hardware breakpoint support for Linux-x86 #243
Conversation
eaec15d
to
5e8356f
Compare
@@ -35,7 +35,10 @@ void SoftwareBreakpointManager::clear() { | |||
} | |||
|
|||
ErrorCode SoftwareBreakpointManager::add(Address const &address, Type type, | |||
size_t size) { | |||
size_t size, Mode mode) { | |||
if (mode != kModeExec) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you can make this a DS2ASSERT
, given that we don't pass user data directly here, and that all callers of ::add
will always call it with kModeExec
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the issue with doing that is that you could theoretically have software watchpoints (gdb does), and so I'm not sure that it's really an assertion-level failure to try to create one, even if we don't support them currently?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah that's a good point.
On Mon, Apr 4, 2016 at 3:54 PM, Francis Ricci notifications@github.com
wrote:
In Sources/Architecture/ARM/SoftwareBreakpointManager.cpp
#243 (comment):@@ -35,7 +35,10 @@ void SoftwareBreakpointManager::clear() {
}ErrorCode SoftwareBreakpointManager::add(Address const &address, Type type,
size_t size) {
size_t size, Mode mode) {
- if (mode != kModeExec)
I think the issue with doing that is that you could theoretically have
software watchpoints (gdb does), and so I'm not sure that it's really an
assertion-level failure to try to create one, even if we don't support them
currently?—
You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
https://github.com/facebook/ds2/pull/243/files/2b7add545bce75bd539f7f39cb938aa59689d8ae#r58462758
Stephane Sezer
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can move this check in super::add()
and avoid having to duplicate it in the x86 counterpart of this file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, I looked at software watchpoints a little bit, and they are handled by the client directly. The debug server has nothing to do with them, and the protocol doesn't support setting "software watchpoints". PR#268 should make us safe to put an assertion there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no SoftwareBreakpointManager superclass, "super" here is BreakpointManager, and I can't put it there, or it will break hardware breakpoints. But I can change it to an assert.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah true.
On Friday, April 8, 2016, Francis Ricci notifications@github.com wrote:
In Sources/Architecture/ARM/SoftwareBreakpointManager.cpp
#243 (comment):@@ -35,7 +35,10 @@ void SoftwareBreakpointManager::clear() {
}ErrorCode SoftwareBreakpointManager::add(Address const &address, Type type,
size_t size) {
size_t size, Mode mode) {
- if (mode != kModeExec)
There is no SoftwareBreakpointManager superclass, "super" here is
BreakpointManager, and I can't put it there, or it will break hardware
breakpoints. But I can change it to an assert.—
You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
https://github.com/facebook/ds2/pull/243/files/2b7add545bce75bd539f7f39cb938aa59689d8ae#r59102598
Stephane Sezer
2b454aa
to
523f690
Compare
@fjricci updated the pull request. |
76df0f2
to
4592851
Compare
366459a
to
6971fd7
Compare
25b0271
to
0ef37b1
Compare
|
||
ErrorCode ThreadBase::beforeResume() { | ||
if (!_process->isAlive()) | ||
return kErrorProcessNotFound; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Braces and stuff :p
0ee677d
to
dbb0683
Compare
@@ -1004,6 +1004,10 @@ DebugSessionImplBase::onResume(Session &session, | |||
#endif | |||
|
|||
case StopInfo::kReasonThreadEntry: | |||
error = _process->currentThread()->beforeResume(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pro-tip: You can use a fancy macro here.
10ba488
to
0123613
Compare
Committed the CHK patch as 9d0f300. |
Fixes problem where hardware breakpoints were not enabled on newly created threads.
} | ||
|
||
bool SoftwareBreakpointManager::enabled(Target::Thread *thread) const { | ||
if (thread != nullptr) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be a DS2_ASSERT
.
} | ||
|
||
void SoftwareBreakpointManager::disable(Target::Thread *thread) { | ||
super::disable(thread); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we have to pass thread
here? Can't we just DS2_ASSERT(thread == nullptr)
and call supper::disable()
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe this was to unify the api with hardware breakpoints.
ErrorCode error; | ||
ByteVector old = _insns[site.address]; | ||
|
||
if (thread != nullptr) { | ||
DS2LOG(Warning, "thread-specific software breakpoints are unsupported"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be a DS2_ASSERT
as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We had a conversation with this one, and I think the conclusion was that since gdb supports these, we should leave the option available.
No description provided.