On Tue, 2021-08-31 at 00:13 +0000, Petter Tomner via Gcc-patches wrote: > Hi, > > This is a patch to generate debug info for local variables as well as > globals. > With this, "ptype foo", "info variables", "info locals" etc works > when debugging in GDB. > > Finalizing of global variable declares are moved to after locations > are handled and done > as Fortran, C, Go etc do it. Also, primitive types have their > TYPE_NAME set for debug info > on types to work. > > Below are the patch, and I attached a testcase. Since it requires GDB > to run it might > not be suitable? Make check-jit runs fine on Debian x64.
Thanks for the patches. Overall, looks good, but I have some review nits... Reviewing patch 1 in this email... > From d77e77104024c7ae9ce31b419dad1f0a5801fda7 Mon Sep 17 00:00:00 > 2001 > From: Petter Tomner <tom...@kth.se> > Date: Mon, 30 Aug 2021 01:44:07 +0200 > Subject: [PATCH 1/2] libgccjit: Generate debug info for variables > > Finalize declares via available helpers after location is set. Set > TYPE_NAME of primitives and friends to "int" etc. Debug info is now > set properly for variables. > > 2021-08-31 Petter Tomner <tom...@kth.se> > > gcc/jit > jit-playback.c > jit-playback.h > gcc/testsuite/jit.dg/ > test-error-array-bounds.c: Array is not unsigned Can you write non-empty ChangeLog entries please. [...snip...] > --- a/gcc/jit/jit-playback.c > +++ b/gcc/jit/jit-playback.c [...snip...] > @@ -2984,15 +2975,22 @@ replay () > { > int i; > function *func; > - > + tree global; > /* No GC can happen yet; process the cached source locations. > */ > handle_locations (); > > + /* Finalize globals. See how FORTRAN 95 does it in > gfc_be_parse_file() > + for a simple reference. */ > + FOR_EACH_VEC_ELT (m_globals, i, global) > + rest_of_decl_compilation (global, true, true); > + > + wrapup_global_declarations (m_globals.address(), > m_globals.length()); > + > /* We've now created tree nodes for the stmts in the various > blocks > - in each function, but we haven't built each function's > single stmt > - list yet. Do so now. */ > + in each function, but we haven't built each function's > single stmt > + list yet. Do so now. */ > FOR_EACH_VEC_ELT (m_functions, i, func) > - func->build_stmt_list (); > + func->build_stmt_list (); Looks like some whitespace churn above; did your text editor accidentally convert tabs to spaces? I prefer to avoid changes that touch lines without changing things, as it messes up e.g. "git blame". In case you haven't discovered it yet, "git add -p" is very helpful for just staging individual hunks within a changed file. [...snip...] ...plus some comments about the testcase which I'll post in reply to the other patch. Dave