This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] Add pretty printers for the NPTL lock types
- From: Martin Galvan <martin dot galvan at tallertechnologies dot com>
- To: Joseph Myers <joseph at codesourcery dot com>
- Cc: libc-alpha at sourceware dot org, Tom Tromey <tom at tromey dot com>, "Carlos O'Donell" <carlos at redhat dot com>, Torvald Riegel <triegel at redhat dot com>, Pedro Alves <palves at redhat dot com>, vapier at gentoo dot org, Daniel Gutson <daniel dot gutson at tallertechnologies dot com>
- Date: Tue, 19 May 2015 10:01:42 -0300
- Subject: Re: [PATCH] Add pretty printers for the NPTL lock types
- Authentication-results: sourceware.org; auth=none
- References: <1431716828-12854-1-git-send-email-martin dot galvan at tallertechnologies dot com> <alpine dot DEB dot 2 dot 10 dot 1505152029300 dot 2211 at digraph dot polyomino dot org dot uk> <CAOKbPbax0Sw_GzTnoggSyYoEtFxbApSGE=zacRM71WRC=KwQxQ at mail dot gmail dot com> <CAOKbPbbJd4oeM+4Wph3ZnspgPJM9BLK1FEHQ+rHBm2do-BMq2g at mail dot gmail dot com> <CAOKbPbajmxGm9bMTK1G2tvLB2sYnrV_zEGbNnOzHveRBU=7Fdg at mail dot gmail dot com> <alpine dot DEB dot 2 dot 10 dot 1505181633560 dot 20209 at digraph dot polyomino dot org dot uk>
On Mon, May 18, 2015 at 1:35 PM, Joseph Myers <joseph@codesourcery.com> wrote:
> On Fri, 15 May 2015, Martin Galvan wrote:
>
>> On Fri, May 15, 2015 at 8:02 PM, Martin Galvan
>> <martin.galvan@tallertechnologies.com> wrote:
>> > Actually, disregard that. I took a look at how gen-as-const seems to
>> > work, and noticed each directory is used on has a .sym file with all
>> > the macros and such neatly set for awk to do its thing. Silly me, I
>> > thought you were asking me to extract them from the .h files
>> > themselves.
>> >
>> > What I'm gonna do is, import a macros.py file in printers.py.
>> > macros.py will in turn be generated from a .sym file where I'll place
>> > all the macros/enums I need. Then I'll add some comments pointing out
>> > that any updates to the headers should be reflected on the .sym file.
>>
>> Come to think about it, though, I don't see what would be the real
>> advantage of doing this over simply updating printers.py. In both
>
> It avoids having two copies of the values you need to make sure stay in
> sync.
I see. I guess I was wrong on my initial assumption.
>> cases the maintainer would have to update both the header and a
>> separate file that'll be used by the printers. How exactly does
>> gen-as-const work?
>
> It generates a C source file that uses the C constant as an asm operand,
> in an asm containing special text that can then be matched in the compiler
> output to extract the value of a constant.
So if I understood correctly, what you're asking me to do is to take
the macros out of the header files, place them in a .sym file and have
a script generate both a .h and a .py with those values?
I guess it would be relatively simple if only plain #defines were
involved. Here we have #defines, enums (some of whose values are
bitwise combination of other enum constants) and hardcoded values all
over the place. It sounds to me like I'd have to change quite a few
files from glibc, which I think is beyond the scope of this
contribution.
Wouldn't be enough to comment on the headers saying any updates should
be reflected in printers.py?
--
Martin Galvan
Software Engineer
Taller Technologies Argentina
San Lorenzo 47, 3rd Floor, Office 5
CÃrdoba, Argentina
Phone: 54 351 4217888 / +54 351 4218211