Is there a api/call to print stack trace to windbg from within my driver?

I am looking to print stack trace from within a particular function of my
driver code, that appears in windbg
whenever that code path gets hit…
Is there such an api/function to do so?

On Mon, 25 Dec 2006 at 23:07:45, Praveen Kumar Amritaluru wrote:

“I am looking to print stack trace from within a particular function of my
driver code, that appears in windbg whenever that code path gets hit… Is
there such an api/function to do so?”

You can display a simple stack backtrace within Windbg by setting a
breakpoint at the appropriate location in your code with a command string as
a parameter. For example:

bu nt!MmCreateSection “kbn200” OR
bu nt!MmCreateSection “kbn200;g” if you don’t want to the debugger to halt.

See the section on setting breakpoints in the Windbg help file for more
info.

I’m asssuming from your question that you have a live kernel debugging
session; if, however, you are wanting to achieve the same programmatically
(without a debugger attached), it may be difficult. I haven’t researched
what debugging APIs are available in kernel-mode, but if we assume there is
such an API available(I know you can use dbghelp.dll and dbgeng.dll from
user-mode), you’d also have to ensure that all symbols are accessible at
run-time, which you may not be able to guarantee.

Ron

From: “Praveen Kumar Amritaluru”
>Reply-To: “Windows System Software Devs Interest List”
>
>To: “Windows System Software Devs Interest List”
>Subject: [ntdev] Is there a api/call to print stack trace to windbg from
>within my driver?
>Date: Mon, 25 Dec 2006 23:07:45 +0530
>
>I am looking to print stack trace from within a particular function of my
>driver code, that appears in windbg
> whenever that code path gets hit…
>Is there such an api/function to do so?
>
>
>
>—
>Questions? First check the Kernel Driver FAQ at
>http://www.osronline.com/article.cfm?id=256
>
>To unsubscribe, visit the List Server section of OSR Online at
>http://www.osronline.com/page.cfm?name=ListServer

_________________________________________________________________
Fixing up the home? Live Search can help
http://imagine-windowslive.com/search/kits/default.aspx?kit=improve&locale=en-US&source=hmemailtaglinenov06&FORM=WLMTAG

Thanks.

bu nt!MmCreateSection “kbn200;g”
serves my purpose…

“Ronald Riddle” wrote in message news:xxxxx@ntdev…
> On Mon, 25 Dec 2006 at 23:07:45, Praveen Kumar Amritaluru wrote:
>
> “I am looking to print stack trace from within a particular function of my
> driver code, that appears in windbg whenever that code path gets hit… Is
> there such an api/function to do so?”
>
> You can display a simple stack backtrace within Windbg by setting a
> breakpoint at the appropriate location in your code with a command string
> as a parameter. For example:
>
> bu nt!MmCreateSection “kbn200” OR
> bu nt!MmCreateSection “kbn200;g” if you don’t want to the debugger to
> halt.
>
> See the section on setting breakpoints in the Windbg help file for more
> info.
>
> I’m asssuming from your question that you have a live kernel debugging
> session; if, however, you are wanting to achieve the same programmatically
> (without a debugger attached), it may be difficult. I haven’t researched
> what debugging APIs are available in kernel-mode, but if we assume there
> is such an API available(I know you can use dbghelp.dll and dbgeng.dll
> from user-mode), you’d also have to ensure that all symbols are accessible
> at run-time, which you may not be able to guarantee.
>
>
> Ron
>
>
>>From: “Praveen Kumar Amritaluru”
>>Reply-To: “Windows System Software Devs Interest List”
>>
>>To: “Windows System Software Devs Interest List”
>>Subject: [ntdev] Is there a api/call to print stack trace to windbg from
>>within my driver?
>>Date: Mon, 25 Dec 2006 23:07:45 +0530
>>
>>I am looking to print stack trace from within a particular function of my
>>driver code, that appears in windbg
>> whenever that code path gets hit…
>>Is there such an api/function to do so?
>>
>>
>>
>>—
>>Questions? First check the Kernel Driver FAQ at
>>http://www.osronline.com/article.cfm?id=256
>>
>>To unsubscribe, visit the List Server section of OSR Online at
>>http://www.osronline.com/page.cfm?name=ListServer
>
> _________________________________________________________________
> Fixing up the home? Live Search can help
> http://imagine-windowslive.com/search/kits/default.aspx?kit=improve&locale=en-US&source=hmemailtaglinenov06&FORM=WLMTAG
>
>