2009-09-28 22:02:32

by Taro Okumichi

[permalink] [raw]
Subject: visibility of linux source

I have written a gcc-tracer and html-formatter that shows
Linux's init/main.c formatted as dynamic-html including:
o expand macros by clicking on them
o expand include directives
o traverse c-structs
Address:
http://cfw.sourceforge.net/htmltag/init/main.c.pinfo.html
I have only processed init/main.c (50mb mysql content)
As far as I understand (maybe I am wrong) this kind of
visibility is not achieved till now.
Note:
I tested firefox (3.5) and konqueror. The first page takes ~
10 Seconds to load, therefore be patient until the right
side init/main.c content is shown (ajax fetch from a mysql db).

o Complete Preprocessor Trace:
All Macro expansions where traced and can be clicked
open to see how they expand and where the macro was
defined.
- to open a macro expansion: click the macro marked
with a white box,
+ after the macro has been expanded you can:
+ click the macro name to get the macro definition location
+ a "<" link appears at the end of the macro expansion,
click it to close the macro expansion again.
- #ifdef etc. preprocessor directives
can also be expanded. Blocks that are inactive are
marked grey.
- #include directives can be clicked to expand to the
included file

o Variable/function declares are Trace:
Full struct type layout is traced and when a struct
types is used you can click on the type declarator,

To get going:
1. Browse to the end of init/main.c page:
2. click on
"param_check_bool" it will expand to:
param_check_bool __param_check ( initcall_debug , & (
initcall_debug ) , int )[<]
Click on param_check_bool again, it will sow the definition pos of
the macro, click on "<" and it will close the expansion,
You can recursively ascend into for instance expanding __param_check etc...


I thought to share this link to inspire some real gcc experts
or kernel hackers to implement this kind of feature in the production
gcc, I was using gcc-4.2.1 to output a cpp and c-parse trace
however the code is that kind of messy and would be of no
use, easier to implement newly, I guess that it should be obvious
what to do for for the right person. After getting the trace I use
a simple perl script (also messy code that I'm kind of ashamed to
publish) to format html.

Implementation note:

Using a ajax request to retrieve the html, the Mysql db
content is ~ 50 mb for the whole of main.c. No optimization
is done, so this includes lots of redundant entries.

The left index frame should not be used, the javascript code
is kind of buggy, so only use the right frame where the code
is shown.

Also: There is a bug in when closing a "include" directive section:
(At least in firefox) A new windows will pop up (I didnt find out
why this is the case). Click the window to the back and continue
(not closing it otherwise the next #include directive opens it again...

Have fun
-- Tkokum


2009-09-29 00:22:17

by Florian Mickler

[permalink] [raw]
Subject: Re: visibility of linux source

On Tue, 29 Sep 2009 00:02:33 +0200
Taro Okumichi <[email protected]> wrote:

> I have written a gcc-tracer and html-formatter that shows
> Linux's init/main.c formatted as dynamic-html including:
> o expand macros by clicking on them
> o expand include directives
> o traverse c-structs
> Address:
> http://cfw.sourceforge.net/htmltag/init/main.c.pinfo.html
> I have only processed init/main.c (50mb mysql content)
> As far as I understand (maybe I am wrong) this kind of
> visibility is not achieved till now.
> Note:
> I tested firefox (3.5) and konqueror. The first page takes ~
> 10 Seconds to load, therefore be patient until the right
> side init/main.c content is shown (ajax fetch from a mysql db).
>
> o Complete Preprocessor Trace:
> All Macro expansions where traced and can be clicked
> open to see how they expand and where the macro was
> defined.
> - to open a macro expansion: click the macro marked
> with a white box,
> + after the macro has been expanded you can:
> + click the macro name to get the macro definition location
> + a "<" link appears at the end of the macro expansion,
> click it to close the macro expansion again.
> - #ifdef etc. preprocessor directives
> can also be expanded. Blocks that are inactive are
> marked grey.
> - #include directives can be clicked to expand to the
> included file
>
> o Variable/function declares are Trace:
> Full struct type layout is traced and when a struct
> types is used you can click on the type declarator,
>
> To get going:
> 1. Browse to the end of init/main.c page:
> 2. click on
> "param_check_bool" it will expand to:
> param_check_bool __param_check ( initcall_debug , & (
> initcall_debug ) , int )[<]
> Click on param_check_bool again, it will sow the definition pos of
> the macro, click on "<" and it will close the expansion,
> You can recursively ascend into for instance expanding __param_check etc...
>
>
> I thought to share this link to inspire some real gcc experts
> or kernel hackers to implement this kind of feature in the production
> gcc, I was using gcc-4.2.1 to output a cpp and c-parse trace
> however the code is that kind of messy and would be of no
> use, easier to implement newly, I guess that it should be obvious
> what to do for for the right person. After getting the trace I use
> a simple perl script (also messy code that I'm kind of ashamed to
> publish) to format html.
>
> Implementation note:
>
> Using a ajax request to retrieve the html, the Mysql db
> content is ~ 50 mb for the whole of main.c. No optimization
> is done, so this includes lots of redundant entries.
>
> The left index frame should not be used, the javascript code
> is kind of buggy, so only use the right frame where the code
> is shown.
>
> Also: There is a bug in when closing a "include" directive section:
> (At least in firefox) A new windows will pop up (I didnt find out
> why this is the case). Click the window to the back and continue
> (not closing it otherwise the next #include directive opens it again...
>
> Have fun
> -- Tkokum

Wow, nice!
Come on! Don't be shy! This is called 'rapid prototyping' and is a
useful thing. Plz share your code. I'd like to play with it.

(one things come to mind: extending cscope/vi)

Sincerely,
Florian

--
A: Because it messes up the order in which people normally read text.
> Q: Why is top-posting such a bad thing?
>> A: Top-posting.
>>> Q: What is the most annoying thing in e-mail?

2009-09-29 02:07:08

by Cong Wang

[permalink] [raw]
Subject: Re: visibility of linux source

On Tue, Sep 29, 2009 at 6:02 AM, Taro Okumichi <[email protected]> wrote:
> I have written a gcc-tracer and html-formatter that shows
> Linux's init/main.c formatted as dynamic-html including:
>  o expand macros by clicking on them
>  o expand include directives
>  o traverse c-structs
> Address:
> http://cfw.sourceforge.net/htmltag/init/main.c.pinfo.html
> I have only processed init/main.c (50mb mysql content)
> As far as I understand (maybe I am wrong) this kind of
> visibility is not achieved till now.
> Note:
> I tested firefox (3.5) and konqueror. The first page takes ~
> 10 Seconds to load, therefore be patient until the right
> side init/main.c content is shown (ajax fetch from a mysql db).

{snip}

> Using a ajax request to retrieve the html, the Mysql db
> content is ~ 50 mb for the whole of main.c. No optimization
> is done, so this includes lots of redundant entries.
>
> The left index frame should not be used, the javascript code
> is kind of buggy, so only use the right frame where the code
> is shown.
>
> Also: There is a bug in when closing a "include" directive section:
> (At least in firefox) A new windows will pop up (I didnt find out
> why this is the case). Click the window to the back and continue
> (not closing it otherwise the next #include directive opens it again...

Awesome!

Taro, you are doing a nice work! Thanks!

I just wonder how can I go back if I follow a function definition from one
file to another? Ajax makes going back to previous page impossible.
:-/

Thanks!

2009-09-29 20:11:05

by Bill Davidsen

[permalink] [raw]
Subject: Re: visibility of linux source

Taro Okumichi wrote:
> I have written a gcc-tracer and html-formatter that shows
> Linux's init/main.c formatted as dynamic-html including:
> o expand macros by clicking on them
> o expand include directives
> o traverse c-structs
> Address:
> http://cfw.sourceforge.net/htmltag/init/main.c.pinfo.html
> I have only processed init/main.c (50mb mysql content)
> As far as I understand (maybe I am wrong) this kind of
> visibility is not achieved till now.
> Note:
> I tested firefox (3.5) and konqueror. The first page takes ~
> 10 Seconds to load, therefore be patient until the right
> side init/main.c content is shown (ajax fetch from a mysql db).
>
Just for the record, I tried seamonkey 1.1.17 and it works well there, as well.
I'll try the daily test version, but unless I find a problem assume it works,
using much code from Firefox{recent}.

I'd like to try with Chrome, I suspect it will be faster there.

> o Complete Preprocessor Trace:
> All Macro expansions where traced and can be clicked
> open to see how they expand and where the macro was
> defined.
> - to open a macro expansion: click the macro marked
> with a white box,
> + after the macro has been expanded you can:
> + click the macro name to get the macro definition location
> + a "<" link appears at the end of the macro expansion,
> click it to close the macro expansion again.
> - #ifdef etc. preprocessor directives
> can also be expanded. Blocks that are inactive are
> marked grey.
> - #include directives can be clicked to expand to the
> included file
>
> o Variable/function declares are Trace:
> Full struct type layout is traced and when a struct
> types is used you can click on the type declarator,
>
> To get going:
> 1. Browse to the end of init/main.c page:
> 2. click on
> "param_check_bool" it will expand to:
> param_check_bool __param_check ( initcall_debug , & (
> initcall_debug ) , int )[<]
> Click on param_check_bool again, it will sow the definition pos of
> the macro, click on "<" and it will close the expansion,
> You can recursively ascend into for instance expanding __param_check etc...
>
>
> I thought to share this link to inspire some real gcc experts
> or kernel hackers to implement this kind of feature in the production
> gcc, I was using gcc-4.2.1 to output a cpp and c-parse trace
> however the code is that kind of messy and would be of no
> use, easier to implement newly, I guess that it should be obvious
> what to do for for the right person. After getting the trace I use
> a simple perl script (also messy code that I'm kind of ashamed to
> publish) to format html.
>
> Implementation note:
>
> Using a ajax request to retrieve the html, the Mysql db
> content is ~ 50 mb for the whole of main.c. No optimization
> is done, so this includes lots of redundant entries.
>
> The left index frame should not be used, the javascript code
> is kind of buggy, so only use the right frame where the code
> is shown.
>
> Also: There is a bug in when closing a "include" directive section:
> (At least in firefox) A new windows will pop up (I didnt find out
> why this is the case). Click the window to the back and continue
> (not closing it otherwise the next #include directive opens it again...
>
> Have fun
> -- Tkokum


--
Bill Davidsen <[email protected]>
"We have more to fear from the bungling of the incompetent than from
the machinations of the wicked." - from Slashdot