Have you ever wanted to know what the layout of a C++ class/struct looked like across our 4 debug build platforms for mozilla-central?  But have you also felt like such awesome power really should be unpleasant in some way?  Like having to fire up gdb and type `ptype /o ClassName` a bunch unpleasant?  Then you will love searchfox's new alpha-gated[1] `field-layout` query mechanism!

When enabled, your context menu will gain a new menu item "Class layout of ClassName" and this will generate a link to searchfox's query endpoint with a query of `field-layout:'namespace::ClassName'`.  You will then be able to luxuriate in a HTML table that will provide you with the carefully calibrated sense of satisfaction that can only come from having to really wrestle with a computer to get information it readily has available but it doesn't want you to know[2].

It is also possible to use the query endpoint directly without enabling the context menu option.  Similar to how you can right-click on a search-endpoint targeting input field and select "Add a Keyword for this search", you can do the same on the query-endpoint page to create a keyword bookmark for https://searchfox.org/mozilla-central/query/default?q=%s [3].

An example query you can try out is: https://searchfox.org/mozilla-central/query/default?q=field-layout%3A%27nsGlobalWindowInner%27

Keep in mind that in the face of multiple inheritance, superclass offsets will potentially involve an additional secret offset that searchfox doesn't want you to know and has not yet been convinced to let you know[4].

Andrew

1: There is a settings page at https://searchfox.org/mozilla-central/pages/settings.html and if you set your default feature gate to "alpha" you will get all the features!  If you just want this one specific feature, it's under "Semantic Info Queries".

2: Searchfox has known this information for nearly 3 years, and its prototypes have known for 4 years (https://clicky.visophyte.org/files/screenshots/20200331-021616.png)!

3: I personally use "sf" for the search endpoint for mozilla-central and "sfq" for the query endpoint, which means I can do things like type `sfq field-layout:'mozilla::dom::WorkerPrivate'` and go directly to the results. Note that while searchfox has some weird additional HTML form elements, all functionality except case-sensitivity is directly available from the primary search box as documented at https://bugzilla.mozilla.org/show_bug.cgi?id=1762817#c0.  If you want to right-click to add the bookmark yourself, https://searchfox.org/mozilla-central/query/default?q=%27Searchfox+Query+Endpoint+Please%27 will work.

4: As always, please do let your manager know if you think improvements to searchfox could help make you more productive. Together, we can convince searchfox to reveal the secrets of mozilla-central!

--
You received this message because you are subscribed to the Google Groups 
"dev-platform@mozilla.org" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to dev-platform+unsubscr...@mozilla.org.
To view this discussion on the web visit 
https://groups.google.com/a/mozilla.org/d/msgid/dev-platform/8be2c12f-3da0-4024-adf7-854fde6fcc44%40asutherland.org.

Reply via email to