Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(360)

Issue 2701253005: Make LoggingTest.CheckCausesDistinctBreakpoints work on clang win (Closed)

Created:
3 years, 10 months ago by scottmg
Modified:
3 years, 10 months ago
CC:
chromium-reviews, vmpstr+watch_chromium.org, Will Harris, Reid Kleckner
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Make LoggingTest.CheckCausesDistinctBreakpoints work on clang win Clang coalesces the int3s of the simple implementation of CHECK as __debugbreak(). To avoid this, add an additional null deref following the __debugbreak() when __clang__ to uniquify crash locations. R=thakis@chromium.org BUG=693713 Review-Url: https://codereview.chromium.org/2701253005 Cr-Commit-Position: refs/heads/master@{#451660} Committed: https://chromium.googlesource.com/chromium/src/+/92bbdc39154ce7cbbc939d9a4c5ee371691ab811

Patch Set 1 #

Total comments: 1
Unified diffs Side-by-side diffs Delta from patch set Stats (+16 lines, -0 lines) Patch
M base/logging.h View 1 chunk +16 lines, -0 lines 1 comment Download

Messages

Total messages: 22 (10 generated)
scottmg
3 years, 10 months ago (2017-02-20 18:55:57 UTC) #5
Nico
lgtm Which intrinsics do you want us to add?
3 years, 10 months ago (2017-02-20 19:04:21 UTC) #7
scottmg
On 2017/02/20 19:04:21, Nico wrote: > lgtm > > Which intrinsics do you want us ...
3 years, 10 months ago (2017-02-20 19:48:37 UTC) #8
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2701253005/1
3 years, 10 months ago (2017-02-20 19:49:42 UTC) #11
commit-bot: I haz the power
Committed patchset #1 (id:1) as https://chromium.googlesource.com/chromium/src/+/92bbdc39154ce7cbbc939d9a4c5ee371691ab811
3 years, 10 months ago (2017-02-20 21:07:10 UTC) #14
shinyak (Google)
Hi, this patch looks causing win-clang compile failure E:\b\c\b\win_clang\src\third_party\WebKit\Source\core\style\BasicShapes.h(186,1): error: implicit conversion from 'int' to ...
3 years, 10 months ago (2017-02-21 02:19:22 UTC) #15
shinyak
Making a fix here https://codereview.chromium.org/2706143002
3 years, 10 months ago (2017-02-21 02:27:51 UTC) #16
Primiano Tucci (use gerrit)
https://codereview.chromium.org/2701253005/diff/1/base/logging.h File base/logging.h (right): https://codereview.chromium.org/2701253005/diff/1/base/logging.h#newcode515 base/logging.h:515: (void)(*reinterpret_cast<volatile unsigned char*>(0) = __COUNTER__)) I arrived late on ...
3 years, 10 months ago (2017-02-21 11:02:07 UTC) #18
scottmg
On 2017/02/21 11:02:07, Primiano Tucci wrote: > https://codereview.chromium.org/2701253005/diff/1/base/logging.h > File base/logging.h (right): > > https://codereview.chromium.org/2701253005/diff/1/base/logging.h#newcode515 ...
3 years, 10 months ago (2017-02-21 16:42:10 UTC) #19
Nico
On Tue, Feb 21, 2017 at 11:42 AM, <scottmg@chromium.org> wrote: > On 2017/02/21 11:02:07, Primiano ...
3 years, 10 months ago (2017-02-21 16:43:43 UTC) #20
scottmg
On 2017/02/21 16:43:43, Nico wrote: > On Tue, Feb 21, 2017 at 11:42 AM, <mailto:scottmg@chromium.org> ...
3 years, 10 months ago (2017-02-21 17:13:41 UTC) #21
scottmg
3 years, 10 months ago (2017-02-21 17:22:42 UTC) #22
Message was sent while issue was closed.
On 2017/02/21 17:13:41, scottmg wrote:
> On 2017/02/21 16:43:43, Nico wrote:
> > On Tue, Feb 21, 2017 at 11:42 AM, <mailto:scottmg@chromium.org> wrote:
> > 
> > > On 2017/02/21 11:02:07, Primiano Tucci wrote:
> > > > https://codereview.chromium.org/2701253005/diff/1/base/logging.h
> > > > File base/logging.h (right):
> > > >
> > > > https://codereview.chromium.org/2701253005/diff/1/base/
> > > logging.h#newcode515
> > > > base/logging.h:515: (void)(*reinterpret_cast<volatile unsigned
> > > char*>(0) =
> > > > __COUNTER__))
> > > > I arrived late on this. I had the same exact problem on Android.
> > > >
> > > > Assuming that:
> > > > 1. my https://codereview.chromium.org/2705053002 sticks
> > > > 2. clang on windows supports statement expressions like it does on Linux
> > > >
> > > > I think you can just reuse my
> > > > #define TRAP_SEQUENCE()
> > > > asm volatile("int3; ud2; push %0;" ::"i"(static_cast<unsigned
> > > > char>(__COUNTER__)))
> > > >
> > >
> > > Thanks. MSVC cl doesn't support inline asm
> > >
> > 
> > It does, just using __asm {} instead of asm() (at least on 32-bit).
> 
> Sorry, yeah, I meant x64 (we were discussing in email and I forgot that
context
> here).
> 
> > 
> > 
> > > , so clang-cl doesn't either
> > >
> > 
> > It does, even on 64-bit, but using __asm {} instead of asm() (not sure if
> > that helps here)
> 
> Huh, oops. I did try it, honest. The error looked like "i don't understand
> __asm", but I must have screwed up in the logging macro expansions.

(I realized what I did wrong, I used ; to separate instructions, where the
required separator is "__asm" in macros. Doh!)

> 
> OK, so ... we can't collapse the implementations (because of asm"" vs.
__asm{}),
> and I don't think clang-cl enables statement expressions (?). So we'd end up
> with the same number of #ifs I think.
> 
> But we can emit shorter code for clang-cl's arm of the #ifs. I can do that.
> 
> > 
> > 
> > > , so we're
> > > limited to C and intrinsics. I was hopeful that an `in` (via __inbyte())
> > > would
> > > be a relatively short way to crash, but it's good to have your code length
> > > as a
> > > benchmark in any case.
> > >
> > > > Rationale:
> > > > 1) It takes 4 bytes instead of 8
> > > > int3 is 1 byte long
> > > > ud2 is 1 byte long
> > > > push byte immediate: is 2 bytes long
> > > >
> > > > while *nullptr = __COUNTER__ is 8 bytes long. From objdump:
> > > > 1: c6 04 25 00 00 00 00 movb $0x0,0x0
> > > > 8: 00
> > > >
> > > > 2) We can reduce the number of different black magics on logging.h. My
> > > > TRAP_SRQUENCE there is just few lines above. I think you can just nicely
> > > > re-route the #ifdefs there.
> > >
> > >
> > >
> > > https://codereview.chromium.org/2701253005/
> > >
> > 
> > -- 
> > You received this message because you are subscribed to the Google Groups
> > "Chromium-reviews" group.
> > To unsubscribe from this group and stop receiving emails from it, send an
> email
> > to mailto:chromium-reviews+unsubscribe@chromium.org.

Powered by Google App Engine
This is Rietveld 408576698