Is there a way to build chromium with -finstrument-functions?

551 views
Skip to first unread message

Honggyu Kim

unread,
Aug 25, 2017, 3:03:26 AM8/25/17
to Chromium-dev
Hi chromium-devs,

I'd like to build chrome with -finstrument-functions to trace its functions using uftrace tool.
What would be the best way to add a new flag to the build script?


I've tried to add it as follows but got some compilation errors even thought it was working fine a few month ago.
```
diff --git a/build/config/compiler/BUILD.gn b/build/config/compiler/BUILD.gn
index 50ee2a6a40da..2f8b732684d6 100644
--- a/build/config/compiler/BUILD.gn
+++ b/build/config/compiler/BUILD.gnt
@@ -133,9 +133,9 @@ config("default_include_dirs") {

 config("compiler") {
   asmflags = []
-  cflags = []
-  cflags_c = []
-  cflags_cc = []
+  cflags = [ "-finstrument-functions" ]
+  cflags_c = [ "-finstrument-functions" ]
+  cflags_cc = [ "-finstrument-functions" ]
   cflags_objc = []
   cflags_objcc = []
   ldflags = []
```
If anyone can add a switch to enable that flag, it would be grateful for me and uftrace users.

Thanks,
Honggyu

Paweł Hajdan, Jr.

unread,
Aug 28, 2017, 9:58:52 PM8/28/17
to hongg...@gmail.com, Chromium-dev
It might help if you posted the specific compilation error with this change.

Paweł

--
--
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 view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/chromium-dev/f0b2d3ce-19b0-4e60-a3ec-edd69c6fb81d%40chromium.org.

Honggyu Kim

unread,
Aug 29, 2017, 4:04:10 AM8/29/17
to Chromium-dev, hongg...@gmail.com
Hi Pawel,

Thanks for your comment. I tried again in another machine and successfully compile it with -finstrument-functions.
Maybe it was some environmental issue.

After compilation, I'm able to run chrome in headless mode as follows:
$ ./chrome --headless --disable-gpu --no-sandbox https://chromium.org

The execution was recorded with uftrace and here is the function trace output:

The thing I'm curious about is why V8 function trace is not shown in this case. Is headless mode different from normal execution sequence?
Please let me know if I'm wrong.

Thanks,
Honggyu

lisaur...@gmail.com

unread,
Nov 16, 2017, 9:54:17 AM11/16/17
to Chromium-dev
Hi,
I am also having touble building chromium  using the ""-finstrument-functions"" flag. I am seeing some strange compiler errors (on clean installations). See https://stackoverflow.com/questions/47262782/building-chromium-ubuntu-linker-error
Any Suggestions?

Egor Pasko

unread,
Nov 16, 2017, 12:08:31 PM11/16/17
to lisaur...@gmail.com, Chromium-dev
Try with these in args.gn:

use_lld = false
is_component_build = false

we regularly build with -finstrument-functions for Android, but I imagine various problems arising from not setting the above flags


--
--
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.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/chromium-dev/2981b54c-aa40-4d88-9198-88c999df2010%40chromium.org.

lisaur...@gmail.com

unread,
Nov 20, 2017, 3:00:29 AM11/20/17
to Chromium-dev, lisaur...@gmail.com, pa...@chromium.org
Thanks. Using

use_lld = false
is_component_build
= false


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

majidp...@gmail.com

unread,
Mar 26, 2018, 7:12:01 PM3/26/18
to Chromium-dev
Hi everybody

I want to build Chromium with -finstrument-functions. I added "-finstrument-functions" to cflags, cflags_c and cflags_cc but I receive error message ([734/30726] CXX obj/components/json_schema/json_schema/json_schema_validator.o     ninja: build stopped: subcommand failed.). Is there any other way to add -finstrument-functions?

Thanks,
Majid

Egor Pasko

unread,
Mar 27, 2018, 10:23:27 AM3/27/18
to majidp...@gmail.com, chromium-dev
On Tue, Mar 27, 2018 at 1:10 AM <majidp...@gmail.com> wrote:
Hi everybody

I want to build Chromium with -finstrument-functions. I added "-finstrument-functions" to cflags, cflags_c and cflags_cc but I receive error message ([734/30726] CXX obj/components/json_schema/json_schema/json_schema_validator.o     ninja: build stopped: subcommand failed.). Is there any other way to add -finstrument-functions?

It is currently not supported on Linux/Android. On Android+Clang we recently switched to -finstrument-function-entry-bare (not supported by GCC) with 'use_order_profiling = true'. If you send a patch to support -finstrument-function-entry-bare on Linux, it will likely be accepted.

--
--
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.
Reply all
Reply to author
Forward
0 new messages