Click here to Skip to main content
15,910,981 members
Home / Discussions / Hardware & Devices
   

Hardware & Devices

 
AnswerRe: A vison Pin
Dan Neely19-May-08 2:26
Dan Neely19-May-08 2:26 
GeneralRe: A vison Pin
duo!@#19-May-08 23:38
duo!@#19-May-08 23:38 
GeneralRe: A vison Pin
Dan Neely20-May-08 2:16
Dan Neely20-May-08 2:16 
GeneralRe: A vison Pin
Brady Kelly21-May-08 3:03
Brady Kelly21-May-08 3:03 
GeneralRe: A vison Pin
Dan Neely21-May-08 3:23
Dan Neely21-May-08 3:23 
AnswerRe: A vison Pin
Trollslayer26-May-08 13:15
mentorTrollslayer26-May-08 13:15 
AnswerRe: A vison Pin
fat_boy19-May-08 3:30
fat_boy19-May-08 3:30 
QuestionHaving probs with Hardware Breakpoints Pin
AndrewWood16-May-08 19:52
AndrewWood16-May-08 19:52 
I have a working app I wrote that uses software breakpoints but read a great article on using hardware breakpoints, advantages - non intrusive and speed. Since both aspects were appealing I undertook a conversion. I began porting the dll I had written to asm and implemented the proper routines. However, I am having some very strange problems that have taken me hours to try and figure out and I'm stumped.

Here's the shorthanded basics...

#define MB MessageBox etc etc

while TRUE
{
ContextFlags = CONTEXT_DEBUG_REGISTERS

GetThreadConext

Dr0 = Addey1
Dr1 = Addey 2
Dr7 = 00000000000000000010001100001111b

SetThreadContext

WaitForDebugEvent

if ( dwDebugEventCode == EXIT_PROCESS_DEBUG_EVENT )
{
MB __T("Process exiting")
break
}

if ( dwDebugEventCode == EXCEPTION_DEBUG_EVENT )
{

if ( ExceptionCode == EXCEPTION_BREAKPOINT )
{

if ( ExceptionAddress == Addey1 )
MB __T("Hello from addey 1")
elseif ExceptionAddress == Addey2 )
MB __T("Hello from addey 2")

// here we clear the Dr regs enable single step in FLAGS, back up EIP
// continue & wait for debug event and then xor FLAGS and continue
// pretty much the same as the working dll that uses 0CCh breaks
}
else
{
ContinueDebugEvent - DBG_CONTINUE
continue
}

} // end EXCEPTION_DEBUG_EVENT

ContinueDebugEvent - DBG_EXCEPTION_NOT_HANDLED
} // end while


Now - the results are. If the app is ran the MB saying "Process exiting" pops up. Load it up in Ollydbg and run it, same result. If I set a breakpoint in Olly at the if EXCEPTION_BREAKPOINT, it hits and single stepping in results in trace into kernel32 which then traces into ntdll which returns back to the app and the proper MB "Hello from Addey x" msg as it is designed to do.

What gives? I have thought possibly that Olly is making a Ring0 call therefore can properly handle the DR reg calculations, but that would mean I would have to create a wdm or sys file runnning in Ring0 just to look at hardware breakpoints? Creating a Callgate to ring0 or manipulate SEH isn't feasible as MS could break such code with a patch, not to mention it's just not reliable from machine to machine.

I really do need the speed of the hardware breakpoint as the current dll is fast but not as fast as is desired, not to mention ReadProc and WriteProc 0cch is costly. I would be prepared to write a device driver but it has to also communicate with Ring3 code i reckon using MemMapping would be best but I'm a newb at the current device driver implementations.

Any help on why this code runs when traced in a debugger using single stepping but just exits when run would be most appreciated.
AnswerRe: Having probs with Hardware Breakpoints Pin
AndrewWood26-May-08 5:43
AndrewWood26-May-08 5:43 
GeneralPSU Power Calculator Pin
Brady Kelly16-May-08 3:42
Brady Kelly16-May-08 3:42 
QuestionBuilding Application for tracking sales of Fuel Pump meter Pin
mickeyen15-May-08 13:57
mickeyen15-May-08 13:57 
QuestionBlueTooth and EEPROM APIs Pin
IamPoojaa14-May-08 18:28
IamPoojaa14-May-08 18:28 
AnswerRe: BlueTooth and EEPROM APIs Pin
killabyte8-Jul-08 1:15
killabyte8-Jul-08 1:15 
GeneralPSU Diagnostics Pin
Brady Kelly14-May-08 7:38
Brady Kelly14-May-08 7:38 
GeneralRe: PSU Diagnostics Pin
Johpoke14-May-08 8:41
Johpoke14-May-08 8:41 
GeneralRe: PSU Diagnostics Pin
Jörgen Andersson15-May-08 1:18
professionalJörgen Andersson15-May-08 1:18 
GeneralRe: PSU Diagnostics Pin
Dan Neely15-May-08 2:19
Dan Neely15-May-08 2:19 
GeneralRe: PSU Diagnostics Pin
Brady Kelly16-May-08 3:46
Brady Kelly16-May-08 3:46 
GeneralRe: PSU Diagnostics Pin
Jörgen Andersson16-May-08 4:10
professionalJörgen Andersson16-May-08 4:10 
GeneralRe: PSU Diagnostics Pin
Dan Neely16-May-08 4:51
Dan Neely16-May-08 4:51 
GeneralRe: PSU Diagnostics Pin
Brady Kelly16-May-08 5:01
Brady Kelly16-May-08 5:01 
GeneralRe: PSU Diagnostics Pin
Dan Neely16-May-08 5:17
Dan Neely16-May-08 5:17 
QuestionMachine Randomly Shuts Down Pin
Brady Kelly14-May-08 4:17
Brady Kelly14-May-08 4:17 
AnswerRe: Machine Randomly Shuts Down Pin
fat_boy14-May-08 5:36
fat_boy14-May-08 5:36 
GeneralRe: Machine Randomly Shuts Down Pin
Dan Neely14-May-08 7:10
Dan Neely14-May-08 7:10 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.