Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Why I don't like DXR

99 views
Skip to first unread message

Honza Bambas

unread,
Sep 26, 2016, 9:14:47 AM9/26/16
to dev-pl...@lists.mozilla.org
Today I tried to search for an identifier on DXR. Something that was so
easy with MXR...

I wanted to find usage of a member called "io_pending". Typing that
string to the DXR search field gives me a number of results that are
definitely not what I'm looking for, like lines containing
ERROR_IO_PENDING. Using var:io_pending or ref:io_pending returns zero
results, despite the identifier is definitely used in the code base.
So, I tried to look only for assignments to this identifier (a member
variable, actually), so I typed "io_pending = " to the search field.
And what a surprise! I got the same result as for pure "io_pending", so
very far from what I was looking for and expecting to get.


Questions:

- how can I look for a string as always _case sensitive_ and _whole word
only_ ? MXR was capable of searching for 'identifiers', why doesn't DXR
provide something simple as that as well?

- how can I simply limit search to be performed only in a certain
directory and it's sub-dirs?



Thanks.

-hb-


Karl Dubost

unread,
Sep 26, 2016, 9:24:54 AM9/26/16
to Honza Bambas, dev-pl...@lists.mozilla.org

Le 26 sept. 2016 à 22:14, Honza Bambas <hba...@mozilla.com> a écrit :
> - how can I look for a string as always _case sensitive_ and _whole word only_ ?

Probably not exactly what you are looking for, but:

https://dxr.mozilla.org/mozilla-central/search?q=%22+io_pending%22&redirect=false

--
Karl Dubost, Mozilla
http://www.la-grange.net/karl/moz

Andrew Osmond

unread,
Sep 26, 2016, 9:25:40 AM9/26/16
to Honza Bambas, dev-pl...@lists.mozilla.org
I think it is a matter of failing to parse/index all of the code; for
example, var:mError works for me as I think you would expect. If I find a
definition of "io_pending":

https://dxr.mozilla.org/mozilla-central/source/nsprpub/pr/include/private/primpl.h#1608

I notice that it isn't recognized as a variable; just a few lines above
however, syspoll_count is fine:

https://dxr.mozilla.org/mozilla-central/source/nsprpub/pr/include/private/primpl.h#1600

It may be related to preprocessor. I see the unrecognized symbols often
(always?) are placed inside an #ifdef where the #define is not found /
highlighted in blue.

On Mon, Sep 26, 2016 at 9:14 AM, Honza Bambas <hba...@mozilla.com> wrote:

> Today I tried to search for an identifier on DXR. Something that was so
> easy with MXR...
>
> I wanted to find usage of a member called "io_pending". Typing that
> string to the DXR search field gives me a number of results that are
> definitely not what I'm looking for, like lines containing
> ERROR_IO_PENDING. Using var:io_pending or ref:io_pending returns zero
> results, despite the identifier is definitely used in the code base. So, I
> tried to look only for assignments to this identifier (a member variable,
> actually), so I typed "io_pending = " to the search field. And what a
> surprise! I got the same result as for pure "io_pending", so very far from
> what I was looking for and expecting to get.
>
>
> Questions:
>
> - how can I look for a string as always _case sensitive_ and _whole word
> only_ ? MXR was capable of searching for 'identifiers', why doesn't DXR
> provide something simple as that as well?
>
> - how can I simply limit search to be performed only in a certain
> directory and it's sub-dirs?
>
>
>
> Thanks.
>
> -hb-
>
>
> _______________________________________________
> dev-platform mailing list
> dev-pl...@lists.mozilla.org
> https://lists.mozilla.org/listinfo/dev-platform
>

Gijs Kruitbosch

unread,
Sep 26, 2016, 9:26:36 AM9/26/16
to Honza Bambas
On 26/09/2016 14:14, Honza Bambas wrote:
> Today I tried to search for an identifier on DXR. Something that was so
> easy with MXR...
>
> I wanted to find usage of a member called "io_pending". Typing that
> string to the DXR search field gives me a number of results that are
> definitely not what I'm looking for, like lines containing
> ERROR_IO_PENDING. Using var:io_pending or ref:io_pending returns zero
> results, despite the identifier is definitely used in the code base.
> So, I tried to look only for assignments to this identifier (a member
> variable, actually), so I typed "io_pending = " to the search field.
> And what a surprise! I got the same result as for pure "io_pending", so
> very far from what I was looking for and expecting to get.
>
>
> Questions:
>
> - how can I look for a string as always _case sensitive_ and _whole word
> only_ ? MXR was capable of searching for 'identifiers', why doesn't DXR
> provide something simple as that as well?

'io_pending =

(note leading quote - you can close the quote as well to search for that
specific string, but it's quicker not to, of course...)

By default dxr tokenizes your input, so if you put "foo bar" (without
quotes) it will give you lines that contain both foo and bar,
individually. That is sometimes helpful, but not here.


> - how can I simply limit search to be performed only in a certain
> directory and it's sub-dirs?

foo path:browser/base/content/test/

will give only results containing 'foo' from files that match that path.
Note that the path is not 'leading' specific, so e.g. path:.gif or
path:browser_ are also valid expressions that might be useful in
specific searches.

~ Gijs

Jonathan Kew

unread,
Sep 26, 2016, 9:27:31 AM9/26/16
to dev-pl...@lists.mozilla.org
On 26/9/16 14:14, Honza Bambas wrote:
> Today I tried to search for an identifier on DXR. Something that was so
> easy with MXR...
>
> I wanted to find usage of a member called "io_pending". Typing that
> string to the DXR search field gives me a number of results that are
> definitely not what I'm looking for, like lines containing
> ERROR_IO_PENDING. Using var:io_pending or ref:io_pending returns zero
> results, despite the identifier is definitely used in the code base.
> So, I tried to look only for assignments to this identifier (a member
> variable, actually), so I typed "io_pending = " to the search field.
> And what a surprise! I got the same result as for pure "io_pending", so
> very far from what I was looking for and expecting to get.
>
>
> Questions:
>
> - how can I look for a string as always _case sensitive_ and _whole word
> only_ ? MXR was capable of searching for 'identifiers', why doesn't DXR
> provide something simple as that as well?

This is only a partial answer, but if you prefix your search with "@"
then it'll be case-sensitive, so simply

@io_pending

will get you closer to what you were looking for.

JK

>
> - how can I simply limit search to be performed only in a certain
> directory and it's sub-dirs?
>
>
>

Erik Rose

unread,
Sep 26, 2016, 10:47:36 AM9/26/16
to Honza Bambas, dev-pl...@lists.mozilla.org
> I wanted to find usage of a member called "io_pending".


DXR is happy to search for identifiers (id:whatever). The problem is that all the uses of io_pending are #ifdef'd out when compiling for Linux, which is the platform we use to run the indexing job for moz-central. A clue is that there's not much of a symbolic context menu when clicking on io_pending: you get offered only "Search for the substring io_pending". So, when you're searching for platform-specific things that aren't Linux, you have to fall back to text search. In addition, you have regexes at your disposal, so something using word boundaries like regexp:\bio_pending\b might serve.

> By default dxr tokenizes your input, so if you put "foo bar" (without quotes) it will give you lines that contain both foo and bar, individually. That is sometimes helpful, but not here.

Specifically, DXR finds all the lines that contain all the space-delimited terms in the query, due to long tradition. As Gijs and others point out, quotes can be used to match whole phrases. I've shopped around the idea of changing this behavior, but nobody seemed interested. If anyone feels strongly, the polls can be reopened!

>> - how can I simply limit search to be performed only in a certain
>> directory and it's sub-dirs?
>
> foo path:browser/base/content/test/

You can also click any dir name in the search results, and you'll get a context menu including "Limit search to folder" and "Exclude folder from search".

Cheers,
Erik

Honza Bambas

unread,
Sep 28, 2016, 11:52:23 AM9/28/16
to dev-pl...@lists.mozilla.org
Thanks everyone for answers. This is helpful, but why don't I see any
help like this right on DXR? Why do I have to ask on dev-platform?

According identifiers not found on DXR I presume MXR might suffered the
same issue, so no blame for DXR here. I was just confused by not being
able to easily do a fallback search.

Now I do.

Thanks!

-hb-

Eric Rahm

unread,
Sep 28, 2016, 4:30:58 PM9/28/16
to Honza Bambas, dev-platform
It's sounds like some sort of mxr => dxr transition wiki entry would be
useful. Perhaps you can start by collecting the feedback you received here?

-e

Erik Rose

unread,
Sep 28, 2016, 4:35:12 PM9/28/16
to Eric Rahm, dev-platform, Honza Bambas
I second the sentiment: it's clear that DXR needs a real manual. I've got the start of one at https://dxr.readthedocs.io/en/latest/use.html. So if you want to file PRs against https://github.com/mozilla/dxr/blob/master/docs/source/use.rst, we can grow that into a proper manual, import it into the app, and hang it off the "?" button—which is probably where you went looking for help in the first place. I'll endeavor to merge any such PRs promptly.

Erik
0 new messages