Groups > Microsoft > WinDbg > Re: DbgEng Extension




DbgEng Extension

DbgEng Extension
Tue, 1 Apr 2008 11:45:05 -0700
Hi,

I'm trying to write an extension to monitor a process's resource
utilization. In particular, I want to watch heap and handle functions
to track leaks and over consumption. Does the DbgEng API provide a
facility to do this? For instance, I would like to see all calls to
malloc and then insect the return, the same for free. I could modify
the export table of msvcrt.dll, but this is not ideal.

Thanks,
Post Reply
Re: DbgEng Extension
Tue, 1 Apr 2008 15:12:03 -0700
I would invite you to think about the purpose of tracking those things,
since the OS can track those for you today in a much better fashion.

First of all, there is one API that can parse Handle-Trace
information and Heap-Block information, and it is called 
VerifierEnumerateResource.
It gives you access to the complete and same type of information that
is displayed by `!htrace` and `!heap -p all`.
You can call that API from a standalone application.
In a debugger extension, you would probably want to parse the
outout of the above mentioned commands, and, you have the
advantage that those commands have a much better coverage
than any code that you can possibly write, and, they can be updated
when OS or other things changes around you.

Dbgeng.dll gives you basic facilities, such as readin memory
from a different process, and resolving addressed to human readable symbols 
,
but, it does not have the interception functionalities that you request.
You can use detour to implement that, but, you will not get much more
information that is not alread provided by the stack capture of
the heap verification layers, and, the handle trace built-in in the 
IO-Manager.

-- 

-- 
This posting is provided "AS IS" with no warranties, and confers no
rights.
Use of any included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm


<mrs.esterhouse@gmail.com> wrote in message 
news:bf71e950-ff26-4464-a5ef-4f62d2ed1c7d@b64g2000hsa.googlegroups.com...
> Hi,
>
> I'm trying to write an extension to monitor a process's resource
> utilization. In particular, I want to watch heap and handle functions
> to track leaks and over consumption. Does the DbgEng API provide a
> facility to do this? For instance, I would like to see all calls to
> malloc and then insect the return, the same for free. I could modify
> the export table of msvcrt.dll, but this is not ideal.
>
> Thanks,
>    Ester 

Post Reply
Re: DbgEng Extension
Tue, 1 Apr 2008 19:05:49 -0700
This looks like a very useful function and I would like to give it a
try. The only problem is, I don't have a version of Verifier.dll with
the appropriate export:

C:\Program Files\Microsoft Visual Studio 9.0\VC>dumpbin /EXPORTS c:
\windows\syst
em32\verifier.dll
Microsoft (R) COFF/PE Dumper Version 9.00.21022.08
Copyright (C) Microsoft Corporation.  All rights reserved.


Dump of file c:\windows\system32\verifier.dll

File Type: DLL

  Section contains the following exports for VERIFIER.dll

    00000000 characteristics
    3B7D7BFB time date stamp Fri Aug 17 16:18:03 2001
        0.00 version
           1 ordinal base
           1 number of functions
           1 number of names

    ordinal hint RVA      name

          1    0 0000260D VerifierSetFlags = _VerifierSetFlags@12

  Summary

       41000 .data
        1000 .reloc
        1000 .rsrc
        2000 .text

I'm using Windows XP SP2. Where an I get a version of verifier.dll
that exports this function?

Thanks,
    Ester

On Apr 1, 6:12 pm, "Ivan Brugiolo [MSFT]"
<ivanb...@online.microsoft.com> wrote:
> I would invite you to think about the purpose of tracking those things,
> since the OS can track those for you today in a much better fashion.
>
> First of all, there is one API that can parse Handle-Trace
> information and Heap-Block information, and it is called
> VerifierEnumerateResource.
> It gives you access to the complete and same type of information that
> is displayed by `!htrace` and `!heap -p all`.
> You can call that API from a standalone application.
> In a debugger extension, you would probably want to parse the
> outout of the above mentioned commands, and, you have the
> advantage that those commands have a much better coverage
> than any code that you can possibly write, and, they can be updated
> when OS or other things changes around you.
>
> Dbgeng.dll gives you basic facilities, such as readin memory
> from a different process, and resolving addressed to human readable
symbols
> ,
> but, it does not have the interception functionalities that you request.
> You can use detour to implement that, but, you will not get much more
> information that is not alread provided by the stack capture of
> the heap verification layers, and, the handle trace built-in in the
> IO-Manager.
>
> --
>
> --
> This posting is provided "AS IS" with no warranties, and confers
no rights.
> Use of any included script samples are subject to the terms specified
athttp://www.microsoft.com/info/cpyright.htm
>
> <mrs.esterho...@gmail.com> wrote in message
>
> news:bf71e950-ff26-4464-a5ef-4f62d2ed1c7d@b64g2000hsa.googlegroups.com...
>
> > Hi,
>
> > I'm trying to write an extension to monitor a process's resource
> > utilization. In particular, I want to watch heap and handle functions
> > to track leaks and over consumption. Does the DbgEng API provide a
> > facility to do this? For instance, I would like to see all calls to
> > malloc and then insect the return, the same for free. I could modify
> > the export table of msvcrt.dll, but this is not ideal.
>
> > Thanks,
> >    Ester
Post Reply
Re: DbgEng Extension
Tue, 1 Apr 2008 20:00:44 -0700
http://support.microsoft.com/kb/889016

-- 

-- 
This posting is provided "AS IS" with no warranties, and confers no
rights.
Use of any included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm


<mrs.esterhouse@gmail.com> wrote in message 
news:2fed44b9-1666-40d3-84fa-53560d13e010@c65g2000hsa.googlegroups.com...
> This looks like a very useful function and I would like to give it a
> try. The only problem is, I don't have a version of Verifier.dll with
> the appropriate export:
>
> C:\Program Files\Microsoft Visual Studio 9.0\VC>dumpbin /EXPORTS c:
> \windows\syst
> em32\verifier.dll
> Microsoft (R) COFF/PE Dumper Version 9.00.21022.08
> Copyright (C) Microsoft Corporation.  All rights reserved.
>
>
> Dump of file c:\windows\system32\verifier.dll
>
> File Type: DLL
>
>  Section contains the following exports for VERIFIER.dll
>
>    00000000 characteristics
>    3B7D7BFB time date stamp Fri Aug 17 16:18:03 2001
>        0.00 version
>           1 ordinal base
>           1 number of functions
>           1 number of names
>
>    ordinal hint RVA      name
>
>          1    0 0000260D VerifierSetFlags = _VerifierSetFlags@12
>
>  Summary
>
>       41000 .data
>        1000 .reloc
>        1000 .rsrc
>        2000 .text
>
> I'm using Windows XP SP2. Where an I get a version of verifier.dll
> that exports this function?
>
> Thanks,
>    Ester
>
> On Apr 1, 6:12 pm, "Ivan Brugiolo [MSFT]"
> <ivanb...@online.microsoft.com> wrote:
>> I would invite you to think about the purpose of tracking those
things,
>> since the OS can track those for you today in a much better fashion.
>>
>> First of all, there is one API that can parse Handle-Trace
>> information and Heap-Block information, and it is called
>> VerifierEnumerateResource.
>> It gives you access to the complete and same type of information that
>> is displayed by `!htrace` and `!heap -p all`.
>> You can call that API from a standalone application.
>> In a debugger extension, you would probably want to parse the
>> outout of the above mentioned commands, and, you have the
>> advantage that those commands have a much better coverage
>> than any code that you can possibly write, and, they can be updated
>> when OS or other things changes around you.
>>
>> Dbgeng.dll gives you basic facilities, such as readin memory
>> from a different process, and resolving addressed to human readable 
>> symbols
>> ,
>> but, it does not have the interception functionalities that you
request.
>> You can use detour to implement that, but, you will not get much more
>> information that is not alread provided by the stack capture of
>> the heap verification layers, and, the handle trace built-in in the
>> IO-Manager.
>>
>> --
>>
>> --
>> This posting is provided "AS IS" with no warranties, and
confers no 
>> rights.
>> Use of any included script samples are subject to the terms specified 
>> athttp://www.microsoft.com/info/cpyright.htm
>>
>> <mrs.esterho...@gmail.com> wrote in message
>>
>>
news:bf71e950-ff26-4464-a5ef-4f62d2ed1c7d@b64g2000hsa.googlegroups.com...
>>
>> > Hi,
>>
>> > I'm trying to write an extension to monitor a process's resource
>> > utilization. In particular, I want to watch heap and handle
functions
>> > to track leaks and over consumption. Does the DbgEng API provide
a
>> > facility to do this? For instance, I would like to see all calls
to
>> > malloc and then insect the return, the same for free. I could
modify
>> > the export table of msvcrt.dll, but this is not ideal.
>>
>> > Thanks,
>> >    Ester
> 

Post Reply
about | contact