This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch] [gdb/testsuite] include a use of the definition of a type to cause clang to emit debug info


Oh, and there was one other instance of the same issue (I believe
these are the only two cases)

This test case (gdb.cp/pr10728) seems like it could probably be
simplified a great deal, down to:

struct foo;
foo *f, *g;
int main() {
} // break and print f - g

if I'm not mistaken... - but I've made a relatively small change for
now. If preferred, I can make the more substantial simplification
suggested. Or otherwise appease clang (by introducing a use of the
original 'x' type definition in some other way - dereferencing a
pointer, etc).

- David

On Sat, Apr 12, 2014 at 11:43 PM, David Blaikie <dblaikie@gmail.com> wrote:
> Clang has an optimization that causes a the debug info to only include
> the declaration of a type if the type is referenced but never used in
> a context that requires a definition (eg: pointers are handed around
> but never deferenced).
>
> This patch introduces a variable to one test file to cause clang to
> emit the full definition of the type as well as fixing up a related
> typo in the test message of the associated expect file.
>
> Like the difference between GCC and Clang in the emission of unused
> static entities, I think this case is also a matter of degrees - both
> GCC and Clang implement other similar optimizations* to the one
> outlined here and the GDB test suite has managed to pass without
> disabling those optimizations in GCC and I hope it's suitable to do
> the same for Clang.
>
> Though admittedly I don't have much of the context of the history of
> the testsuite, its priorities/preferences when it comes to
> distinguishing testing compiler behavior versus debugger behavior,
> etc.
>
> * the one I know of involves dynamic types: both GCC and Clang only
> emit the debug info definition of such a type in any translation unit
> that emits the key function. This means in many contexts where a full
> definition is provided in the source only a declaration is provided in
> the debug info.

Attachment: pr10728-full-type.diff
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]