shafik added a comment.

In D70846#1766598 <https://reviews.llvm.org/D70846#1766598>, @labath wrote:

> In D70846#1766204 <https://reviews.llvm.org/D70846#1766204>, @shafik wrote:
>
> > In D70846#1763731 <https://reviews.llvm.org/D70846#1763731>, @labath wrote:
> >
> > > There's `lldb-shell :: SymbolFile/DWARF/find-basic-function.cpp`, which 
> > > probably didn't get run for you as you didn't have lld enabled (cmake 
> > > -DLLVM_ENABLE_PROJECTS=...;lld). You'll need to update that test to match 
> > > the new behavior, but other than that, I think this is a good change.
> >
> >
> > So with this change for the `find-basic-function.cpp` test I no longer see 
> > any results for the `full` case so we should at least generate a case that 
> > has results for the `full` case.
>
>
> There's an additional check in that test which does a search by a mangled 
> name (search for FULL-MANGLED), and this one does return some result. If this 
> patch lands, I'm not sure if there's any other kind of a "full" lookup that 
> we could perform. `eFunctionNameTypeFull` is documented as: `... For C this 
> is the same as just the name of the function For C++ this is the mangled or 
> demangled version of the mangled name...`, which appears like we should 
> support searching by *de*mangled names. However, I'm not sure if that is 
> actually a good idea. Implementing that for the manual index would be simple 
> enough, but that is something that the apple index could never support (in 
> fact, I think I remember that the manual index once supported searching by 
> demangled names, but then I removed this ability for consistency when adding 
> debug_names support).
>
> That said, I think it may be interesting to add a test searching for an 
> `extern "C"` symbol (which has no "mangled" name), as right now it's not 
> clear if it will show up because of `function_fullnames.Find` or 
> `function_basenames.Find`...


I did see that and I was just a little confused by the mixed results I was 
seeing.

I had put together a few test programs to better understand how it works e.g.:

  namespace A {
    int foo() {
        return 2;
    }
  }
  
  int main() {
   return A::foo() ;
  }

and when I run `lldb-test symbols --name=foo --find=function 
--function-flags=full function_full.o` I see:

  Module: function_full.o
  Found 1 functions:
  0x00007ffee5ad3438: SymbolContextList
         Module: file = "function_full.o", arch = "x86_64"
    CompileUnit: id = {0xffffffff00000000}, file = 
"/Users/shafik/code/function_full.cpp", language = "c++"
       Function: id = {0xffffffff0000002f}, name = "A::foo()", mangled = 
"_ZN1A3fooEv", range = function_full.o[0x0000000000000000-0x000000000000000b)
       FuncType: id = {0xffffffff0000002f}, byte-size = 0, decl = 
/Users/shafik/code/function_full.cpp:2, compiler_type = "int (void)"

which seems inconsistent with what I am seeing with `find-basic-function.cpp` 
or at least it is not obvious to me what the difference is.

I think at least adding a test case for the `extern "C"` case would be good as 
well.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D70846/new/

https://reviews.llvm.org/D70846



_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to