XiaoXiangWang / google-toolbox-for-mac

Automatically exported from code.google.com/p/google-toolbox-for-mac
Apache License 2.0
0 stars 0 forks source link

GTMStackTrace addresses do not have 0x prefix #89

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Look at GTMStackTrace output.

What is the expected output? What do you see instead?
The code previously used 0x when printing out the addresses in its stack 
traces.  A recent changed now prints out 00 as a prefix instead.

What version of the product are you using? On what operating system?
Trunk.

Please provide any additional information below.

The stringWithFormat: line in GTMStackTraceFromAddressDescriptors() used to use 
%p to format the pointers.  However, using the "0" modifier to get a fixed 
width is not defined, leading to compiler warnings.  Therefore, the code was 
changed to use a variant of %x.  However the code was changed to be "%0*lX", 
whereas to duplicate %p (but with a fixed width) should have been "%#0*lx" .  
The capital X will cause capital hex digits to be used (whereas %p uses 
lowercase), so using %x instead of %X would seem to be the better replacement.  
More importantly, the new format is missing the # modifier to the %x format, 
meaning there is no 0x prefix, but rather the address is padded with 0s out to 
the full width, and the code comment indicates that it still expects the 0x to 
still be there.

Original issue reported on code.google.com by lindb...@clindberg.org on 2 Nov 2012 at 9:58