BaseTools: Fix bug about *M value not display decimal and hexadecimal

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>
This commit is contained in:
Yunhua Feng 2018-07-24 19:30:11 +08:00 committed by Yonghong Zhu
parent f413763b6b
commit cef7ecf6cd
1 changed files with 7 additions and 1 deletions

View File

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