public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "David A. Van Arnem" <dvanarnem@cmlab.biz>
To: Nikolay Bodunov <nikolay.bodunov@gmail.com>,
	"Kinney, Michael D" <michael.d.kinney@intel.com>
Cc: "edk2-devel@ml01.01.org" <edk2-devel@ml01.01.org>,
	Laszlo Ersek <lersek@redhat.com>
Subject: Re: DEBUG() macros in DXE driver: can’t make it work in QEMU
Date: Tue, 14 Feb 2017 15:17:48 -0700	[thread overview]
Message-ID: <09003614-2953-3c06-2b7d-b0fdb81fd581@cmlab.biz> (raw)
In-Reply-To: <CANqPu1JnP2Qx+S4XjUm2YOD7B5aqf2-9zSNpcro-X-kZ4wD2=Q@mail.gmail.com>

Hi,

From a quick look at your code, I'm not sure you want to make a
DXE_DRIVER.  The code looks more like a UEFI_APPLICATION.
CrScreenshotDxe.c should normally manage a device, for UEFI_DRIVERS it
will implement the Driver Binding Protocol functions Supported(),
Start(), and Stop().

Likely, the reason you aren't seeing any DEBUG() messages is because
your functions aren't being called.

Regards,
David

On 02/14/2017 03:06 PM, Nikolay Bodunov wrote:
> Thank you for the suggestions.
> 
> I tried to use them:
> 
>> (1) Please always terminate the debug message with a newline ("\n")
> Done. No changes. Of course, I usually do it, but in that case all I needed
> was to have any string on output. Sorry for bad programming style.
> 
>> (2) Please use DEBUG_ERROR as the symbolic constant for the error mask
> Done. I think you meant in DEBUG() macros. No changes. Question about
> style, too.
> 
>> (3) DEBUG output from OVMF is by default not written to the serial port
> and
>> add -D DEBUG_ON_SERIAL_PORT
> Done. Recompiled OVMF with that option. I have now file "debug.log" 74415
> bytes size that contains everything, include EFI Shell output, but except
> my debug messages
> 
> BTW, QEMU option "-debugcon file:debug.log -global
> isa-debugcon.iobase=0x402", recommended in OVMF README, did nothing -
> "debug.log was empty.
> 
> Based on results, I suppose that the problem is not on OVMF side.
> Hope you propose something else to try. Maybe I got something in a wrong
> way.
> 
> Nikolay
> 
> 2017-02-14 21:28 GMT+03:00 Kinney, Michael D <michael.d.kinney@intel.com>:
> 
>> If you prefer debug messages on a serial port, you can
>> add -D DEBUG_ON_SERIAL_PORT
>>
>> Mike
>>
>>> -----Original Message-----
>>> From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of
>> Laszlo Ersek
>>> Sent: Tuesday, February 14, 2017 10:17 AM
>>> To: Nikolay Bodunov <nikolay.bodunov@gmail.com>; edk2-devel@ml01.01.org
>>> Subject: Re: [edk2] DEBUG() macros in DXE driver: can’t make it work in
>> QEMU
>>>
>>> Hi Nikolay,
>>>
>>> On 02/14/17 18:55, Nikolay Bodunov wrote:
>>>> Hello
>>>>
>>>>
>>>> I compiled DXE Driver, in DEBUG_GCC49 mode, but I can’t print any debug
>>>> message.
>>>> DEBUG((-1, “Print test”))  does nothing.  Exactly as
>>>> DebugPrint(EFI_D_ERROR, “Print Test);
>>>
>>> (1) Please always terminate the debug message with a newline ("\n") once
>>> you are done with it. (It's okay to format a single message with several
>>> DEBUG calls of course, and terminate only the last DEBUG with a newline.)
>>>
>>> (2) Please use DEBUG_ERROR as the symbolic constant for the error mask.
>>>
>>>>
>>>> However, I see “Print Test” string in my *.efi binary.
>>>> I use QEMU + OMVF (OVMF was also recompliled in DEBUG_GCC49 mode, to be
>>>> sure). Serial port output is redirected to a file:
>>>> qemu-system-x86_64 -L . --bios /…/FV/OVMF.fd -hda hdd.img -serial
>>>> file:./serial_file
>>>
>>> (3) DEBUG output from OVMF is by default not written to the serial port,
>>> it is written to the QEMU debug port. Please consult OvmfPkg/README for
>>> specifics, namely under "Capturing OVMF debug messages on qemu".
>>>
>>> Hope this helps,
>>> Laszlo
>>>
>>>>
>>>> All I see in output file is EFI shell output messages, include one
>> that my
>>>> driver was succesfully loaded. But no messages from DEBUG().
>>>>
>>>>
>>>> My conditions:
>>>>
>>>> MODULE_TYPE    = DXE_DRIVER
>>>>
>>>>
>>>> Debug Print Library:
>>>>
>>>> DebugLib|MdePkg/Library/BaseDebugLibSerialPort/
>> BaseDebugLibSerialPort.inf
>>>>
>>>> (BaseDebugLibNull.inf is commented, of course)
>>>>
>>>>
>>>> DebugPrintEnabled() returns TRUE
>>>>
>>>>
>>>> I also tried to set some key options manually in MdeModulePkg.dsc
>>>> afterwards, but result didn’t change:
>>>>
>>>>
>>>> [Components]
>>>>
>>>>
>>>>   MdeModulePkg/CrScreenshotDxe/CrScreenshotDxe.inf  {
>>>>
>>>>
>>>>     <PcdsFixedAtBuild>
>>>>
>>>>
>>>> gEfiMdePkgTokenSpaceGuid.gEfiMdePkgTokenSpaceGuid.
>> PcdDebugPrintErrorLevel|0x07
>>>>
>>>>       gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0x2F
>>>>
>>>>       gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel|0x80000042
>>>>
>>>>
>>>>
>>>>    <LibraryClasses>
>>>>
>>>>
>>>> DebugLib|MdePkg/Library/BaseDebugLibSerialPort/
>> BaseDebugLibSerialPort.inf
>>>>
>>>>
>>>>    <BuildOptions>
>>>>
>>>>       GCC:*_*_*_CC_FLAGS             = -UMDEPKG_NDEBUG
>>>>
>>>> }
>>>>
>>>>
>>>> Code (I used it as a base): https://github.com/LongSoft/
>> CrScreenshotDxe
>>>>
>>>> Where I got wrong and what else could I try to make it work?
>>>>
>>>
>>> _______________________________________________
>>> edk2-devel mailing list
>>> edk2-devel@lists.01.org
>>> https://lists.01.org/mailman/listinfo/edk2-devel
>>
> 
> 
> 

-- 
Regards,
David Van Arnem
Development Engineer IV
Computer Measurement Laboratory, LLC



  reply	other threads:[~2017-02-14 22:17 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-14 17:55 DEBUG() macros in DXE driver: can’t make it work in QEMU Nikolay Bodunov
2017-02-14 18:16 ` Laszlo Ersek
2017-02-14 18:28   ` Kinney, Michael D
2017-02-14 22:06     ` Nikolay Bodunov
2017-02-14 22:17       ` David A. Van Arnem [this message]
2017-02-14 22:36         ` Nikolay Bodunov
2017-02-14 23:14           ` David A. Van Arnem
2017-02-14 23:46             ` Nikolay Bodunov
2017-02-15  0:00               ` David A. Van Arnem
2017-02-15 12:39                 ` Laszlo Ersek
2017-02-16 18:05                   ` Andrew Fish
2017-02-16 18:59                     ` Laszlo Ersek
2017-02-15 10:13       ` Laszlo Ersek
2017-02-15 17:19         ` Nikolay Bodunov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=09003614-2953-3c06-2b7d-b0fdb81fd581@cmlab.biz \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox