gdb symbols for chromeos-chrome?

460 views
Skip to first unread message

Steven Bennetts

unread,
Dec 21, 2010, 8:36:24 PM12/21/10
to Chromium OS dev
I am attempting to debug chrome built under the chroot, but when I attempt to load symbols from the executable, I get the message 'no debugging symbols found'.

I am running a dev server to build chrome in the chroot with:

~/chromiumos/src/scripts $ ./enter_chroot.sh --chrome_root=/home/stevenjb/chromium --chrome_root_mount=/tmp/chrome_root
~/trunk/src/scripts $ BUILDTYPE=Debug ECHROME_STORE_DIR=/tmp/chrome_root CHROME_ROOT=/tmp/chrome_root CHROME_ORIGIN=LOCAL_SOURCE USE="-build_tests" ./start_devserver

On the device I run:

~ $ sudo gmerge chromeos-chrome
~ $ gdbserver HOST:1234 /opt/google/chrome/chrome --enable-gview --log-level=0 --enable-logging=stderr --no-first-run --in-chrome-auth --enable-login-images --enable-tabbed-options --scroll-pixels=4 --user-data-dir=/home/chronos --login-profile=user --login-user=stev...@google.com --single-process

In another chroot I run:
/tmp/chrome_root/src $ /usr/bin/i686-pc-linux-gnu-gdb
with the following in the .gdbinit file:

set solib-absolute-prefix /build/x86-agz
file /build/x86-agz/opt/google/chrome/chrome
target remote 172.31.130.201:1234

Running gdb gets:

GNU gdb (Gentoo 7.1 p1) 7.1
Copyright (C) 2010 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 "--host=x86_64-pc-linux-gnu --target=i686-pc-linux-gnu".
For bug reporting instructions, please see:
warning: Can not parse XML target description; XML support was disabled at compile time
0x71e5f9c0 in ?? () from /build/x86-agz/lib/ld-linux.so.2
(gdb) symbol-file /build/x86-agz/opt/google/chrome/chrome
Reading symbols from /build/x86-agz/opt/google/chrome/chrome...(no debugging symbols found)...done.
(gdb) 

I can run chrome from gdb, but I am not getting any symbols for chrome. It seems like the emerge is stripping everything? Is there an easy way to prevent that?

Thanks,
-Steven

Albert J. Wong (王重傑)

unread,
Dec 21, 2010, 8:45:05 PM12/21/10
to Steven Bennetts, Chromium OS dev
Are you sure the symbol file is /build/x86-agz/opt/google/chrome/chrome and not /build/x86-agz/usr/lib/debug/opt/google/chrome/chrome?

-Albert

--
Chromium OS Developers mailing list: chromiu...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-os-dev?hl=en

Albert J. Wong (王重傑)

unread,
Dec 21, 2010, 8:45:59 PM12/21/10
to Steven Bennetts, Chromium OS dev
errr... I meant:

  /build/x86-agz/usr/lib/debug/opt/google/chrome/chrome.debug

The ebuild process seems to strip out the debug symbols into a separate file under /usr/lib/debug/

-Albert

Daniel Erat

unread,
Dec 21, 2010, 10:28:51 PM12/21/10
to Steven Bennetts, Chromium OS dev
On Tue, Dec 21, 2010 at 5:36 PM, Steven Bennetts <stev...@google.com> wrote:
[snip]

> (gdb) symbol-file /build/x86-agz/opt/google/chrome/chrome
> Reading symbols from /build/x86-agz/opt/google/chrome/chrome...(no debugging
> symbols found)...done.
> (gdb)
> I can run chrome from gdb, but I am not getting any symbols for chrome. It
> seems like the emerge is stripping everything? Is there an easy way to
> prevent that?

(Just posting this in case what Albert recommends doesn't help; I
always do release builds, so I'm not sure if there are changes to what
gets stripped when you do a debug build.)

If the KEEP_CHROME_DEBUG_SYMBOLS environment variable is nonempty, the
chromeos-chrome ebuild will run the strip command with "--strip-debug
--keep-file-symbols" instead of "--strip-unneeded". Note that despite
the variable name, you still won't have full debug symbols, but you
should at least get file and function names in backtraces (and you can
always mess with the arguments provided by KEEP_CHROME_DEBUG_SYMBOLS
if needed).

Kenneth Waters

unread,
Dec 22, 2010, 5:13:56 PM12/22/10
to Daniel Erat, Steven Bennetts, Chromium OS dev
I was doing this a few weeks ago, back when Chrome was building for
stabs, so some of the CFLAGS changes might not apply. I build chrome
with splitdebug instead of no strip, that way I don't have to transfer
1GiB of symbols over to the device. I also use noclean so gdb can
find the sources.

REMOVE_WEBCORE_DEBUG_SYMBOLS=0 BUILDTYPE=Debug
FEATURES="-usersandbox noclean splitdebug" CFLAGS="-O0 -pipe
-march=atom -mtune=atom -mfpmath=sse -I/build/x86-generic/usr/include/
-I/build/x86-generic/include/ -g" CHROME_ORIGIN=LOCAL_SOURCE
CXXFLAGS="$CFLAGS" USE="-build_tests -autotest gold"
emerge-x86-generic -1 chromeos-chrome

Then you need to do some voodoo when you start gdb, so it knows where
to find all your libraries and splitdebug files,

(gdb) set sysroot /build/x86-generic
(gdb) set debug-file-directory /build/x86-generic/usr/lib/debug
(gdb) file /build/x86-generic/opt/google/chrome/chrome
(gdb) target remote 172.22.75.80:1234

-- Kenneth Waters

Steven Bennetts

unread,
Dec 23, 2010, 2:39:36 PM12/23/10
to Kenneth Waters, Daniel Erat, Chromium OS dev
Thanks for all the info!

OK, so after some experimenting, here is the issue:

'sudo gmerge chromeos-chrome' removes /build/x86-agz/usr/lib/debug/opt/google/chrome/chrome.debug from the dev machine.
I tried passing --fetchonly to gmerge, but that didn't make any difference.

So, what I ended up doing was:
* Use start_devserver + gmerge to get chromeos-chrome on the device
* Run emerge-x86-agz in the chroot to rebuild chrome.debug
* Run gdbserver + /usr/bin/i686-pc-linux-gnu-gdb from the chroot with the following in the .gdbinit file:
set solib-absolute-prefix /build/x86-agz
file /build/x86-agz/opt/google/chrome/chrome
symbol-file /build/x86-agz/usr/lib/debug/opt/google/chrome/chrome.debug
target remote 172.31.130.201:1234

Does anyone know why gmerge / start_devserver is removing chrome.debug, and how to prevent that?

Cheers,
-Steven

Mandeep Singh Baines

unread,
Dec 23, 2010, 4:44:30 PM12/23/10
to Steven Bennetts, Kenneth Waters, Daniel Erat, Chromium OS dev
Steven Bennetts (stev...@google.com) wrote:
> Thanks for all the info!
>
> OK, so after some experimenting, here is the issue:
>
> 'sudo gmerge chromeos-chrome' removes
> /build/x86-agz/usr/lib/debug/opt/google/chrome/chrome.debug from the dev
> machine.
> I tried passing --fetchonly to gmerge, but that didn't make any difference.
>
> So, what I ended up doing was:
> * Use start_devserver + gmerge to get chromeos-chrome on the device
> * Run emerge-x86-agz in the chroot to rebuild chrome.debug
> * Run gdbserver + /usr/bin/i686-pc-linux-gnu-gdb from the chroot with the
> following in the .gdbinit file:
>
> set solib-absolute-prefix /build/x86-agz
> file /build/x86-agz/opt/google/chrome/chrome
> symbol-file /build/x86-agz/usr/lib/debug/opt/google/chrome/chrome.debug
> target remote 172.31.130.201:1234
>
>
> Does anyone know why gmerge / start_devserver is removing chrome.debug, and
> how to prevent that?
>

I suspect that its due to the INSTALL_MASK. You might be able to over-ride:

sudo INSTALL_MASK="" gmerge chromeos-chrome

> Cheers,
> -Steven
>
>
> On Wed, Dec 22, 2010 at 2:13 PM, Kenneth Waters <kwa...@chromium.org>wrote:
>
> > I was doing this a few weeks ago, back when Chrome was building for
> > stabs, so some of the CFLAGS changes might not apply. I build chrome
> > with splitdebug instead of no strip, that way I don't have to transfer
> > 1GiB of symbols over to the device. I also use noclean so gdb can
> > find the sources.
> >
> > REMOVE_WEBCORE_DEBUG_SYMBOLS=0 BUILDTYPE=Debug
> > FEATURES="-usersandbox noclean splitdebug" CFLAGS="-O0 -pipe
> > -march=atom -mtune=atom -mfpmath=sse -I/build/x86-generic/usr/include/
> > -I/build/x86-generic/include/ -g" CHROME_ORIGIN=LOCAL_SOURCE
> > CXXFLAGS="$CFLAGS" USE="-build_tests -autotest gold"
> > emerge-x86-generic -1 chromeos-chrome
> >
> > Then you need to do some voodoo when you start gdb, so it knows where
> > to find all your libraries and splitdebug files,
> >
> > (gdb) set sysroot /build/x86-generic
> > (gdb) set debug-file-directory /build/x86-generic/usr/lib/debug
> > (gdb) file /build/x86-generic/opt/google/chrome/chrome
> > (gdb) target remote 172.22.75.80:1234
> >
> > -- Kenneth Waters
> >
>

Chris Masone

unread,
Dec 23, 2010, 6:57:50 PM12/23/10
to Steven Bennetts, Chromium OS dev, Daniel Erat, Kenneth Waters

We use INSTALL_MASK to mask it out, and it's because the rootfs isn't big enough to hold all the debug symbols.

Steven Bennetts

unread,
Dec 28, 2010, 7:57:06 PM12/28/10
to Chris Masone, Chromium OS dev, Daniel Erat, Kenneth Waters
'sudo INSTALL_MASK="" gmerge chromeos-chrome' either still deletes or doesn't create  /build/x86-agz/usr/lib/debug/opt/google/chrome/chrome.debug in the chroot on the dev machine.

I don't want chrome.debug on the device; I just want it to stick around in the chroot on my dev machine.

I'm finding myself doing:
(chroot) ~/trunk/src/scripts $ BUILDTYPE=Debug CHROME_ORIGIN=LOCAL_SOURCE ./start_devserver
(device) $ sudo gmerge chromeos-chrome
(chroot) ~/trunk/src/scripts $ BUILDTYPE=Debug CHROME_ORIGIN=LOCAL_SOURCE emerge-x86-agz chromeos-chrome

Any time I want to gdb chrome:

(device) $ gdbserver HOST:1234 /opt/google/chrome/chrome
(chroot) /tmp/chrome_root/src $ /usr/bin/i686-pc-linux-gnu-gdb

Running emerge from the chroot after gmerge on the device is rather inefficient... any other suggestions?

Thanks!
-Steven
Reply all
Reply to author
Forward
This conversation is locked
You cannot reply and perform actions on locked conversations.
0 new messages