Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some hw breakpoint fixes #52

Merged
merged 2 commits into from
Jan 26, 2015
Merged

Some hw breakpoint fixes #52

merged 2 commits into from
Jan 26, 2015

Conversation

ebfe
Copy link
Contributor

@ebfe ebfe commented Jan 24, 2015

Enable usage of dr1-dr3. Clear control bits when a breakpoint
is disabled. Use DR_LEN_1 instead of DR_LEN_8 so breakpoint work on
unaligned adresses.

Fixes #51.

Enable usage of dr1-dr3.  Clear control bits when a breakpoint
is disabled. Use DR_LEN_1 instead of DR_LEN_8 so breakpoint work on
unaligned adresses.

Fixes go-delve#51.
@@ -50,6 +51,15 @@ func PtracePokeUser(tid int, off, addr uintptr) error {
return nil
}

func PtracePeekUser(tid int, off uintptr) (uintptr, error) {
var x uintptr // XXX: this should not be necessary
ret, _, err := syscall.Syscall6(syscall.SYS_PTRACE, syscall.PTRACE_PEEKUSR, uintptr(tid), uintptr(off), uintptr(unsafe.Pointer(&x)), 0, 0)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ret will never be anything of interest to us here. The actual value from this ptrace request will be stored in x. The ptrace API is to provide an address and data, and for reads (PEEK) the data stored in the requested address will be placed in the data argument, which here would be x.

ret will be 0 every time, whereas x will hold to value of interest.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On Sun, Jan 25, 2015 at 12:32:55PM -0800, Derek Parker wrote:

@@ -50,6 +51,15 @@ func PtracePokeUser(tid int, off, addr uintptr) error {
return nil
}

+func PtracePeekUser(tid int, off uintptr) (uintptr, error) {

  • var x uintptr // XXX: this should not be necessary
  • ret, _, err := syscall.Syscall6(syscall.SYS_PTRACE, syscall.PTRACE_PEEKUSR, uintptr(tid), uintptr(off), uintptr(unsafe.Pointer(&x)), 0, 0)

ret will never be anything of interest to us here. The actual value
from this ptrace request will be stored in x. The ptrace API is to
provide an address and data, and for reads (PEEK) the data stored in
the requested address will be placed in the data argument, which here
would be x.

ret will be 0 every time, whereas x will hold to value of
interest.

Indeed. The man page apparently documents the ABI of the glibc wrapper.

Fixed.

@derekparker derekparker merged commit 0d08380 into go-delve:master Jan 26, 2015
@derekparker
Copy link
Member

Thanks!

nclifton pushed a commit to nclifton/delve that referenced this pull request Feb 24, 2021
* Added optus proxy peering module

* Added optus proxy peering module

* Added optus proxy peering module
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Running tests: could not set hardware breakpoint: invalid argument
2 participants