Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dwarf2reader.cc:835: Unhandled form type #159

Closed
Rtoax opened this issue Mar 16, 2023 · 2 comments · May be fixed by #160
Closed

dwarf2reader.cc:835: Unhandled form type #159

Rtoax opened this issue Mar 16, 2023 · 2 comments · May be fixed by #160

Comments

@Rtoax
Copy link
Contributor

Rtoax commented Mar 16, 2023

dwarf2reader.cc:835: Unhandled form type

When i try to optimize redis with autofdo(gcc), i got dwarf2reader.cc:835: Unhandled form type error

  • gcc (GCC) 11.3.1 20221121 (Red Hat 11.3.1-4)
  • autofdo v0.1-211-g5c4ef103b0c7
  • os: centos-stream-9
  • arch: x86_64
  • kernel 5.14.0-285.el9.x86_64
  • glibc 2.34-61
  • lld-15.0.7
  • binutils-2.35.2
  • man gcc
$ man gcc
 ...
       -fauto-profile
       -fauto-profile=path
           Enable sampling-based feedback-directed optimizations, and the following optimizations, many of which are
           generally profitable only with profile feedback available:

           -fbranch-probabilities  -fprofile-values -funroll-loops  -fpeel-loops  -ftracer  -fvpt -finline-functions
           -fipa-cp  -fipa-cp-clone  -fipa-bit-cp -fpredictive-commoning  -fsplit-loops  -funswitch-loops
           -fgcse-after-reload  -ftree-loop-vectorize  -ftree-slp-vectorize -fvect-cost-model=dynamic
           -ftree-loop-distribute-patterns -fprofile-correction

           path is the name of a file containing AutoFDO profile information.  If omitted, it defaults to fbdata.afdo in
           the current directory.

           Producing an AutoFDO profile data file requires running your program with the perf utility on a supported
           GNU/Linux target system.  For more information, see <https://perf.wiki.kernel.org/>.

           E.g.

                   perf record -e br_inst_retired:near_taken -b -o perf.data \
                       -- your_program

           Then use the create_gcov tool to convert the raw profile data to a format that can be used by GCC.  You must
           also supply the unstripped binary for your program to this tool.  See <https://github.com/google/autofdo>.

           E.g.

                   create_gcov --binary=your_program.unstripped --profile=perf.data \
                       --gcov=profile.afdo

so, just add compiler argument into redis's Makefile

diff --git a/src/Makefile b/src/Makefile
index 13e142442350..bdcc21200e90 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -15,10 +15,17 @@
 release_hdr := $(shell sh -c './mkreleasehdr.sh')
 uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not')
 uname_M := $(shell sh -c 'uname -m 2>/dev/null || echo not')
+AUTOFDO_FLAGS=-fbranch-probabilities  -fprofile-values -funroll-loops \
+                         -fpeel-loops  -ftracer  -fvpt -finline-functions \
+                         -fipa-cp  -fipa-cp-clone  -fipa-bit-cp -fpredictive-commoning  \
+                         -fsplit-loops  -funswitch-loops -fgcse-after-reload  \
+                         -ftree-loop-vectorize  -ftree-slp-vectorize \
+                         -fvect-cost-model=dynamic -ftree-loop-distribute-patterns \
+                         -fprofile-correction
 OPTIMIZATION?=-O3
 ifeq ($(OPTIMIZATION),-O3)
-       REDIS_CFLAGS+=-flto
-       REDIS_LDFLAGS+=-flto
+       REDIS_CFLAGS+=-flto $(AUTOFDO_FLAGS)
+       REDIS_LDFLAGS+=-flto $(AUTOFDO_FLAGS)
 endif
 DEPENDENCY_TARGETS=hiredis linenoise lua hdr_histogram fpconv
 NODEPS:=clean distclean

Then:

$ perf record -b -e br_inst_retired.near_taken:pp -- ./redis-server
$ create_gcov --binary=./redis-server --profile=perf.data --gcov=redis-server.gcov -gcov_version=1
[WARNING:/home/rongtao/Git/google/autofdo/third_party/perf_data_converter/src/quipper/perf_reader.cc:1320] Skipping 120 bytes of metadata: HEADER_CPU_TOPOLOGY
[WARNING:/home/rongtao/Git/google/autofdo/third_party/perf_data_converter/src/quipper/perf_reader.cc:1067] Skipping unsupported event PERF_RECORD_ID_INDEX
[WARNING:/home/rongtao/Git/google/autofdo/third_party/perf_data_converter/src/quipper/perf_reader.cc:1067] Skipping unsupported event PERF_RECORD_CPU_MAP
[WARNING:/home/rongtao/Git/google/autofdo/third_party/perf_data_converter/src/quipper/perf_reader.cc:1067] Skipping unsupported event UNKNOWN_EVENT_82
[INFO:/home/rongtao/Git/google/autofdo/third_party/perf_data_converter/src/quipper/perf_reader.cc:1058] Number of events stored: 26580
[INFO:/home/rongtao/Git/google/autofdo/third_party/perf_data_converter/src/quipper/perf_parser.cc:274] Parser processed: 13 MMAP/MMAP2 events, 6 COMM events, 4 FORK events, 0 EXIT events, 26478 SAMPLE events, 25991 of these were mapped, 0 SAMPLE events with a data address, 0 of these were mapped
WARNING: Logging before InitGoogleLogging() is written to STDERR
W20230316 15:00:48.755203 298771 legacy_addr2line.cc:41] File './redis-server' has no .debug_addr section.
W20230316 15:00:48.755276 298771 legacy_addr2line.cc:41] File './redis-server' has no .debug_ranges section.
F20230316 15:00:48.755455 298771 dwarf2reader.cc:835] Unhandled form type
*** Check failure stack trace: ***
Aborted (core dumped)
@Rtoax
Copy link
Contributor Author

Rtoax commented Mar 16, 2023

By the way, i found redis compile with -flto already.

Rtoax added a commit to Rtoax/autofdo that referenced this issue Mar 17, 2023
This submit try to fix [0]

gcc commit 3aa46b47b266("dwarf2out.c (debug_line_str_section): New variable.")
introduct DW_FORM_line_strp = 31(0x1f).

  Error:

  $ perf record -b -e br_inst_retired.near_taken:pp -- ./redis-server
  $ create_gcov --binary=./redis-server --profile=perf.data --gcov=redis-server.gcov -gcov_version=1
  [WARNING:/home/rongtao/Git/google/autofdo/third_party/perf_data_converter/src/quipper/perf_reader.cc:1320] Skipping 120 bytes of metadata: HEADER_CPU_TOPOLOGY
  [WARNING:/home/rongtao/Git/google/autofdo/third_party/perf_data_converter/src/quipper/perf_reader.cc:1067] Skipping unsupported event PERF_RECORD_ID_INDEX
  [WARNING:/home/rongtao/Git/google/autofdo/third_party/perf_data_converter/src/quipper/perf_reader.cc:1067] Skipping unsupported event PERF_RECORD_CPU_MAP
  [WARNING:/home/rongtao/Git/google/autofdo/third_party/perf_data_converter/src/quipper/perf_reader.cc:1067] Skipping unsupported event UNKNOWN_EVENT_82
  [INFO:/home/rongtao/Git/google/autofdo/third_party/perf_data_converter/src/quipper/perf_reader.cc:1058] Number of events stored: 26469
  [INFO:/home/rongtao/Git/google/autofdo/third_party/perf_data_converter/src/quipper/perf_parser.cc:274] Parser processed: 13 MMAP/MMAP2 events, 7 COMM events, 5 FORK events, 0 EXIT events, 26364 SAMPLE events, 25839 of these were mapped, 0 SAMPLE events with a data address, 0 of these were mapped
  WARNING: Logging before InitGoogleLogging() is written to STDERR
  W20230317 14:17:19.056632 32875 legacy_addr2line.cc:41] File './redis-server' has no .debug_addr section.
  W20230317 14:17:19.056703 32875 legacy_addr2line.cc:41] File './redis-server' has no .debug_ranges section.
  F20230317 14:17:19.056878 32875 dwarf2reader.cc:836] Unhandled form type
  *** Check failure stack trace: ***
  Aborted (core dumped)

[0] google#159

Signed-off-by: Rong Tao <[email protected]>
Rtoax added a commit to Rtoax/autofdo that referenced this issue May 12, 2023
This submit try to fix [0]

gcc commit 3aa46b47b266("dwarf2out.c (debug_line_str_section): New variable.")
introduct DW_FORM_line_strp = 31(0x1f).

  Error:

  $ perf record -b -e br_inst_retired.near_taken:pp -- ./redis-server
  $ create_gcov --binary=./redis-server --profile=perf.data --gcov=redis-server.gcov -gcov_version=1
  [WARNING:/home/rongtao/Git/google/autofdo/third_party/perf_data_converter/src/quipper/perf_reader.cc:1320] Skipping 120 bytes of metadata: HEADER_CPU_TOPOLOGY
  [WARNING:/home/rongtao/Git/google/autofdo/third_party/perf_data_converter/src/quipper/perf_reader.cc:1067] Skipping unsupported event PERF_RECORD_ID_INDEX
  [WARNING:/home/rongtao/Git/google/autofdo/third_party/perf_data_converter/src/quipper/perf_reader.cc:1067] Skipping unsupported event PERF_RECORD_CPU_MAP
  [WARNING:/home/rongtao/Git/google/autofdo/third_party/perf_data_converter/src/quipper/perf_reader.cc:1067] Skipping unsupported event UNKNOWN_EVENT_82
  [INFO:/home/rongtao/Git/google/autofdo/third_party/perf_data_converter/src/quipper/perf_reader.cc:1058] Number of events stored: 26469
  [INFO:/home/rongtao/Git/google/autofdo/third_party/perf_data_converter/src/quipper/perf_parser.cc:274] Parser processed: 13 MMAP/MMAP2 events, 7 COMM events, 5 FORK events, 0 EXIT events, 26364 SAMPLE events, 25839 of these were mapped, 0 SAMPLE events with a data address, 0 of these were mapped
  WARNING: Logging before InitGoogleLogging() is written to STDERR
  W20230317 14:17:19.056632 32875 legacy_addr2line.cc:41] File './redis-server' has no .debug_addr section.
  W20230317 14:17:19.056703 32875 legacy_addr2line.cc:41] File './redis-server' has no .debug_ranges section.
  F20230317 14:17:19.056878 32875 dwarf2reader.cc:836] Unhandled form type
  *** Check failure stack trace: ***
  Aborted (core dumped)

[0] google#159

Signed-off-by: Rong Tao <[email protected]>
Rtoax added a commit to Rtoax/autofdo that referenced this issue May 12, 2023
This submit try to fix issue google#159 [0]

gcc commit 3aa46b47b266("dwarf2out.c (debug_line_str_section): New variable.")
introduct DW_FORM_line_strp = 31(0x1f).

  Error message:

  $ perf record -b -e br_inst_retired.near_taken:pp -- ./redis-server
  $ create_gcov --binary=./redis-server --profile=perf.data \
	--gcov=redis-server.gcov -gcov_version=1
  ...
  F20230317 14:17:19.056878 32875 dwarf2reader.cc:836] Unhandled form type
  *** Check failure stack trace: ***
  Aborted (core dumped)

[0] google#159

Signed-off-by: Rong Tao <[email protected]>
Rtoax added a commit to Rtoax/autofdo that referenced this issue May 12, 2023
This submit try to fix issue google#159 [0]

gcc[1] commit 3aa46b47b266("dwarf2out.c (debug_line_str_section): New
variable.") introduct DW_FORM_line_strp = 31(0x1f).

  Error message:

  $ perf record -b -e br_inst_retired.near_taken:pp -- ./redis-server
  $ create_gcov --binary=./redis-server --profile=perf.data \
	--gcov=redis-server.gcov -gcov_version=1
  ...
  F20230317 14:17:19.056878 32875 dwarf2reader.cc:836] Unhandled form type
  *** Check failure stack trace: ***
  Aborted (core dumped)

[0] google#159
[1] git://gcc.gnu.org/git/gcc.git

Signed-off-by: Rong Tao <[email protected]>
Rtoax added a commit to Rtoax/autofdo that referenced this issue May 15, 2023
This submit try to fix issue google#159 [0]

Dwarf5 add a string section specific to the line number table
( .debug_line_str ) to properly support the common practice of stripping all
DWARF sections except for line number information.

And gcc[1] commit 3aa46b47b266("dwarf2out.c (debug_line_str_section): New
variable.") introduct DW_FORM_line_strp = 31(0x1f).

  Error message:

  $ perf record -b -e br_inst_retired.near_taken:pp -- ./redis-server
  $ create_gcov --binary=./redis-server --profile=perf.data \
	--gcov=redis-server.gcov -gcov_version=1
  ...
  F20230317 14:17:19.056878 32875 dwarf2reader.cc:836] Unhandled form type
  *** Check failure stack trace: ***
  Aborted (core dumped)

[0] google#159
[1] git://gcc.gnu.org/git/gcc.git

Signed-off-by: Rong Tao <[email protected]>
@Rtoax
Copy link
Contributor Author

Rtoax commented May 15, 2023

I just start new V2 PR(#166)

@Rtoax Rtoax closed this as completed May 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant