1 .. Copyright (C) 2014-2019 Free Software Foundation, Inc.
2 Originally contributed by David Malcolm <dmalcolm@redhat.com>
4 This is free software: you can redistribute it and/or modify it
5 under the terms of the GNU General Public License as published by
6 the Free Software Foundation, either version 3 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful, but
10 WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program. If not, see
16 <http://www.gnu.org/licenses/>.
18 .. default-domain:: cpp
23 .. class:: gccjit::location
25 A `gccjit::location` encapsulates a source code location, so that
26 you can (optionally) associate locations in your language with
27 statements in the JIT-compiled code, allowing the debugger to
28 single-step through your language.
30 `gccjit::location` instances are optional: you can always omit them
31 from any C++ API entrypoint accepting one.
33 You can construct them using :func:`gccjit::context::new_location`.
35 You need to enable :c:macro:`GCC_JIT_BOOL_OPTION_DEBUGINFO` on the
36 :class:`gccjit::context` for these locations to actually be usable by
41 ctxt.set_bool_option (GCC_JIT_BOOL_OPTION_DEBUGINFO, 1);
43 .. function:: gccjit::location \
44 gccjit::context::new_location (const char *filename, \
48 Create a `gccjit::location` instance representing the given source
53 If you don't have source code for your internal representation, but need
54 to debug, you can generate a C-like representation of the functions in
55 your context using :func:`gccjit::context::dump_to_file()`:
59 ctxt.dump_to_file ("/tmp/something.c",
60 1 /* update_locations */);
62 This will dump C-like code to the given path. If the `update_locations`
63 argument is true, this will also set up `gccjit::location` information
64 throughout the context, pointing at the dump file as if it were a source
65 file, giving you *something* you can step through in the debugger.