Another note on this: VS2010 debugs by loading the DLL version of your module, 
if it can find it, instead of the one in the FV. It finds the DLL by examining 
the debug record in the EXE in the FV. The DLL file must be in the same 
directory as the PDB file specified. So, if you try to load a random .efi and 
don't have the build DLL and PDB in the location, it won't do source level 
debug.

Tim 

-----Original Message-----
From: Carsey, Jaben [mailto:jaben.car...@intel.com] 
Sent: Friday, December 13, 2013 1:47 PM
To: Jordan Justen
Cc: edk2-devel@lists.sourceforge.net
Subject: Re: [edk2] How to debug application running in secmain with 
WinDbg/VS2010

In visual studio, you can press F9 and get a breakpoint on the line of code you 
cursor is on...  that way there is no "special" code to add/remove...

-----Original Message-----
From: Jordan Justen [mailto:jljus...@gmail.com]
Sent: Friday, December 13, 2013 1:01 PM
To: Carsey, Jaben
Cc: Amit Kulkarni; edk2-devel@lists.sourceforge.net
Subject: Re: [edk2] How to debug application running in secmain with 
WinDbg/VS2010
Importance: High

On Fri, Dec 13, 2013 at 12:40 PM, Carsey, Jaben <jaben.car...@intel.com> wrote:
> I have always found the following works for me.
>
> 1)      Set the breakpoint

How did you set a breakpoint initially?

I seem to recall for NT32 I would add a call to CpuBreakpoint and then rebuild 
NT32. Then when 'build run' was executed an exception would happen. This would 
allow VS to open to debug the code, and it would have symbols available. VS 
debug could then set additional breakpoints in the code as usual.

I would imagine WinDbg could also be used to debug the application as well and 
it should be able to load the symbols like VS.

-Jordan

> 2)      Do the "build run"
>
> 3)      I attach the debugger as soon as I can to secmain.exe
>
>
>
> Then when the module with the breakpoint loads visual studio changes 
> the color of the breakpoint to indicate that it's possible to hit...
>
>
>
>
>
> -Jaben
>
>
>
> From: Andrew Fish [mailto:af...@apple.com]
> Sent: Friday, December 13, 2013 11:51 AM
> To: Amit Kulkarni; edk2-devel@lists.sourceforge.net
> Subject: Re: [edk2] How to debug application running in secmain with
> WinDbg/VS2010
>
>
>
>
>
> On Dec 13, 2013, at 2:53 AM, Amit Kulkarni 
> <amit_balasaheb2...@yahoo.com>
> wrote:
>
>
>
> Hi All,
>
>
>
> I am trying to debug hello sample from EADK running in NT32(secmain) 
> using WinDbg & VS2010 but my breakpoint does not hit. I observed that 
> lm command does not show hello in loaded module list.
>
>
>
>
>
> An Application loads, executes, and then unloads. So if the 
> Application is not running you will not see it in the list.
>
>
>
> So is it possible to debug in NT32(secmain) using WinDbg/VS2010?
> Is there any way to do source level debugging while running in secmain?
>
>
>
>
>
> So it's been a lot of years since I used Visual Studio, but NT32 is 
> just an application so you should be able to debug it directly with 
> VS2010. I'm guessing the default build of NT32 does not support WinDbg 
> as you need to do special magic(tm) to load symbols of EFI modules in
> VS2010 (Thus the standard WinDbg serial stuff is probably not hooked 
> in). The LoadLibraryEx() call in SecNt32PeCoffRelocateImage in 
> https://svn.code.sf.net/p/edk2/code/trunk/edk2/Nt32Pkg/Sec/SecMain.c
> is what makes symbols visible to VS2010. SecMain is a Windows 
> Application so you should not have any issues debugging that directly with 
> VS2010.
>
>
>
> To use WinDbg I think you need to use OVFM and establish a serial 
> connection with the VM.
>
>
>
> Thanks,
>
>
>
> Andrew Fish
>
>
>
> Thanks & Regards,
> Amit Kulkarni.
>
> ----------------------------------------------------------------------
> -------- Rapidly troubleshoot problems before they affect your 
> business. Most IT organizations don't have a clear picture of how 
> application performance affects their revenue. With AppDynamics, you 
> get 100% visibility into your Java,.NET, & PHP application. Start your 
> 15-day FREE TRIAL of AppDynamics Pro!
> http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.c
> lktrk_______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/edk2-devel
>
>
>
>
> ----------------------------------------------------------------------
> -------- Rapidly troubleshoot problems before they affect your 
> business. Most IT organizations don't have a clear picture of how 
> application performance affects their revenue. With AppDynamics, you 
> get 100% visibility into your Java,.NET, & PHP application. Start your 
> 15-day FREE TRIAL of AppDynamics Pro!
> http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.c
> lktrk _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/edk2-devel
>

------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT 
organizations don't have a clear picture of how application performance 
affects their revenue. With AppDynamics, you get 100% visibility into your 
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel

------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT 
organizations don't have a clear picture of how application performance 
affects their revenue. With AppDynamics, you get 100% visibility into your 
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel

Reply via email to