BaseTools: Fix bug about *M value not display decimal and hexadecimal
authorYunhua Feng <yunhuax.feng@intel.com>
Tue, 24 Jul 2018 11:30:11 +0000 (19:30 +0800)
committerYonghong Zhu <yonghong.zhu@intel.com>
Fri, 27 Jul 2018 06:08:49 +0000 (14:08 +0800)
V2: Add the check for Pcd DatumType

report format like as below:
 *M     Shell.inf         = 0xFF (255)

Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yunhua Feng <yunhuax.feng@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
BaseTools/Source/Python/build/BuildReport.py

index 2768001..5709cde 100644 (file)
@@ -1127,7 +1127,13 @@ class PcdReport(object):
                                 for Array in ArrayList:\r
                                     FileWrite(File, Array)\r
                             else:\r
-                                FileWrite(File, ' *M     %-*s = %s' % (self.MaxLen + 15, ModulePath, ModuleDefault.strip()))\r
+                                Value =  ModuleDefault.strip()\r
+                                if Pcd.DatumType in TAB_PCD_CLEAN_NUMERIC_TYPES:\r
+                                    if Value.startswith(('0x', '0X')):\r
+                                        Value = '{} ({:d})'.format(Value, int(Value, 0))\r
+                                    else:\r
+                                        Value = "0x{:X} ({})".format(int(Value, 0), Value)\r
+                                FileWrite(File, ' *M     %-*s = %s' % (self.MaxLen + 15, ModulePath, Value))\r
 \r
         if ModulePcdSet is None:\r
             FileWrite(File, gSectionEnd)\r