Cross referencing EDKII code


wonderfly@...
 

Started looking at EDKII code about two months ago. One of the things I still haven't figured out is how to read code effectively, possibly with the help of cross referencing tools. Haven't got much luck with cscope, and I don't see any compile_commands.json being generated either.

What do you folks use for cross referencing? What's your development setup like?


Rebecca Cran
 

On 3/4/21 11:15 AM, wonderfly@waymo.com wrote:
Started looking at EDKII code about two months ago. One of the things I still haven't figured out is how to read code effectively, possibly with the help of cross referencing tools. Haven't got much luck with cscope, and I don't see any compile_commands.json being generated either.
What do you folks use for cross referencing? What's your development setup like?
Personally, I've found Doxygen a great help in understanding EDK2. I've been maintaining a build of the documentation at https://bsdio.com/edk2/docs/master/index.html for a few years.


I think I've enabled all the search and browsing features, so for example you can use the search bar in the top-right corner to find the EFI_BOOT_SERVICES docs (https://bsdio.com/edk2/docs/master/struct_e_f_i___b_o_o_t___s_e_r_v_i_c_e_s.html).

--
Rebecca Cran


Rebecca Cran
 

It's very specific for my use of building it for my site, but I've put the Doxyfile at https://bsdio.com/edk2/docs/master.doxyfile . You'll want to change things like the output directory, which is hard-coded to /home/bcran/sites/bsdio.com/edk2/docs . But then you should be able to generate a directory of html files by running "doxygen master.doxyfile".

There _is_ a doxyfile task in the edk2 repo at BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/basemodel/doxygen.py, but from looking at it a while ago I found it to be too simple for my use, for example lacking the search function.

--
Rebecca Cran

On 3/4/21 3:19 PM, Daniel Wang wrote:
Very nice!  Thank you for the pointers.  I wonder how the cross links were created and whether it's possible to integrate them into my editor (vim).   If not, is there a build target for doxygen?  So that I could generate these html files for the branch I am on?
On Thu, Mar 4, 2021 at 2:12 PM Rebecca Cran <rebecca@nuviainc.com <mailto:rebecca@nuviainc.com>> wrote:
On 3/4/21 11:15 AM, wonderfly@waymo.com <mailto:wonderfly@waymo.com>
wrote:
> Started looking at EDKII code about two months ago.  One of the
things I still haven't figured out is how to read code effectively,
possibly with the help of cross referencing tools.  Haven't got much
luck with cscope, and I don't see any compile_commands.json being
generated either.
>
> What do you folks use for cross referencing?  What's your
development setup like?
Personally, I've found Doxygen a great help in understanding EDK2. I've
been maintaining a build of the documentation at
https://bsdio.com/edk2/docs/master/index.html
<https://bsdio.com/edk2/docs/master/index.html> for a few years.
I think I've enabled all the search and browsing features, so for
example you can use the search bar in the top-right corner to find the
EFI_BOOT_SERVICES docs
(https://bsdio.com/edk2/docs/master/struct_e_f_i___b_o_o_t___s_e_r_v_i_c_e_s.html
<https://bsdio.com/edk2/docs/master/struct_e_f_i___b_o_o_t___s_e_r_v_i_c_e_s.html>).
--
Rebecca Cran
--
Best,
Daniel


Sean
 

I have found that VSCode opening the edk2 folder does a decent job of giving you resolution of symbols but you still have to understand edk2 specifics like library resolution, public/private files, packages, and the "platform" DSC file.

On 3/4/2021 10:15 AM, wonderfly@waymo.com wrote:
Started looking at EDKII code about two months ago. One of the things I still haven't figured out is how to read code effectively, possibly with the help of cross referencing tools. Haven't got much luck with cscope, and I don't see any compile_commands.json being generated either.
What do you folks use for cross referencing? What's your development setup like?


Ni, Ray
 

https://bugzilla.tianocore.org/show_bug.cgi?id=2850
I submitted a Bugzilla for compile_commands.json. Are you interested in taking this Bugzilla?

-----Original Message-----
From: rfc@edk2.groups.io <rfc@edk2.groups.io> On Behalf Of wonderfly@waymo.com
Sent: Friday, March 5, 2021 2:16 AM
To: rfc@edk2.groups.io
Subject: [edk2-rfc] Cross referencing EDKII code

Started looking at EDKII code about two months ago. One of the things I still haven't figured out is how to read code effectively,
possibly with the help of cross referencing tools. Haven't got much luck with cscope, and I don't see any
compile_commands.json being generated either.

What do you folks use for cross referencing? What's your development setup like?




Daniel Wang <wonderfly@...>
 

Very nice!  Thank you for the pointers.  I wonder how the cross links were created and whether it's possible to integrate them into my editor (vim).   If not, is there a build target for doxygen?  So that I could generate these html files for the branch I am on?

On Thu, Mar 4, 2021 at 2:12 PM Rebecca Cran <rebecca@...> wrote:
On 3/4/21 11:15 AM, wonderfly@... wrote:
> Started looking at EDKII code about two months ago.  One of the things I still haven't figured out is how to read code effectively, possibly with the help of cross referencing tools.  Haven't got much luck with cscope, and I don't see any compile_commands.json being generated either.
>
> What do you folks use for cross referencing?  What's your development setup like?

Personally, I've found Doxygen a great help in understanding EDK2. I've
been maintaining a build of the documentation at
https://bsdio.com/edk2/docs/master/index.html for a few years.


I think I've enabled all the search and browsing features, so for
example you can use the search bar in the top-right corner to find the
EFI_BOOT_SERVICES docs
(https://bsdio.com/edk2/docs/master/struct_e_f_i___b_o_o_t___s_e_r_v_i_c_e_s.html).

--
Rebecca Cran


--
Best,
Daniel


Nhi Pham
 

I'm also using VSCode for edk2 development. If your workspace is not in local machine but in a remote server, you can use Remote Development extension (SSH tunnel). It works well for me.

Below are other helpful extensions that you can consider to install:
- C/C++
- C++ Intellisense
- Visual Studio IntelliCode
- edk2-vscode
- Gitlens

Best regards,
Nhi

On 3/5/21 08:37, Sean via groups.io wrote:
I have found that VSCode opening the edk2 folder does a decent job of giving you resolution of symbols but you still have to understand edk2 specifics like library resolution, public/private files, packages, and the "platform" DSC file.



On 3/4/2021 10:15 AM, wonderfly@waymo.com wrote:
Started looking at EDKII code about two months ago.  One of the things I still haven't figured out is how to read code effectively, possibly with the help of cross referencing tools.  Haven't got much luck with cscope, and I don't see any compile_commands.json being generated either.

What do you folks use for cross referencing?  What's your development setup like?







Laszlo Ersek
 

On 03/04/21 19:15, wonderfly@waymo.com wrote:
Started looking at EDKII code about two months ago. One of the
things I still haven't figured out is how to read code effectively,
possibly with the help of cross referencing tools. Haven't got much
luck with cscope, and I don't see any compile_commands.json being
generated either.

What do you folks use for cross referencing? What's your development
setup like?
I use "Exuberant Ctags" for generating a "tags" file, and NEdit for
editing source code. NEdit loads the "tags" file and can jump to
definitions. If there are multiple function definitions, NEdit offers a
list of matches to pick from -- which is really helpful whenever
multiple lib instances implement a particular library class (i.e., when
multiple function definitions exist for a particular prototype).

Thanks
Laszlo


Brian J. Johnson
 

I use cscope, and the "rscope" extension to emacs. I use a script to collect source files and include directories from the source tree to generate the cscope.files file. That works, but isn't smart about removing code which isn't actually compiled in a particular build. So it requires some familiarity with the sources to understand which symbol matches are relevant.

Brian

-------- Original Message --------
From: wonderfly@waymo.com
Sent: Thursday, March 4, 2021, 12:15 PM
To: rfc@edk2.groups.io
Subject: [edk2-rfc] Cross referencing EDKII code

Started looking at EDKII code about two months ago. One of the things I still haven't figured out is how to read code effectively, possibly with the help of cross referencing tools. Haven't got much luck with cscope, and I don't see any compile_commands.json being generated either.

What do you folks use for cross referencing? What's your development setup like?







--
Brian J. Johnson
Enterprise X86 Lab

Hewlett Packard Enterprise
hpe.com


Daniel Wang <wonderfly@...>
 

Ah, ctags!  Haven't used that for years.  I'll give it a shot.  Thanks for sharing.

On Fri, Mar 5, 2021 at 5:47 AM Laszlo Ersek <lersek@...> wrote:
On 03/04/21 19:15, wonderfly@... wrote:
> Started looking at EDKII code about two months ago.  One of the
> things I still haven't figured out is how to read code effectively,
> possibly with the help of cross referencing tools.  Haven't got much
> luck with cscope, and I don't see any compile_commands.json being
> generated either.
>
> What do you folks use for cross referencing?  What's your development
> setup like?

I use "Exuberant Ctags" for generating a "tags" file, and NEdit for
editing source code. NEdit loads the "tags" file and can jump to
definitions. If there are multiple function definitions, NEdit offers a
list of matches to pick from -- which is really helpful whenever
multiple lib instances implement a particular library class (i.e., when
multiple function definitions exist for a particular prototype).

Thanks
Laszlo



--
Best,
Daniel


Daniel Wang
 

Yeah, I have the same problem with cscope. Too many matches for one
symbol.

On Fri, Mar 5, 2021 at 12:53 PM Brian J. Johnson <brian.johnson@hpe.com>
wrote:

I use cscope, and the "rscope" extension to emacs. I use a script to
collect source files and include directories from the source tree to
generate the cscope.files file. That works, but isn't smart about
removing code which isn't actually compiled in a particular build. So
it requires some familiarity with the sources to understand which symbol
matches are relevant.

Brian

-------- Original Message --------
From: wonderfly@waymo.com
Sent: Thursday, March 4, 2021, 12:15 PM
To: rfc@edk2.groups.io
Subject: [edk2-rfc] Cross referencing EDKII code

Started looking at EDKII code about two months ago. One of the things I
still haven't figured out is how to read code effectively, possibly with
the help of cross referencing tools. Haven't got much luck with cscope,
and I don't see any compile_commands.json being generated either.

What do you folks use for cross referencing? What's your development
setup like?







--
Brian J. Johnson
Enterprise X86 Lab

Hewlett Packard Enterprise
hpe.com

--
Best,
Daniel