Pork: Difference between revisions

From MozillaWiki
Jump to navigation Jump to search
No edit summary
 
(5 intermediate revisions by 2 users not shown)
Line 1: Line 1:
Pork is a set of tools built around the elsa C/C++ parser. The primary focus of pork is to provide automated refactoring ([[Gecko:DeCOMtamination]]) and static analysis tools for Mozilla2. [http://blog.mozilla.com/tglek/2007/07/13/dehydra-prcheck-squash-in-mercurial/ Pork announcement]
Pork is a set of tools built around the [http://www.cs.berkeley.edu/~smcpeak/elkhound/ elsa] C/C++ parser. The primary focus of pork is to provide automated refactoring ([[Gecko:DeCOMtamination]]) and static analysis tools for Mozilla2. [http://blog.mozilla.com/tglek/2007/07/13/dehydra-prcheck-squash-in-mercurial/ Pork announcement].
 
To install the tools on your regular machine, follow [[Static Analysis/Installing the Oink Stack]]


Pork is a fork of [http://www.cubewano.org/oink oink]. In the future pork should become a development branch for oink.
Pork is a fork of [http://www.cubewano.org/oink oink]. In the future pork should become a development branch for oink.
Line 6: Line 8:


=== Requirements ===
=== Requirements ===
* GCC 3.4.x or older that can successfully build Mozilla. 64bit Ubuntu, 32bit RHEL/CentOS are known to work. 32bit Ubuntu/Debian feature a linker bug that prevents Mozilla from building with gcc 3.4.6.
* GCC 3.4.x or older that can successfully build Mozilla. 64bit Ubuntu, 32bit RHEL/CentOS are known to work. 32bit Ubuntu/Debian feature a linker bug that prevents Mozilla from building with gcc 3.4.6. Note: Recent work on Pork's Elsa allows it to be used with GCC 4.2
* MCPP is required for refactoring tools
* MCPP is required for refactoring tools
* [[SpiderMonkey]] is required by [[DeHydra]]
* [[SpiderMonkey]] is required by [[DeHydra]]
Line 13: Line 15:
* MQ extension for hg is recommended. Alternatively, quilt can be used instead.
* MQ extension for hg is recommended. Alternatively, quilt can be used instead.


=== Tools ===
=== Pork Tools ===
Pork is broken down into tools that focus on a specific tasks. The tools can rarely be combined and thus should be applied incrementally.
Pork is broken down into tools that focus on a specific tasks. The tools can rarely be combined and thus should be applied incrementally.
* [[DeHydra]] is a scriptable static analysis tool. It is useful for finding patterns in the codebase. It has been used to find bugs, produce class diagrams and to infer auto-refactoring candidates in the code.


* [[Outparamdel]] rewrites code using outparameters to utilize the return value instead. [http://blog.mozilla.com/tglek/2007/08/06/outparams-take-2/ Blog entry]
* [[Outparamdel]] rewrites code using outparameters to utilize the return value instead. [http://blog.mozilla.com/tglek/2007/08/06/outparams-take-2/ Blog entry]
Line 27: Line 27:


* [[PorkVM]] is a CentOS virtual machine image with a presetup pork + moz checkout.
* [[PorkVM]] is a CentOS virtual machine image with a presetup pork + moz checkout.
* [[PorkBarrel]] is a multiplexer(ala make -j) for the pork tools. It can combine patch output for patch-producing tools and save per-file output for DeHydra. The repository also contains a frontend to do nightly runs of prcheck.
* [[Dehydra GCC]] a static analysis plugin for GCC.
=== Differences from Mainstream ===
In addition to adding more oink tools, pork has some differences from [http://www.cs.berkeley.edu/~smcpeak/elkhound/ Elsa and Elkhound].
* Elkhound has been extended to provide end-of-node position information
* Elsa mods:
** Expression AST nodes were modified to include end-of-node info + associated bugfixes
** Elsa has been extended to support MCPP's macro-undo(-K) mode. Additional APIs were added to convert post-preprocessing source coordinates into pre-preprocessing ones
** Elsa has received bugfixes to work with recent GCC (4.2) headers

Latest revision as of 23:22, 29 April 2008

Pork is a set of tools built around the elsa C/C++ parser. The primary focus of pork is to provide automated refactoring (Gecko:DeCOMtamination) and static analysis tools for Mozilla2. Pork announcement.

To install the tools on your regular machine, follow Static Analysis/Installing the Oink Stack

Pork is a fork of oink. In the future pork should become a development branch for oink.

More info for pork can be found on Taras' blog.

Requirements

  • GCC 3.4.x or older that can successfully build Mozilla. 64bit Ubuntu, 32bit RHEL/CentOS are known to work. 32bit Ubuntu/Debian feature a linker bug that prevents Mozilla from building with gcc 3.4.6. Note: Recent work on Pork's Elsa allows it to be used with GCC 4.2
  • MCPP is required for refactoring tools
  • SpiderMonkey is required by DeHydra
  • Bison and Flex
  • patchutils are recommended to manage manual and automatic patches
  • MQ extension for hg is recommended. Alternatively, quilt can be used instead.

Pork Tools

Pork is broken down into tools that focus on a specific tasks. The tools can rarely be combined and thus should be applied incrementally.

  • Prcheck is a static analysis tool which produces patches as output. It is useful for correcting bugs that resulting PRBool behaving more like an int than a C++ bool. Blog entry
  • Squash is now obsolete. It was primarily written to explore how elsa can be utilized to assist with Gecko:DeCOMtamination. Many rewriting strategies and patching code were first implemented in squash.
  • PorkVM is a CentOS virtual machine image with a presetup pork + moz checkout.
  • PorkBarrel is a multiplexer(ala make -j) for the pork tools. It can combine patch output for patch-producing tools and save per-file output for DeHydra. The repository also contains a frontend to do nightly runs of prcheck.



Differences from Mainstream

In addition to adding more oink tools, pork has some differences from Elsa and Elkhound.

  • Elkhound has been extended to provide end-of-node position information
  • Elsa mods:
    • Expression AST nodes were modified to include end-of-node info + associated bugfixes
    • Elsa has been extended to support MCPP's macro-undo(-K) mode. Additional APIs were added to convert post-preprocessing source coordinates into pre-preprocessing ones
    • Elsa has received bugfixes to work with recent GCC (4.2) headers