3

I have downloaded EDK (UEDK2014) from taniacore site and I have successfully build UEFI application in Debug mode using following command

 C:\UDK2014.Complete.MyWorkSpace\UDK2014.MyWorkSpace\MyWorkSpace>
 build -t VS2012x86  -b DEBUG

As it is in Debug mode it will create a .pdb file (SecMain.pdb). My Question is How to debug this binary using VS 2010. I trided doing that by running SecMain.exe, attach it to Visual Studio 2010 and start debugging but not able to do that. Could any one have done this (Debugging an UEFi application using VS 2010) before ? please let me know if you have solution to this.

Zo Has
  • 12,599
  • 22
  • 87
  • 149
  • I answered a similar question before, please see this: http://stackoverflow.com/questions/21171455/building-uefi-driver-using-visual-studio/22083229#22083229 – sun2sirius Mar 28 '15 at 17:24

1 Answers1

1

Yes, you can use an emulator as @sun2sirius said. The only problem though if your UEFI App or driver accesses the hardware directly the emulator won't help. In this case unfortunately "printf" is your best friend. So good Trace/Log library will help you to debug your driver.

There are a few ways to simplify the development:

  • Write as much platform-independent code as you can. Easier to debug in VS IDE under the Windows. Windows has protected memory pages and debugger will catch all potential memory issues; UEFI is in real mode, so your platform dependent code is not protected against accessing dunging pointers, buffer overrun etc. So again Trace/Log library is a big help.
  • There is a hardware debugger on the market like Arium. It can debug UEFI application running on the real hardware. But it's expensive and the hardware you debugging has to have a hardware debug port available. It's not hard to find on desktops but on the production laptops it is a rare beast! So you have to solder the connector if you need to debug a specific platform.
  • I case of UEFI driver development even HW Debugger is not much of a help because you have to have a debug built of the UEFI firmware (BIOS) on the platform installed in order to use a debugger.
Alex D
  • 942
  • 1
  • 6
  • 17
  • 1
    Let me add that Phoenix Core Architect and Intel UDK Debugger Tool do actually let you debug BIOS code on the real hardware over a Serial or USB connection. These debuggers utilize Debug Agent (in SourceLevelDebugPkg), which uses CPU Debug Registers, same as Arium, to achieve full source level debugging with breakpoints, break on I/O port and memory access, variable watch, stack trace, and many more cool things. In some respects these debuggers are even more powerful than Arium, except such debugging is only available after the Debug Agent is loaded, while Arium is available right from reset. – sun2sirius Dec 28 '15 at 05:13