[RFC] The -Og debugging experience

From: Jiri Olsa
Date: Wed Dec 02 2015 - 11:48:34 EST


heya,
using the -Og for DEBUG=1 builds gives me many 'optimized out' stuff

It was introduced in here:
e8b7ea4356fd perf tools: Improve setting of gcc debug option

- here's backtrace from segfault I was looking at, current code:

(gdb) bt
#0 0x00000000004b490f in parse_events__scan_string (yystr=yystr@entry=0x0, yyscanner=0x1916be0) at util/parse-events-flex.c:3353
#1 0x000000000048fe6f in parse_events__scanner (str=0x0, data=data@entry=0x7fffffffdac0, start_token=start_token@entry=258)
at util/parse-events.c:1356
#2 0x0000000000491775 in parse_events (evlist=evlist@entry=0x1917c90, str=<optimized out>, err=err@entry=0x0) at util/parse-events.c:1401
#3 0x0000000000468bf6 in __perf_evsel__name_array_test (names=0x872c00 <perf_evsel.sw_names>, nr_names=nr_names@entry=11)
at tests/evsel-roundtrip-name.c:74
#4 0x0000000000468f13 in test__perf_evsel__roundtrip_name_test (subtest=<optimized out>) at tests/evsel-roundtrip-name.c:106
#5 0x000000000045a2c8 in run_test (test=test@entry=0x86fe50 <generic_tests+400>, subtest=subtest@entry=-1) at tests/builtin-test.c:241
#6 0x000000000045a3a1 in test_and_print (t=t@entry=0x86fe50 <generic_tests+400>, force_skip=force_skip@entry=false,
subtest=subtest@entry=-1) at tests/builtin-test.c:268
#7 0x000000000045a5cd in __cmd_test (argc=argc@entry=1, argv=argv@entry=0x7fffffffe200, skiplist=0x0) at tests/builtin-test.c:324
#8 0x000000000045a8a9 in cmd_test (argc=1, argv=0x7fffffffe200, prefix=<optimized out>) at tests/builtin-test.c:416
#9 0x00000000004784a9 in run_builtin (p=p@entry=0x871e18 <commands+504>, argc=argc@entry=2, argv=argv@entry=0x7fffffffe200) at perf.c:387
#10 0x00000000004786a4 in handle_internal_command (argc=2, argv=0x7fffffffe200) at perf.c:448
#11 0x0000000000478710 in run_argv (argcp=argcp@entry=0x7fffffffe06c, argv=argv@entry=0x7fffffffe060) at perf.c:492
#12 0x0000000000478981 in main (argc=2, argv=0x7fffffffe200) at perf.c:609


- and same crash with above patch reverted:

(gdb) bt
#0 0x00007ffff573f36a in strlen () from /lib64/libc.so.6
#1 0x00000000004f458b in parse_events__scan_string (yystr=0x0, yyscanner=0x1985be0) at util/parse-events-flex.c:3353
#2 0x00000000004bc752 in parse_events__scanner (str=0x0, data=0x7fffffffda50, start_token=258) at util/parse-events.c:1356
#3 0x00000000004bc8e2 in parse_events (evlist=0x1986c90, str=0x0, err=0x0) at util/parse-events.c:1401
#4 0x00000000004837c4 in __perf_evsel__name_array_test (names=0x8e1140 <perf_evsel.sw_names>, nr_names=11)
at tests/evsel-roundtrip-name.c:74
#5 0x0000000000483969 in test__perf_evsel__roundtrip_name_test (subtest=-1) at tests/evsel-roundtrip-name.c:106
#6 0x000000000047099b in run_test (test=0x8de030 <generic_tests+400>, subtest=-1) at tests/builtin-test.c:241
#7 0x0000000000470ae3 in test_and_print (t=0x8de030 <generic_tests+400>, force_skip=false, subtest=-1) at tests/builtin-test.c:268
#8 0x0000000000470d71 in __cmd_test (argc=1, argv=0x7fffffffe200, skiplist=0x0) at tests/builtin-test.c:324
#9 0x00000000004711c4 in cmd_test (argc=1, argv=0x7fffffffe200, prefix=0x0) at tests/builtin-test.c:416
#10 0x0000000000498070 in run_builtin (p=0x8dfe58 <commands+504>, argc=2, argv=0x7fffffffe200) at perf.c:387
#11 0x00000000004982de in handle_internal_command (argc=2, argv=0x7fffffffe200) at perf.c:448
#12 0x000000000049842a in run_argv (argcp=0x7fffffffe05c, argv=0x7fffffffe050) at perf.c:492
#13 0x0000000000498786 in main (argc=2, argv=0x7fffffffe200) at perf.c:609


I haven't tracked the history of -Og, maybe it gets better from some gcc version?

If there's no clue, I rather revert this one, because it does
provide the proper debugging experience ;-)

thoughts?
jirka
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/