This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


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

Re: Merge cpplib and front end hashtables, part 1


Neil Booth <neil@daikokuya.demon.co.uk> writes:

> Daniel Berlin wrote:-
> 
> > My main problem is getting the defines into cpplib, from the dwarf2
> > info.
> 
> Ah yes, I'd forgotten that the table changes with source line, and I
> suppose GDB has to handle that.  Yes, I can see that being
> non-trivial and tedious.

I think I might know how. Both are fragile, however.
There are two ways:
1. I'll just move it into a seperate structure, containing the objfile
   they came from (ie whose debug info we got from),  and the decl
   line.  Then, we just process all until we hit the place we are
   currently in.

Since IIRC, the order is going to be the order they are defined in,
this will work.
2.  Make the outputted macro definitions fully expanded in the debug info.  Are they? I
    never bothered to look.  What I mean by fully expanded is that
    they don't depend on other macros.  If so, then we only need the define when
    we hit a macro to expand, right?  This is only one lookup, and can
    be done in the parser.


> 
> How about defining all macros that are never undefined all in one go
> (if you don't mind using a bit of memory), and figuring out those few
> that are #undef-ed on the spot?  (And undeffing them afterwards).
Hmmmm.

> 
> One potential problem here is that undeffing a macro doesn't entirely
> free its memory, so a long debugging session would creep up its memory
> usage.
Crud.
I also noticed that calling cpp_destroy causes a crash, and that
nothing really uses it.
If I don't, does memory actually get freed at the right times?
>   We may need to look into it if you're taking that kind of
> thing seriously.

Well, we have enough macros that if I have to do constant insertion
and removal, then it'll matter a whole lot.

This is because all macros get output, not just used ones, which is
IMHO, a good thing anyway, since you may want debugging macros.

--Dan
> 
> Neil.

-- 
"When I was five years old I was on a merry go round.  There was
a gunshot nearby.  The horses stampeded.  There I was running
down the street on a purple wooden horse.
"-Steven Wright


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