Results 1 to 3 of 3

Thread: Conditional BPs in WinDbg

  1. #1

    Conditional BPs in WinDbg

    I am currently digging inside kernel part of windows GDI, and using WinDbg over serial cable for that. I wanted to place BP on the entry of some function (xxxyyyBlt in fact) that would fire only if the source or destination surface was for example larger than given dimensions. "Nothing too complicated" I thought, and I've written something like that (don't remember actual values, 'twas at work :
    bp EngStretchBlt "j
    ((poi(poi(@ebp+0x08)+0x10)>0xffff) or
    (poi(poi(@ebp+0x08)+0x14)>0xffff) or
    (poi(poi(@ebp+0x0c)+0x10)>0xffff) or
    'kp'; 'gc'"
    Just grab some parameters from stack, dereference and compare. All went good till one of the BP hits returned "memory access error". Oh yes, not always both surfaces must be passed to this function. If one of them is null, we're getting dereference error. So, I added ((poi(@ebp+0x08)>0x1000) and (poi(@ebp+0x0c)>0x100)) and ... in front of the conditional expression hoping, that if the first part of AND turns false, the second one will not be evaluated. Alas, that was a false assumption: it seems that WinDbg always evaluates the whole expression. Hence my question to WinDbg gurus - how to do it properly? Maybe split into separate BPs?
    Vulnerant omnes, ultima necat.

  2. #2
    if you are sure they are always evaluated, then file a bug report to windbg team. the ansi c standard evaluates conditions from left to right and stops immediately if .false. is encountred.

  3. #3
    Well, these expressions are not actually C, you know
    Vulnerant omnes, ultima necat.

Similar Threads

  1. WinDbg: let's load em all!
    By fasmotol in forum The Newbie Forum
    Replies: 3
    Last Post: February 28th, 2013, 01:56
  2. First time using WinDbg, having some issues
    By TheUsualSuspect in forum The Newbie Forum
    Replies: 2
    Last Post: November 13th, 2010, 17:49
  3. Share your WinDbg links
    By _genuine in forum Tools of Our Trade (TOT) Messageboard
    Replies: 6
    Last Post: May 19th, 2010, 03:13
  4. Share your WinDbg links
    By _genuine in forum Off Topic
    Replies: 6
    Last Post: May 19th, 2010, 03:13
  5. Useful WinDbg commands: .formats
    By Nynaeve in forum Blogs Forum
    Replies: 0
    Last Post: April 23rd, 2008, 10:01


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts