New issue
Advanced search Search tips

Issue 598176 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: Jan 2017
Cc:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug

Blocking:
issue 578344



Sign in to add a comment

rewrite_to_chrome_style: Not rewriting some WTF::String debugging helpers

Project Member Reported by dcheng@chromium.org, Mar 26 2016

Issue description

Not sure what's going on: NDEBUG should be defined (since the header is getting rewritten, but WTFString.cpp is not:

Example patch needed to make things compile:
diff --git a/third_party/WebKit/Source/wtf/text/WTFString.cpp b/third_party/WebKit/Source/wtf/text/WTFString.cpp
index e9dc7ba..35fd53f 100644
--- a/third_party/WebKit/Source/wtf/text/WTFString.cpp
+++ b/third_party/WebKit/Source/wtf/text/WTFString.cpp
@@ -1249,7 +1249,7 @@ String* string(const char*);
 Vector<char> asciiDebug(StringImpl*);
 Vector<char> asciiDebug(String&);
 
-void String::show() const
+void String::Show() const
 {
     DataLogF("%s\n", asciiDebug(Impl()).Data());
 }
 
Cc: lukasza@chromium.org
FWIW, I still see String::show() (lowercase method name) after running the latest revision of the rename tool, but third_party/WebKit/Source/wtf:wtf_unittests target compiles fine.

Let me note that String::show() definition appears within #ifndef NDEBUG.  So maybe this is a case of running the tool against one set of args.gn and trying to build against a different set of args.gn?

Comment 2 by nasko@chromium.org, Jan 6 2017

This method is still not properly handled as of the Jan 5th 2017 version of the tool.

Comment 3 by danakj@chromium.org, Jan 16 2017

There's a bunch of things in WTFString.cpp that don't get rewritten.. but they are not inside the WTF namespace for some reason. They must not get used at all to even compile (away)?

}  // namespace WTF

#ifndef NDEBUG
// For use in the debugger
String* string(const char*);
Vector<char> asciiDebug(StringImpl*);
Vector<char> asciiDebug(String&);

void String::show() const {
  DataLogF("%s\n", asciiDebug(Impl()).Data());
}

Comment 4 by danakj@chromium.org, Jan 16 2017

http://blink-dev.chromium.narkive.com/woFWA7zx/displaying-a-wtf-string-in-gdb complains of this crashing. Hm.

It was added in 5049b1e6bd23b7251c57c737c62a2e3e9ad47021 by rniwa and the impl was outside of the WTF namespace since then.

Comment 5 by danakj@chromium.org, Jan 16 2017

It looks like an oversight to me. The AtomicString one was added at the same time, and it's in WTF. The WTFString one was put lower to make use of some file-static methods that live outside of WTF. We should just put them in anonymous namespace and move show into WTF namespace.

Which brings to mind we are ignoring anon namespace stuff then?

Comment 6 by dcheng@chromium.org, Jan 16 2017

We shouldn't be, as long as it's nested inside a top-level blink or wtf namespace.

Comment 7 by danakj@chromium.org, Jan 16 2017

The helper string() method comes from 937b4ab3e082405efafd01e49da1e1001f32f425 and it just calls a constructor. You can do that from gdb directly if you really want to, looks like it should go.

The asciiDebug method is called from String::show() so no need to expose it to gdb, just call show().

Comment 8 by danakj@chromium.org, Jan 16 2017

The show method is handled right after https://codereview.chromium.org/2636083002/

Comment 9 by danakj@chromium.org, Jan 16 2017

Owner: danakj@chromium.org
Status: Started (was: Available)
Project Member

Comment 10 by bugdroid1@chromium.org, Jan 17 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/a2377c097a1fa051f90f9c02d96d010073fcb701

commit a2377c097a1fa051f90f9c02d96d010073fcb701
Author: danakj <danakj@chromium.org>
Date: Tue Jan 17 01:21:55 2017

WTF: Put String::show()'s definition into the WTF namespace.

The rename tool doesn't see it otherwise. Also cleanup a bit and drop
some old functions in here meant to be called from gdb, and move the
asciiDebug helper into an anonymous namespace inside WTF so that the
rename tool also renames it.

BUG= 598176 

Review-Url: https://codereview.chromium.org/2636083002
Cr-Commit-Position: refs/heads/master@{#443964}

[modify] https://crrev.com/a2377c097a1fa051f90f9c02d96d010073fcb701/third_party/WebKit/Source/wtf/text/WTFString.cpp
[modify] https://crrev.com/a2377c097a1fa051f90f9c02d96d010073fcb701/third_party/WebKit/Source/wtf/text/WTFString.h

Status: Fixed (was: Started)

Sign in to add a comment