Commit graph

72 commits

Author SHA1 Message Date
Martin Kinkelin
e52199469f Upgrade front-end & libs to v2.087.0-beta.1 2019-06-21 15:39:45 +02:00
Nicholas Wilson
7a2a59874a fix compilation with recent LLVM (#2921) 2018-11-25 15:27:10 +01:00
Martin Kinkelin
32b6e49a65
Debuginfo: Fix nested variables (primarily for CodeView) (#2909)
We've been going back and forth between GEPs and complex DWARF
expressions based on the context pointer; this goes back to the latter,
as that fixes simple nested variables for CodeView with LLVM >= 6.

I guess it also helps for debuginfos of nested vars with enabled
optimizations.
2018-11-20 20:44:47 +01:00
Oleksandr Palamar
540f19c8a9 Debuginfo: Fix type for associative arrays and make -gc emit C++-imitating names (#2869) 2018-11-11 17:29:00 +01:00
Martin Kinkelin
be6c608a67 Refactor DIBuilder [NFC] 2018-11-03 23:22:19 +01:00
Martin Kinkelin
e0319eadf1 Add DI namespaces & use them for templates and C++ namespaces
And make sure the template instance names include the template
parameters, a regression after #2826.

Also prevent `TemplatedSymbol(...).TemplatedSymbol` names, just use
`TemplatedSymbol!(...)` instead.
2018-11-03 23:22:19 +01:00
Martin Kinkelin
39b46d7b69 Replace old-school header guards by #pragma once 2018-10-20 16:19:46 +02:00
Martin Kinkelin
4a23399236 Aim for consistent #includes (order + dir prefix)
I surely missed a few.
2018-10-20 16:19:46 +02:00
Martin Kinkelin
518eafc2f9 Work around apparent LLVM CodeView bug wrt. nested functions 2018-10-15 23:17:24 +02:00
Elie Morisse
23e73160cf Debug info: remove dead getDefinedModule() function. 2018-10-15 23:10:22 +02:00
Elie Morisse
9facf5ad28 Debug info: better handling of static aggregate members with DIFlagStaticMember
Once again closer to GDC and Clang's output, and attaching static variables to the module scope prevents an assert from triggering in IR/DIBuilder.cpp:

  checkGlobalVariableScope(): Assertion `CT->getIdentifier().empty() && "Context of a global variable should not be a type with identifier"'
2018-10-15 22:51:50 +02:00
Elie Morisse
2cdae62b0e Debug info: attach entries to their scope, and never use the qualified name except for modules
Previously entries were made children of the compile unit, and both global and imported symbols were only accessible by using their mangled name, or since the latest commit by their qualified name.

This brings the DWARF output closer to GDC's.
2018-10-15 22:51:50 +02:00
Elie Morisse
841146644b Debug info: emit llvm::DIModule and llvm::DIImportedEntity for modules and imports
Matches GDC's DWARF output and enables access to global and imported symbols from GDB.
2018-10-15 22:48:03 +02:00
Martin
df4f854dd5 Upgrade to D v2.079.0-beta.1 2018-02-20 02:04:41 +01:00
Martin
8cc5ff6e79 Fix debuginfos for nested ref/out parameters (use llvm.dbg.declare)
llvm.dbg.value() apparently doesn't like GEP + deref, so use
llvm.dbg.declare() & GEP.
2017-09-09 22:02:14 +02:00
Martin
8a5984b7d3 Use llvm.dbg.value for all non-special refs & fix nested refs DI 2017-09-09 22:01:22 +02:00
Martin
287e4b9b53 Cosmetics & improved comments wrt. llvm.dbg.value 2017-09-09 22:01:17 +02:00
Johan Engelen
152416bd37 Attempt to use llvm.dbg.value instead for ref params. 2017-08-27 20:49:43 +02:00
Martin
1fb269f940 Drop support for LLVM < 3.7 2017-07-16 02:18:00 +02:00
Elie Morisse
3338bbf9c0 DIType for types involving classes were incorrect in some cases.
Static arrays of classes, pointers to class (and perhaps global class variables) ended up with a wrong DIType because of wrong CreateTypeDescription() calls for class types.

Ex.: Array!FuncDeclaration caused an infinite recursion crash in GDB, because for its « FuncDeclaration[SMALLARRAYCAP] smallarray » field DIBuilder::CreateSArrayType() had DIBuilder return a value type instead of a reference type for FuncDeclaration.
2017-05-21 21:41:25 -03:00
Remi Thebault
3b63effd3f Implement -gline-tables-only (PR #1861)
As per ldc-developers/ldc#1844 .
2016-11-12 20:16:41 +01:00
Martin
6b6cafcd60 Win64 workaround: Emit slice and vector params as DI locals
This works for both cdb/Windbg and Visual Studio debuggers, otherwise the
DI values are garbage in both debuggers too.
2016-10-10 20:36:17 +02:00
Martin
8be1e3e719 Adapt emission of debuginfos for parameters
Emit all parameters (except for captured ones) as DI parameters.
2016-10-09 20:17:39 +02:00
Nicholas Wilson
45a4f64ac1 [NFC] Refactor debuginfo emission check. (#1797) 2016-10-07 15:14:19 +02:00
Rainer Schuetze
3ed8f25ae2 Debuginfo: try harder to find a suitable filename is location is empty 2016-10-06 00:18:38 +02:00
Rainer Schuetze
2dec29b825 CodeView: fix display of dynamic array arguments (#1761) 2016-09-24 21:06:58 +02:00
Rainer Schuetze
daa404d523 Debuginfo: use inheritance information for base classes instead of listing base class members in derived classes 2016-09-23 08:37:41 +02:00
Johan Engelen
a561b6a496 Fix LLVM 4.0 build, there was another debuginfo change. 2016-09-14 11:07:58 +02:00
Rainer Schuetze
c8eb07d720 CodeView: add support for imaginary and complex types 2016-09-02 09:18:06 +02:00
Martin
29152f5b94 Refactor DIBuilder
Incl. some subtle changes/fixes.
2016-07-22 22:34:31 +02:00
Martin
c9cb63fb54 Misc. debuginfo fixes
As LLVM's CodeView component now uses additional asserts, e.g.,
to make sure the size of a static array equals N * elementSize.
2016-07-22 15:01:55 +02:00
Elie Morisse
302d71a9de MSVC: Attach !dbg info to _d_eh_enter_catch, _d_enter_cleanup and _d_leave_cleanup calls. 2016-07-03 16:46:51 -03:00
Elie Morisse
7ac1216292 Nested variables debug info fixes.
- Fix the value of closure variables in the parent function. Previously the passed value was the GEP instruction into .frame, and that instruction corresponds to a register  so resulted in "DWARF-2 expression error: DW_OP_reg operations must be used either alone(...)" (also the address was incorrect anyway because the offset would get doubled by 'addr')

 - When emitting debug info for a parent function parameter that is accessed from a nested function, call DIBuilder.createAutoVariable instead of createParameterVariable. Two different variables for the same parameter index was triggering an assert in llvm::DbgVariable::addMMIEntry. This fixes the compilation of druntime and phobos when building against LLVM 3.8.
2016-06-30 14:13:51 -03:00
Rainer Schuetze
6f3adaea46 add debug info to thunks as a workaround for https://llvm.org/bugs/show_bug.cgi?id=26833 2016-03-13 17:29:44 +01:00
David Nadlinger
9df487edff gen/ir: clang-tidy the world 2015-11-02 11:30:40 +02:00
David Nadlinger
44b0f7b615 driver/gen/ir: clang-format the world
This uses the LLVM style, which makes sense for sharing code
with other LLVM projects. The DMD code we use will soon all
be in D anyway.
2015-11-02 00:28:01 +02:00
Martin
60d676e2a1 Drop support for LLVM < 3.5
This allows to clean up the code a little.
2015-10-30 22:24:05 +01:00
David Nadlinger
0922254dd1 Directly emit IR into same llvm::Module instead of using Linker
GitHub: Fixes #970.
2015-06-14 21:36:35 +02:00
Kai Nacke
57103829bb Merge branch 'master' into merge-2.067 2015-06-05 14:03:17 +02:00
Kai Nacke
95c897ab3e DebugInfo: Use location of variable declaration instead of current stop point.
There might be no valid stop point but the variable should always have a
location. This fixes an ICE compiling core.demangle.
2015-06-05 13:04:30 +02:00
Kai Nacke
5523330115 Merge branch 'master' into merge-2.067 2015-06-05 00:18:10 +02:00
Kai Nacke
7e82631b94 Revert "DebugInfo: Use DebugLoc::get() for declaration of variable."
This reverts commit 3bab8306aa.
2015-06-05 00:16:48 +02:00
Kai Nacke
cddb59f7b7 Merge branch 'master' into merge-2.067 2015-06-04 22:02:52 +02:00
Kai Nacke
3bab8306aa DebugInfo: Use DebugLoc::get() for declaration of variable. 2015-06-04 22:00:54 +02:00
Kai Nacke
45ec6a0512 Merge branch 'master' into merge-2.067 2015-06-04 19:07:28 +02:00
Kai Nacke
0f86de548c DebugInfo: EmitStopPoint() now has a Loc parameter. 2015-06-04 19:04:23 +02:00
Kai Nacke
131529ecc8 Merge branch 'master' into merge-2.067 2015-06-04 18:02:15 +02:00
Kai Nacke
3b363a1b08 DebugInfo: Add more flags and other refinements.
In D all functions are prototyped. Mark the hidden this pointer with
flag ObjectPointer. Also add a column for a lexical block start.
2015-06-04 18:00:24 +02:00
Kai Nacke
fe2b9d445d Merge branch 'master' into merge-2.067 2015-06-04 16:24:31 +02:00
Kai Nacke
15b1ee1576 DebugInfo: Output the underlying delegate for lazy parameters.
This fixes issue #959.
2015-06-04 15:09:29 +02:00