compuphase / Black-Magic-Probe-Book

A guide plus associated utilities for the Black Magic Probe.
Apache License 2.0
147 stars 26 forks source link

Trace Access Denied - error 122 #19

Closed sidprice closed 4 years ago

sidprice commented 4 years ago

I cannot get BMTrace to work (Windows), I see the above error message.

compuphase commented 4 years ago

According to winerror.h, code 122 is ERROR_INSUFFICIENT_BUFFER (a data buffer passed to a system call is too small). This might be caused by structure padding. Has BMTrace worked before, or has it never worked? If it did work before, any idea what changed?

sidprice commented 4 years ago

Yes, BMTrace has previously worked, I don't remember any changes, perhaps my target is sending larger amounts of data, perhaps 64 bytes each USB packet

compuphase commented 4 years ago

In commit b37136ed5d3626d4fee467d4a519f895a5f02797 I added an extra code to the error message, to hopefully pinpoint the problem.

sidprice commented 4 years ago

Unfortunately the mingw build fails, the file "usb-support.h" appears to be missing.

compuphase commented 4 years ago

Oops, I forgot to add the files to the project before commit. Fixed in commit bbc60b4c72ac6e36c70f329779beec441c4abfd1.

sidprice commented 4 years ago

bmtrace_1

Error when running BMTrace.

compuphase commented 4 years ago

Hmmm... so now the "access denied" error is magically gone and another error pops up. It feels to me like a memory corruption bug. You can comment out this particular assertion; it does no harm. However, the situation simply should not occur because it implies that time jumps backward...

sidprice commented 4 years ago

I commented out the assertion and BMTrace now works

compuphase commented 4 years ago

Commit ffc80c9d9ca124d696b43da388e0fed89f2aeab6 has a fix for the bug signalled by the assertion. When multiple trace messages arrive in a single USB packet, the timestamp on the 2nd (and further) was set incorrectly.