Issue with gdb and urls

82 views
Skip to first unread message

Camille Lamy

unread,
Jul 26, 2017, 7:54:45 AM7/26/17
to chromium-dev, ahe...@chromium.org
Hi fellow Chromites,

Since a few weeks, several of my team members and I have been unable to read the spec value of URLs in gdb on Linux. Instead of the string value we get an incomplete type message. Is this happening to other people, and is there a known way to make it work again?

Thanks!
Camille

Julien Brianceau (jbriance)

unread,
Jul 26, 2017, 8:53:08 AM7/26/17
to cl...@chromium.org, chromium-dev, ahe...@chromium.org

Hi,

 

I don’t know what changed, but you might workaround this by using the c_str() method.

For instance :

 

$ gdb --args url_unittests --single-process-tests --gtest_filter=GURLTest.Components

GNU gdb (Ubuntu 7.7.1-0ubuntu5~14.04.2) 7.7.1

Copyright (C) 2014 Free Software Foundation, Inc.

License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>

This is free software: you are free to change and redistribute it.

There is NO WARRANTY, to the extent permitted by law.  Type "show copying"

and "show warranty" for details.

This GDB was configured as "x86_64-linux-gnu".

Type "show configuration" for configuration details.

For bug reporting instructions, please see:

<http://www.gnu.org/software/gdb/bugs/>.

Find the GDB manual and other documentation resources online at:

<http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".

Type "apropos word" to search for commands related to "word"...

Reading symbols from ../build-master-dbg/url_unittests...done.

(gdb) b GURL::spec

Breakpoint 1 at 0x7148c6: file ../src/url/gurl.cc, line 207.

(gdb) r

Starting program: /var/local/jbriance/host-chromium/build-master-dbg/url_unittests --single-process-tests --gtest_filter=GURLTest.Components

[Thread debugging using libthread_db enabled]

Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

Debugger detected, switching to single process mode.

Pass --test-launcher-debug-launcher to debug the launcher itself.

Detected presence of a debugger, running without test timeouts.

Note: Google Test filter = GURLTest.Components

[==========] Running 1 test from 1 test case.

[----------] Global test environment set-up.

[----------] 1 test from GURLTest

[ RUN      ] GURLTest.Components

 

Breakpoint 1, GURL::spec (this=0x7fffffffd5f0) at ../src/url/gurl.cc:207

207       if (is_valid_ || spec_.empty())

(gdb) print spec_

$1 = <incomplete type>

(gdb) print spec_.c_str()

$2 = (const std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::value_type *) 0xd0856e4eea0 "http://user:pa...@google.com:99/foo;bar?q=a#ref"

(gdb)

 

 

I hope this is what you were looking for :)

 

Julien

 

--
--
Chromium Developers mailing list: chromi...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-dev
---
You received this message because you are subscribed to the Google Groups "Chromium-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-dev...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/chromium-dev/CAMKsNvrc9OW2UF%3Dc24Cwmby_Y%2B9_sWUJ0rF8Xrh-F%3DzDd9Ei7Q%40mail.gmail.com.

Arthur Hemery

unread,
Jul 26, 2017, 9:41:10 AM7/26/17
to Julien Brianceau (jbriance), cl...@chromium.org, chromium-dev, ahe...@chromium.org
Hi Julien,

I very often get hangs that requires SIGKILLing gdb when using such methods, as below for a GURL example :

(gdb) print url.GetString()
Couldn't find method GURL::GetString
(gdb) print url.spec()     
$3 = (const std::__1::string &) @0x7fffc013cef0: <incomplete type>
(gdb) print url.spec().c_str()
^C
^\
Killed

Any idea why that would be happening ?


To unsubscribe from this group and stop receiving emails from it, send an email to chromium-dev+unsubscribe@chromium.org.

Julien Brianceau (jbriance)

unread,
Jul 26, 2017, 10:01:11 AM7/26/17
to Arthur Hemery, cl...@chromium.org, chromium-dev, ahe...@chromium.org

Hi,

 

No, I’ve no idea why this hangs, but to be honest it is also quite slow for me to show the result of c_str() : around 5 seconds and I’m running gdb on a huge compilation server.

 

Another workaround which is quick & dirty, but should help avoiding the hang issue you face :

 

Breakpoint 1, GURL::spec (this=0x7fffffffd5f0) at ../src/url/gurl.cc:207

207       if (is_valid_ || spec_.empty())

(gdb) print spec_

$1 = <incomplete type>

(gdb) p *(char**) ((int*) &spec_+4)

$2 = 0x91236c98ea0 "http://user:pa...@google.com:99/foo;bar?q=a#ref"

 

Please note that the +4 that I use here depends on your architecture and toolchain, so you might have to test other values to find the right one for you.

 

Julien

 

To unsubscribe from this group and stop receiving emails from it, send an email to chromium-dev...@chromium.org.

Julien Brianceau (jbriance)

unread,
Jul 26, 2017, 10:53:37 AM7/26/17
to Arthur Hemery, cl...@chromium.org, chromium-dev, ahe...@chromium.org

Hi again,

 

After looking a bit more into this, this seems to be related to inlined namespace.

Here’s something that works for me :

 

  207       if (is_valid_ || spec_.empty())

  (gdb) p spec_

  $1 = <incomplete type>

  (gdb) ptype std::__1::string

  type = class std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > {

     <incomplete type>

  }

  (gdb) p spec_

  $2 = {<std::__1::__basic_string_common<true>> = {<No data fields>},

   __r_ = {<std::__1::__compressed_pair_elem<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::__rep, 0, false>> = {__value_ = {{__l = {__cap_ = 65, __size_ = 46,

              __data_ = 0x3a03ecf19ea0 "http://user:pa...@google.com:99/foo;bar?q=a#ref"}, __s = {{__size_ = 65 'A', __lx = 65 'A'},

              __data_ = "\000\000\000\000\000\000\000.\000\000\000\000\000\000\000\240\236\361\354\003:\000"}, __r = {__words = {65, 46,

                63788534570656}}}}}, <std::__1::__compressed_pair_elem<std::__1::allocator<char>, 1, true>> = {<std::__1::allocator<char>> = {<No data fields>}, <No data fields>}, <No data fields>},

   static npos = 18446744073709551615}

  (gdb)

 

 

Julien

Julien Brianceau (jbriance)

unread,
Jul 29, 2017, 10:50:58 AM7/29/17
to Arthur Hemery, cl...@chromium.org, chromium-dev, ahe...@chromium.org

Hi again,

 

Adding the following GN arg solves the issue in my env :

 

use_custom_libcxx = false

 

When building url_unittests with this arg, I now have :

 

$ gdb --args url_unittests --single-process-tests --gtest_filter=GURLTest.Components

[...]

(gdb) b GURL::spec

Breakpoint 1 at 0x57ae96: file ../src/url/gurl.cc, line 207.

(gdb) r

[...]

Breakpoint 1, GURL::spec (this=0x7fffffffd870) at ../src/url/gurl.cc:207

207       if (is_valid_ || spec_.empty())

(gdb) p spec_

$1 = "http://user:pa...@google.com:99/foo;bar?q=a#ref"

(gdb)

 

So to me, the issue is coming from a mixup between libstdc++ and libc++, but I’m not familiar enough with those to be able to fully understand the problem.

 

According to git log, thomasanderson@ and thakis@ recently pushed changes about this GN arg. Maybe you can ask them if they have more insight into this,

Nico Weber

unread,
Jul 29, 2017, 12:37:56 PM7/29/17
to jbri...@cisco.com, Arthur Hemery, cl...@chromium.org, chromium-dev, ahe...@chromium.org
On Sat, Jul 29, 2017 at 10:49 AM, Julien Brianceau (jbriance) <jbri...@cisco.com> wrote:

Hi again,

 

Adding the following GN arg solves the issue in my env :

 

use_custom_libcxx = false


If you set this, your build will likely break tomorrow.

I think your problem might be https://bugs.chromium.org/p/chromium/issues/detail?id=682777, see there (especially comment 17) for suggestions.
 

To unsubscribe from this group and stop receiving emails from it, send an email to chromium-dev+unsubscribe@chromium.org.

--
--
Chromium Developers mailing list: chromi...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-dev
---
You received this message because you are subscribed to the Google Groups "Chromium-dev" group.

To unsubscribe from this group and stop receiving emails from it, send an email to chromium-dev+unsubscribe@chromium.org.

--
--
Chromium Developers mailing list: chromi...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-dev
---
You received this message because you are subscribed to the Google Groups "Chromium-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-dev+unsubscribe@chromium.org.

--
--
Chromium Developers mailing list: chromi...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-dev
---
You received this message because you are subscribed to the Google Groups "Chromium-dev" group.
Reply all
Reply to author
Forward
0 new messages