Skip to content

Commit 8b6f57b

Browse files
committed
i#2485: Update DR to use elfutils for DWARF-5 support
Updates DR to 3e3b976e316e9469ca36338fb7f3fa086739d03a which pulls in the use of elfutils in drsyms for DWARF-5 support on Linux. Updates the documentation and flags for Linux to remove -gdwarf-4. Fixes #2485
1 parent b083b08 commit 8b6f57b

File tree

3 files changed

+18
-20
lines changed

3 files changed

+18
-20
lines changed

CMakeLists.txt

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# **********************************************************
2-
# Copyright (c) 2010-2023 Google, Inc. All rights reserved.
2+
# Copyright (c) 2010-2024 Google, Inc. All rights reserved.
33
# Copyright (c) 2009-2010 VMware, Inc. All rights reserved.
44
# **********************************************************
55

@@ -336,10 +336,12 @@ if (UNIX)
336336
"${CMAKE_EXE_LINKER_FLAGS} -fPIE -pie -Wl,--export-dynamic")
337337
endif ()
338338
endif ()
339-
# TODO i#2485: Add DWARF-5 support.
340-
CHECK_C_COMPILER_FLAG("-gdwarf-5" have_dwarf5)
341-
if (have_dwarf5)
342-
set(EXTRA_FLAGS "${EXTRA_FLAGS} -gdwarf-4")
339+
if (APPLE)
340+
# TODO i#2485: Add DWARF-5 support to Mac.
341+
CHECK_C_COMPILER_FLAG("-gdwarf-5" have_dwarf5)
342+
if (have_dwarf5)
343+
set(EXTRA_FLAGS "${EXTRA_FLAGS} -gdwarf-4")
344+
endif ()
343345
endif ()
344346
# We use C++11.
345347
set(EXTRA_CXXFLAGS "-std=c++11")

drmemory/docs/using.dox

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* **********************************************************
2-
* Copyright (c) 2011-2023 Google, Inc. All rights reserved.
2+
* Copyright (c) 2011-2024 Google, Inc. All rights reserved.
33
* Copyright (c) 2009-2010 VMware, Inc. All rights reserved.
44
* **********************************************************/
55

@@ -204,10 +204,10 @@ These cross-platform steps apply to Linux, Mac, and Windows.
204204

205205
In order to obtain line number information, compile your target
206206
application with debugging information enabled.
207-
On Linux, Dr. Memory supports ELF files with DWARF2 line information.
208-
On Mac, Dr. Memory supports Mach-O files with DWARF2 line information. On
207+
On Linux, Dr. Memory supports ELF files with DWARF line information.
208+
On Mac, Dr. Memory supports Mach-O files with DWARF line information. On
209209
Windows, Dr. Memory supports PDB debug information (produced by Visual
210-
Studio) as well as PECOFF files with DWARF2 line information (produced by
210+
Studio) as well as PECOFF files with DWARF line information (produced by
211211
MinGW gcc).
212212

213213
********************
@@ -228,25 +228,21 @@ but should eliminate skipped frames.
228228
********************
229229
\section sec_prep_linux Linux
230230

231-
Dr. Memory currently only supports DWARF2 through DWARF4 line information, not
232-
stabs nor DWARF5. DWARF4 can be requested from the compiler with the `-gdwarf-4`
233-
flag.
234-
235231
Here is a sample command line for compiling your application that combines
236232
all of the above recommendations:
237233

238234
\verbatim
239-
g++ -g -gdwarf-4 -fno-inline -fno-omit-frame-pointer myfile1.cpp myfile2.cpp -o myapp
235+
g++ -g -fno-inline -fno-omit-frame-pointer myfile1.cpp myfile2.cpp -o myapp
240236
\endverbatim
241237

242238
********************
243239
\section sec_prep_mac Mac
244240

245241
Ensure your compiler is able to build 32-bit applications.
246242

247-
Dr. Memory currently only supports DWARF2 through DWARF4 line information, not
248-
stabs nor DWARF5. DWARF4 can be requested from the compiler with the `-gdwarf-4`
249-
flag.
243+
Dr. Memory currently only supports DWARF2 through DWARF4 line information on
244+
Mac, not stabs nor DWARF5. DWARF4 can be requested from the compiler with the
245+
`-gdwarf-4` flag.
250246

251247
Here is a sample command line for compiling your application that combines
252248
all of the above recommendations:
@@ -324,10 +320,10 @@ cl /Zi /MT /EHsc /Oy- /Ob0 /Femyapp.exe *.cpp
324320
\section sec_prep_mingw Windows MinGW
325321

326322
Dr. Memory supports applications compiled with the MinGW gcc or g++
327-
compilers, but will only provide line number information if DWARF2
323+
compilers, but will only provide line number information if DWARF
328324
debugging information is present. The default for MinGW gcc prior to
329325
version 4.3 is to use the stabs format, which is not supported by
330-
Dr. Memory. Pass the \p -ggdb option to gcc to generate DWARF2 format
326+
Dr. Memory. Pass the \p -ggdb option to gcc to generate DWARF format
331327
instead.
332328

333329
You install the MinGW compiler in a Cygwin installation by running the

dynamorio

Submodule dynamorio updated 483 files

0 commit comments

Comments
 (0)