Pernosco / pernosco

General-purpose public wiki and issue tracking
12 stars 0 forks source link

Calling nsIURI->GetSpecOrDefault() doesn't work #44

Closed julienw closed 3 years ago

julienw commented 3 years ago

From https://github.com/Pernosco/pernosco/issues/43#issuecomment-804211826:

I will note that you should be able to write myURI->GetSpecOrDefault() in an expression and have it work. If that doesn't work that's a separate bug.

This doesn't work:

STR:

  1. open this debug link
  2. search for executions of profiler_add_network_marker
  3. aURI is the first argument for this function.
  4. print aURI->mSpec => this works
  5. print aURI->GetSpec() => this works (but is quite useless)
  6. print aURI->GetSpecOrDefault() => this doesn't work

This is implemented here: https://searchfox.org/mozilla-central/source/__GENERATED__/dist/include/nsIURI.h#55-63

khuey commented 3 years ago

Alright I debugged this today and there are three separate problems here:

  1. We don't search beyond the current CU for a function to call. For functions that are defined in headers like this that doesn't work.
  2. We don't filter out inline functions from our search of functions to evaluate. Since inline functions don't have a defined calling convention, that explodes.
  3. At the assembly level, this function has an implicit in/out param. Space needs to be allocated on the callee's stack for the nsCString and an address to it passed in as an implicit second parameter (after this) to the function.

The first two of these are trivial to fix but the third will take some time.

khuey commented 3 years ago

There's also the question of what to do if the function here allocates or otherwise is not a simple getter but generates content for the output. That's essentially equivalent to internal issue 129 and we don't have an answer for it yet.

khuey commented 3 years ago

This is fixed now.