This is an archive of the discontinued LLVM Phabricator instance.

[asan] Print SHADOW_SCALE and SHADOW_GRANULARITY as decimal values.
ClosedPublic

Authored by dsanders on Apr 23 2015, 7:32 AM.

Details

Summary

During the review of http://reviews.llvm.org/D9199 where I had originally
changed the debug_mapping.cc test to accept hexadecimal values, we realized
that SHADOW_SCALE and SHADOW_GRANULARITY ought to be printed as decimal values.
This patch makes that change.

This patch also adds a '0x' prefix to the SHADOW_OFFSET to make it clear that
it is hexadecimal while the other two are decimal.

Diff Detail

Event Timeline

dsanders updated this revision to Diff 24304.Apr 23 2015, 7:32 AM
dsanders retitled this revision from to [asan] Print SHADOW_SCALE and SHADOW_GRANULARITY as decimal values..
dsanders updated this object.
dsanders edited the test plan for this revision. (Show Details)
dsanders added reviewers: kcc, timurrrr.
dsanders added subscribers: slthakur, Unknown Object (MLST).
timurrrr edited edge metadata.Apr 23 2015, 7:57 AM

I'd like Kostya to comment first.

lib/asan/asan_rtl.cc
350

please cast to int

test/asan/TestCases/debug_mapping.cc
15

I wonder if the interface function's first parameter type should be changed to int*.

17

ditto

Good point. Timur has asked me to cast to int and is wondering whether the prototype should be changed so I'll wait to see what Kostya says before updating the patch to either cast to int or use '%zd'.

From: mats.o.petersson@googlemail.com [mailto:mats.o.petersson@googlemail.com] On Behalf Of mats petersson
Sent: 23 April 2015 15:41
To: reviews+D9224+public+0db905cdbbbc4cdf@reviews.llvm.org
Cc: Daniel Sanders; kcc@google.com; timurrrr@google.com; llvm-commits@cs.uiuc.edu; Sagar Thakur
Subject: Re: [PATCH] [asan] Print SHADOW_SCALE and SHADOW_GRANULARITY as decimal values.

I think this patch is definitely a positive change.

test/asan/TestCases/debug_mapping.cc
15

I agree that int* would make more sense, but rather not change it now (it's declared in a public header after all). size_t also works, after all.

OK, let's keep the current interface but cast scale/granularity to int when printing.

dsanders updated this revision to Diff 24390.Apr 24 2015, 9:22 AM
dsanders edited edge metadata.

Fix the printf type mismatches by casting to int as discussed.
Add an '0x' prefix to SHADOW_OFFSET to prevent ambiguity with the decimal numbers nearby.

timurrrr accepted this revision.Apr 24 2015, 9:24 AM
timurrrr edited edge metadata.

LGTM

This revision is now accepted and ready to land.Apr 24 2015, 9:24 AM
samsonov accepted this revision.Apr 24 2015, 11:12 AM
samsonov added a reviewer: samsonov.

LGTM

dsanders closed this revision.Apr 25 2015, 4:00 AM