From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=17.171.2.31; helo=mail-in21.apple.com; envelope-from=afish@apple.com; receiver=edk2-devel@lists.01.org Received: from mail-in21.apple.com (mail-out21.apple.com [17.171.2.31]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id EFE2821E0BA17 for ; Thu, 1 Feb 2018 11:15:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; d=apple.com; s=mailout2048s; c=relaxed/simple; q=dns/txt; i=@apple.com; t=1517512870; x=2381426470; h=From:Sender:Reply-To:Subject:Date:Message-id:To:Cc:MIME-version:Content-type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-reply-to:References:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=b5sfgEoEtBR6qEgPkQFwqklWD4GxQSTyT3wtAJYAU4w=; b=wWmPkRMPB/wjRjWx7qaduUuiDlBDDTbPsVVFdcy4pzDcA/znimCnbDQ/35TRBJ5U ClGF+z5b9wwphxGGGcmzFJ7gJi0TCjtV+14CwCXUI4kdF8xuDWk7hQPKeLy7BR5H czdU9DnBwmEZZGYoJss1ZDdAgaL2oSiWIILAaRThgtn6H2QKsXvAKtx8DBtM+6sn uG5kCpo8/aSwVTzyWhxEBlaB/RLg6S5WZAkpZEjphFf9HVLXbR1POsfBgWmJX0+q HyqbdnSGubONQcBmPvgTbq4B98ijw+YRSH3w6Nctdx8wfLYLiK89086vMojNOJZz Huz2743UsnstTZs8k/QvQw==; Received: from relay27.apple.com (relay27.apple.com [17.171.128.108]) (using TLS with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mail-in21.apple.com (Apple Secure Mail Relay) with SMTP id 52.8B.03684.6A8637A5; Thu, 1 Feb 2018 11:21:10 -0800 (PST) X-AuditID: 11ab0215-4d5ff70000000e64-b0-5a7368a60ce6 Received: from ma1-mmpp-sz08.apple.com (ma1-mmpp-sz08.apple.com [17.171.128.176]) by relay27.apple.com (Apple SCV relay) with SMTP id 92.19.31824.6A8637A5; Thu, 1 Feb 2018 11:21:10 -0800 (PST) MIME-version: 1.0 Received: from [17.234.178.36] by ma1-mmpp-sz08.apple.com (Oracle Communications Messaging Server 8.0.2.2.20180122 64bit (built Jan 22 2018)) with ESMTPSA id <0P3H00HEWKF7NJ90@ma1-mmpp-sz08.apple.com>; Thu, 01 Feb 2018 11:21:10 -0800 (PST) Sender: afish@apple.com From: Andrew Fish Message-id: <8DA1FBCB-B359-4498-8914-FEE6758ECEAF@apple.com> Date: Thu, 01 Feb 2018 11:21:06 -0800 In-reply-to: Cc: krishnaLee , edk2-devel@lists.01.org To: Laszlo Ersek References: <20478935.ac13.16150c3aa05.Coremail.sssky307@163.com> X-Mailer: Apple Mail (2.3445.5.20) X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrHLMWRmVeSWpSXmKPExsUiuLohR3dZRnGUwaPTchZ7Dh1ltlh2bAeL xfye18wOzB6LV0xh9eie/Y/F4/2+q2wBzFFcNimpOZllqUX6dglcGa8alAu+nWaseD3zP1sD 4/utjF2MnBwSAiYStz7eYu5i5OIQEljPJPH37hu4xK7bq1lAbCGBw4wST1cIgNi8AoISPybf A4szC4RJfP++jQ2i+SujxPO2nWwgCWEBcYl3ZzYxg9hsAsoSK+Z/YO9i5ABqtpH4tsEaosRe 4tONJWBzWARUJX5vP8YOYnMK2ElcmnCGGWK+lcSHT/vAbBEBFYnZEx4wQdxTKnHwwkomiDuV JKZ/vw12g4TACjaJvQu7GScwCs1CcussJLfOAjqDWUBdYsqUXIiwtsSTdxdYIWw1iYW/FzEh iy9gZFvFKJybmJmjm5lnZKiXWFCQk6qXnJ+7iREcIUyiOxjnvzI8xCjAwajEw5sgWxwlxJpY VlyZe4hRmoNFSZw3UjkrSkggPbEkNTs1tSC1KL6oNCe1+BAjEwenVANj59yYFxwulrv+zGaV 8kv5Py/22GOPgPUJO7MF+zf5XZwbw6jz8biAhZLZpHlnMh/6Ca16s/rF1jPNFyvs1vWmfjr9 hHdJYMmuRztv37giKWd+7+DeABGfH1rtR+ZqhO3WuhxZYxX6KEi153xJ9gmWB9s/JvhWilvV XLt38tT9uyoH9ueW9UxWVmIpzkg01GIuKk4EAAmnf21xAgAA X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrILMWRmVeSWpSXmKPExsUiuLphg+6yjOIog9utkhZ7Dh1ltlh2bAeL xfye18wOzB6LV0xh9eie/Y/F4/2+q2wBzFFcNimpOZllqUX6dglcGa8alAu+nWaseD3zP1sD 4/utjF2MnBwSAiYSu26vZgGxhQQOM0o8XSEAYvMKCEr8mHwPLM4sECbx/fs2ti5GLqCar4wS z9t2soEkhAXEJd6d2cQMYrMJKEusmP+BvYuRA6jZRuLbBmuIEnuJTzeWgM1hEVCV+L39GDuI zSlgJ3FpwhlmiPlWEh8+7QOzRQRUJGZPeMAEcU+pxMELK5kg7lSSmP79NtsERv5ZSM6bheS8 WUCbmQXUJaZMyYUIa0s8eXeBFcJWk1j4exETsvgCRrZVjIJFqTmJlUbmeokFBTmpesn5uZsY IQGds4Pxzk2zQ4wCHIxKPLwc0sVRQqyJZcWVuYcYJTiYlUR43+wrihLiTUmsrEotyo8vKs1J LT7EKM3BoiTOm8AAlBJITyxJzU5NLUgtgskycXBKNTB6XnP62VSZz/yXxbdg2RoZw78pthcU Xm7/9H56vFfv3b5FYZbRzH8krPPTV847uFa/9z/X1HVr9Jy9046ddFi6b5r+s5yvJ1r+P4tR O7ZyvZnwJ8Ys79dCibl3Sq5ueBioLiFqqqCqorguRl1xo/H5GLGbOvbvGxvKQl1ip22o8BA+ KZVaka3EUpyRaKjFXFScCADBex7UZAIAAA== X-Content-Filtered-By: Mailman/MimeDel 2.1.23 Subject: Re: Why the DEBUG can't output the full string? X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Feb 2018 19:15:34 -0000 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable > On Feb 1, 2018, at 8:23 AM, Laszlo Ersek wrote: >=20 > On 02/01/18 10:47, krishnaLee wrote: >> Hi, >> For example,the follow code: >> //-code-start >> ConfigRequestHdr =3D HiiConstructConfigHdr (&mBlankDrvFormSetGuid, = VariableName, PrivateData1->DriverHandle[0]); >> Size =3D (StrLen (ConfigRequestHdr) + 32 + 1) * sizeof (CHAR16); >> ConfigRequest =3D AllocateZeroPool (Size); >> ASSERT (ConfigRequest !=3D NULL); >> AllocatedRequest =3D TRUE; >> UnicodeSPrint (ConfigRequest, Size, L"%s&OFFSET=3D0&WIDTH=3D%016LX", = ConfigRequestHdr, (UINT64)BufferSize); >> FreePool (ConfigRequestHdr); >> //-code-end >>=20 >>=20 >> I add a debug message at the end of code: >> DEBUG((EFI_D_INFO,"construct-ConfigRequest:%s",ConfigRequest)); >> DEBUG((EFI_D_INFO,"\r\n")); >>=20 >>=20 >> and the output will be: >> = construct-ConfigRequest:GUID=3Ddb3b005aa15068459170ebd49e16c47c&NAME=3D004= 20044004d0079004900660072004e00560044006100740061&PATH=3D01041400db3b005aa= 15068459170ebd49e16c47c7fff0400&OFFSET=3D0&WIDTH=3D0000000000 >>=20 >>=20 >> If I add another debug message at the end of code: >> DEBUG((EFI_D_INFO,"construct-ConfigRequest:")); >> for(UINTN i=3D0;i> { >> DEBUG((EFI_D_INFO,"%c",ConfigRequest[i])); >> } >> DEBUG((EFI_D_INFO,"\r\n")); >>=20 >>=20 >> and the output will be: >> = construct-ConfigRequest:GUID=3Ddb3b005aa15068459170ebd49e16c47c&NAME=3D004= 20044004d0079004900660072004e00560044006100740061&PATH=3D01041400db3b005aa= 15068459170ebd49e16c47c7fff0400&OFFSET=3D0&WIDTH=3D0000000000000052 = pa=EE=87=A4?=EE=87=A4=EE=87=A4=EE=87=A4=EE=87=A4=EE=87=A4=EE=87=A4=EE=87=A4= =EE=87=A4=EE=87=A4=EE=87=A4=EE=87=A4=EE=87=A4=EE=87=A4=EE=87=A4=EE=87=A4=EE= =87=A4=EE=87=A4=EE=87=A4=EE=87=A4=EE=87=A4=EE=87=A4=EE=87=A4=EE=87=A4=EE=87= =A4=EE=87=A4=EE=87=A4=EE=87=A4=EE=87=A4=EE=87=A4=EE=87=A4=EE=87=A4=EE=87=A4= =EE=87=A4=EE=87=A4=EE=87=A4=EE=87=A4=EE=87=A4=EE=87=A4=EE=87=A4=EE=87=A4=EE= =87=A4=EE=87=A4=EE=87=A4=EE=87=A4=EE=87=A4=EE=87=A4=EE=87=A4=EE=87=A4=EE=87= =A4=EE=87=A4=EE=87=A4=EE=87=A4=EE=87=A4=EE=87=A4=EE=87=A4=EE=87=A4=EE=87=A4= =EE=87=A4=EE=87=A4=EE=87=A4=EE=87=A4=EE=87=A4pr=E2=95=9D <_<_ = =EE=87=A4=EE=87=A4=EE=87=A4=EE=87=A4=EE=87=A4=EE=87=A4=EE=87=A4=EE=87=A4=EE= =87=A4=EE=87=A4=EE=87=A4=EE=87=A4=EE=87=A4=EE=87=A4=EE=87=A4=EE=87=A4=EE=87= =A4=EE=87=A4=EE=87=A4=EE=87=A4=EE=87=A4=EE=87=A4 >>=20 >>=20 >> my platform: >> win10_x64 + udk2017 + vs2015 >=20 > Umm, I'm a bit confused by your query. >=20 > * First, most DebugLib instances have an internal buffer with fixed = size > (for the DebugPrint() function). If you try to log longer messages, = they > will be truncated. >=20 > For example, in "MdePkg/Library/BaseDebugLibSerialPort/DebugLib.c", > there is: >=20 > #define MAX_DEBUG_MESSAGE_LENGTH 0x100 >=20 > (I don't really understand your situation because the first debug > message that you pasted does *not* look truncated.) >=20 WIDTH=3D0000000000 !=3D WIDTH=3D0000000000000052=20 Maybe "%016LX" is a little overkill for a width? Thanks, Andrew Fish >=20 > * Second, regarding the trailing garbage. You set "Size" to the number > of *bytes* required for a NUL-terminated CHAR16 config request string, > plus 32 CHAR16 objects. This is then correctly passed to both > AllocateZeroPool() and UnicodeSPrint(). However, in the loop where you > print individual CHAR16 objects, you also count up to the number of > *bytes* -- that's incorrect, the limit should be the number of CHAR16 > objects (or the NUL-terminator, of course). >=20 > Laszlo > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel =