New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 682777 link

Starred by 17 users

Issue metadata

Status: Assigned
Owner:
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 2
Type: Bug
gdb



Sign in to add a comment

Cannot call any methods from gdb when using gdb_index=true in args.gn

Project Member Reported by szager@chromium.org, Jan 19 2017

Issue description

On my ubuntu workstation, here's my args.gn:

# Build arguments go here. Examples:
#   is_component_build = true
#   is_debug = false
# See "gn args <out_dir> --list" for available build arguments.
is_component_build = true
enable_nacl = false
is_debug = true
use_goma = true
goma_dir = "/usr/local/google/home/szager/chromium/goma"
gdb_index = true


When I run gdb, I'm unable to call any methods.  For example:

(gdb) p &box()
$2 = (blink::LayoutBox *) 0x19605761c260
(gdb) call $2->showLayoutTreeForThis()
Couldn't find method blink::LayoutBox::showLayoutTreeForThis

Same result for any method I try to call.

I tried removing the gdb_index setting and running build/gdb-add-index manually:

[src]$ ./build/gdb-add-index -r out/Debug/content_shell
...
[src]$ ./build/gdb-add-index -f out/Debug/content_shell
...
[src]$


After that, I get a different error from gdb:

(gdb) call box().showLayoutTreeForThis()
Internal: global symbol `blink::DisplayItemClient' found in ../../third_party/WebKit/Source/platform/graphics/paint/PaintChunker.cpp psymtab but not in symtab.
blink::DisplayItemClient may be an inlined function, or may be a template function
	 (if a template, try specifying an instantiation: blink::DisplayItemClient<type>).
(gdb)

 
Cc: atotic@chromium.org
@atotic, since you use gdb_index, do you also see this problem?

Comment 2 by atotic@chromium.org, Jan 19 2017

Yes. My symptoms are the same: symbols do not get resolved when trying to print. 
It has become so annoying, I gave up on gdb_index.

I've spent some time looking at this last week. I believe that bug is related to how gold creates symbol tables. I thought I filed a bug report with gdb, but I 
can't find it right now. And my password reset emails are not getting through...

There is a workaround for the problem. Setting a breakpoint in a constructor of the class whose method you are trying to call suddenly makes gdb load the symbols, and printing works.

For example:
(gdb) p layout_box_->debugName()
Couldn't find debugName.
# set breakpoint, everything magically works:
(gdb) br LayoutObject::LayoutObject
breakpoint 2 set at:.....
(gdb) p layout_box_->debugName()
div (positioned) "div1"

Cc: tmsriram@google.com mcgrathr@google.com
Status: Available (was: Untriaged)
tmsriram@, mcgrathr@, can either of you advise me on how we should follow up on what might be a gold bug or a GDB bug?
Cc: -mcgrathr@google.com mcgrathr@chromium.org
I guess I'd start by reporting it as a gdb bug and mentioning that you don't know if the gdb-index content is correct or not.  The GDB maintainers are the people who know the gdb-index format the best.  build/gdb-add-index uses gdb itself to generate the index.  So what happens in that flow should be entirely in gdb's bailiwick.

Once that's resolved, you can worry about gold's gdb-index generation.  A starting point there is to use (latest binutils) readelf --debug-dump=gdb_index to compare what gold produces to what gdb-add-index produces.
Try use_gdb_fission = false in args.gn?
Sorry, correction to #c6: s/use_gdb_fission/use_debug_fission/.
Cc: wkorman@chromium.org
wkorman@ I remember you encountered a similar issue and fixed it with use_debug_fission=false. Was your issue the same as this bug report?
Yes, this sounds the same, my error was:

(gdb) p showLayerTree(m_box.layer())
Internal: global symbol `blink::DisplayItemClient' found in ../../third_party/WebKit/Source/platform/graphics/paint/PaintChunker.cpp psymtab but not in symtab.
blink::DisplayItemClient may be an inlined function, or may be a template function
         (if a template, try specifying an instantiation: blink::DisplayItemClient<type>).

and adding use_debug_fission = false to my gn args fixed it. Note there is nothing about this on chromium.org, perhaps we should add to a doc page somewhere.
Cc: ruiu@google.com
ruiu, it'd be cool if this worked correctly in lld eventually.
Labels: gdb
Cc: yigu@chromium.org sunxd@chromium.org smcgruer@chromium.org
3 members of our team ran into this issue today (gdb complaining about incomplete type and couldn't find method) in debug builds of Chrome.

As noted above, adding use_debug_fission = false to our gn args fixed it, but this also makes the build a *lot* slower when using goma (I assume goma caching fails? Unsure.).

It looks like the sourceware.org bug has been completely ignored, is there some other way we can escalate this?

It was also very hard to find this thread, not sure if there's anything we can do to easily bump the visibility up in case other developers are having this issue.
Can we set use_debug_fission=false by default when gdb_index=true?
Owner: thakis@chromium.org
It's unclear to me what the right default is here. gdb_index is now controlled just by `is_debug && symbol_level == 2`  and `use_debug_fission == is_debug`.

While I agree that gdb should work by default, I don't know if it's better to turn off gdb index (making startup dramatically slower), or turn off fission (making goma compilation dramatically slower)? I also don't know why goma would be slower, so maybe we can fix that slowdown instead?

thakis@, what do you think we should do here?
There is no answer that provides:
- fast compile/link, 
- fast gdb startup, 
- use of all symbols in gdb.

You can only pick 2 at a time.

A) use_debug_fission == true && gdb_index == true => !use of all symbols in gdb
B) use_debug_fission == false && gdb_index == true => !fast compile/link
C) use_debug_fission == true && gdb_index == false => !fast gdb startup

Each of these is desirable for different debug needs. This is what I prefer:

A) Debugging a crash, need mostly locals
B) & C) are similar, both are much slower than A). Subjectively, I feel that B) cycle is slightly longer than C) was, but since C) is no longer an option, I have not timed it.
It'd be interesting to know what timing difference between B) and C) is.

Comment 16 by cco3@chromium.org, May 26 2017

Cc: cco3@chromium.org
From what I understand, lld links quickly while not using fission, so switching to lld  bug 607968  (you can try use_lld=true locally to give it a try) might resolve this soon.
Heads-up: use_lld doesn't seem to work for me.


"vanilla" doesn't work:

is_component_build = true
use_goma = true

call ShowLayoutObject()
No symbol "ShowLayoutObject" in current context.

=========

disabling fission works:

is_component_build = true
use_goma = true
use_debug_fission = false

call ShowLayoutObject()
LayoutTableSection 0x3e611bc38010      	TBODY

=========

use_lld doesn't work:

is_component_build = true
use_goma = true
use_lld = true

call ShowLayoutObject()
No symbol "ShowLayoutObject" in current context.

Comment 19 by ruiu@google.com, Oct 2 2017

It doesn't work for me even without use_lld=true. What is wrong with my configuration?

ruiu@ruiu2:/ssd/chromium/src$ EDITOR=cat gn args out/pr682777-2
Waiting for editor on "/ssd/chromium/src/out/pr682777-2/args.gn"...
is_component_build = true
use_goma = true
use_debug_fission = false
use_lld = false

Generating files...
Done. Made 7245 targets from 1408 files in 1398ms


ruiu@ruiu2:/ssd/chromium/src$ ninja -C out/pr682777-2 chrome -j 500
ninja: Entering directory `out/pr682777-2'
[1/121] ACTION //components/resources:about_credits(//build/toolchain/linux:clang_x64)


ruiu@ruiu2:/ssd/chromium/src$ gdb out/pr682777-2/chrome -quiet -ex 'call ShowLayoutObject()' -ex quit
Reading symbols from out/pr682777-2/chrome...done.
Unable to determine compiler version.
Skipping loading of libstdc++ pretty-printers for now.
Non-google3 binary detected.
No symbol "ShowLayoutObject" in current context.
Cc: p...@chromium.org
ruiu@, you need to be attached to a renderer process and be suspended in an object derived from LayoutObject

Comment 22 by ruiu@google.com, Oct 3 2017

I'm a noob at Chrome. Could you tell me how to do that?
I was curious about timings of different options, so I ran the experiments. Best setups are:

If you need symbols, compile->gdb takes 49s, use:
use_debug_fission = false, gdb_index = true

If you do not need symbols, compile->gdb takes 36s, use
use_debug_fission = true, gdb_index = true

Raw data:

use_debug_fission = false, gdb_index = true
compile and link 1 blink file: 35s
gdb attach: 14s

use_debug_fission = true, gdb_index = true
compile and link 1 blink file: 22s
gdb attach: 14s

use_debug_fission = true, gdb_index = false
compile and link 1 blink file: 20s
gdb attach: 90s

ruiu: https://www.chromium.org/blink/getting-started-with-blink-debugging#TOC-Starting-the-Debugger

...or open chrome's task manager (launch out/gn/chrome, hit shift-esc), get pid from renderer there, attach to that

atomic: we'll enable lld by default soon, which will change these numbers
Project Member

Comment 25 by bugdroid1@chromium.org, Oct 3 2017

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

commit dd160677bc6cd8a5ab468c187f61902a8fbf4b41
Author: Peter Collingbourne <pcc@chromium.org>
Date: Tue Oct 03 23:15:25 2017

Switch to LLD as the default linker on Linux/x64.

Until recently the main feature that we needed that was not fully
implemented in LLD was --gdb-index; this feature has now been
implemented, so we can start using LLD in more build modes than just
official builds. LLD's implementation of --gdb-index requires all
translation units to be compiled with -ggnu-pubnames, so this patch
does that.

Also enable --gdb-index in official builds; the corrupt debug info
error no longer appears when using LLD.

Perf numbers as follows, median of 10 runs.

Release build (is_debug=false use_goma=true): gold 19.73s, lld 10.22s.
Debug build (is_debug=true use_goma=true): gold 26.27s, lld 18.38s

Bug:  607968 , 682777
Change-Id: Ia63abc15e61d77202d2ca738e6a8bdb0cfe98144
Reviewed-on: https://chromium-review.googlesource.com/698292
Commit-Queue: Peter Collingbourne <pcc@chromium.org>
Reviewed-by: Dirk Pranke <dpranke@chromium.org>
Reviewed-by: Nico Weber <thakis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#506224}
[modify] https://crrev.com/dd160677bc6cd8a5ab468c187f61902a8fbf4b41/build/config/compiler/BUILD.gn
[modify] https://crrev.com/dd160677bc6cd8a5ab468c187f61902a8fbf4b41/build/config/compiler/compiler.gni

Project Member

Comment 26 by bugdroid1@chromium.org, Oct 3 2017

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

commit 6de9affa7a1bef1728d883462f44cbbae5326e6a
Author: Peter Collingbourne <pcc@chromium.org>
Date: Tue Oct 03 23:47:14 2017

Revert "Switch to LLD as the default linker on Linux/x64."

This reverts commit dd160677bc6cd8a5ab468c187f61902a8fbf4b41.

Reason for revert: 

Broke Linux Builder (dbg)
https://build.chromium.org/p/chromium.linux/builders/Linux%20Builder%20%28dbg%29/builds/116417

Original change's description:
> Switch to LLD as the default linker on Linux/x64.
> 
> Until recently the main feature that we needed that was not fully
> implemented in LLD was --gdb-index; this feature has now been
> implemented, so we can start using LLD in more build modes than just
> official builds. LLD's implementation of --gdb-index requires all
> translation units to be compiled with -ggnu-pubnames, so this patch
> does that.
> 
> Also enable --gdb-index in official builds; the corrupt debug info
> error no longer appears when using LLD.
> 
> Perf numbers as follows, median of 10 runs.
> 
> Release build (is_debug=false use_goma=true): gold 19.73s, lld 10.22s.
> Debug build (is_debug=true use_goma=true): gold 26.27s, lld 18.38s
> 
> Bug:  607968 , 682777
> Change-Id: Ia63abc15e61d77202d2ca738e6a8bdb0cfe98144
> Reviewed-on: https://chromium-review.googlesource.com/698292
> Commit-Queue: Peter Collingbourne <pcc@chromium.org>
> Reviewed-by: Dirk Pranke <dpranke@chromium.org>
> Reviewed-by: Nico Weber <thakis@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#506224}

TBR=thakis@chromium.org,dpranke@chromium.org,pcc@chromium.org

Change-Id: Ic10bd05e43be064b66dbb6ef48063689d55dc85a
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug:  607968 , 682777
Reviewed-on: https://chromium-review.googlesource.com/699534
Reviewed-by: Peter Collingbourne <pcc@chromium.org>
Commit-Queue: Peter Collingbourne <pcc@chromium.org>
Cr-Commit-Position: refs/heads/master@{#506231}
[modify] https://crrev.com/6de9affa7a1bef1728d883462f44cbbae5326e6a/build/config/compiler/BUILD.gn
[modify] https://crrev.com/6de9affa7a1bef1728d883462f44cbbae5326e6a/build/config/compiler/compiler.gni

Project Member

Comment 27 by bugdroid1@chromium.org, Oct 4 2017

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

commit 5581f58e288ebc2a6963dd434335d224b8f6297f
Author: Peter Collingbourne <pcc@chromium.org>
Date: Wed Oct 04 05:42:43 2017

Switch to LLD as the default linker on Linux/x64, take 2.

Previous attempt: https://chromium-review.googlesource.com/c/chromium/src/+/698292

This time, the use_lld default uses current_{os,cpu} instead of
target_{os,cpu}, which prevents it from defaulting to true when
targeting NaCl.

Bug:  607968 , 682777
Change-Id: Iedf5b2f9850df249172b7b543af312318e9beae9
Reviewed-on: https://chromium-review.googlesource.com/699741
Commit-Queue: Peter Collingbourne <pcc@chromium.org>
Reviewed-by: Dirk Pranke <dpranke@chromium.org>
Cr-Commit-Position: refs/heads/master@{#506313}
[modify] https://crrev.com/5581f58e288ebc2a6963dd434335d224b8f6297f/build/config/compiler/BUILD.gn
[modify] https://crrev.com/5581f58e288ebc2a6963dd434335d224b8f6297f/build/config/compiler/compiler.gni

Project Member

Comment 28 by bugdroid1@chromium.org, Oct 6 2017

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

commit e684c0cebda9d00d4b5d655920c516f79d857103
Author: Michael Achenbach <machenbach@chromium.org>
Date: Fri Oct 06 18:53:18 2017

Fix compilation with gcc on x64

Bug:  607968 , 682777
Change-Id: Ic8e56551b1691d95a9919bffa24fcf8e5b4d8485
Reviewed-on: https://chromium-review.googlesource.com/704656
Reviewed-by: Sergiy Byelozyorov <sergiyb@chromium.org>
Reviewed-by: Nico Weber <thakis@chromium.org>
Reviewed-by: Dirk Pranke <dpranke@chromium.org>
Commit-Queue: Michael Achenbach <machenbach@chromium.org>
Cr-Commit-Position: refs/heads/master@{#507132}
[modify] https://crrev.com/e684c0cebda9d00d4b5d655920c516f79d857103/build/config/compiler/BUILD.gn

Status: Assigned (was: Available)

Sign in to add a comment