This is the mail archive of the gdb-prs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug gdb/20633] New: JIT code debugging doesn't work with dynamically linked LLVM


https://sourceware.org/bugzilla/show_bug.cgi?id=20633

            Bug ID: 20633
           Summary: JIT code debugging doesn't work with dynamically
                    linked LLVM
           Product: gdb
           Version: 7.11.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: gdb
          Assignee: unassigned at sourceware dot org
          Reporter: yyc1992 at gmail dot com
  Target Milestone: ---

Copied from https://sourceware.org/ml/gdb/2016-09/msg00059.html (I somehow
thought there wasn't a bug tracker and the mailing list is used for that...)


The symptom is that when we switch to dynamically linked LLVM (shared
library, instead of static library), the JIT code debugging doesn't
work anymore.

I've just traced down the issue to this piece of code in
`jit_breakpoint_re_set_internal`

```
      reg_symbol = lookup_minimal_symbol_and_objfile (jit_break_name);
      if (reg_symbol.minsym == NULL
      || BMSYMBOL_VALUE_ADDRESS (reg_symbol) == 0)
    return 1;

      desc_symbol = lookup_minimal_symbol (jit_descriptor_name, NULL,
                       reg_symbol.objfile);
      if (desc_symbol.minsym == NULL
      || BMSYMBOL_VALUE_ADDRESS (desc_symbol) == 0)
    return 1;
```

The issue is that `lookup_minimal_symbol_and_objfile (jit_break_name)`
returns the plt entry in our code that links to LLVM so obviously the
lookup for the desc_symbol cannot success since there's no plt entry
for it..... (and even if it does, the breakpoint is still set on the
wrong function)

This can probably be fixed by skipping plt entries in the first symbol
lookup (no patch attached since I don't know how to do that in gdb).
It might also be nice if multiple symbols presented in different
libraries can be supported to.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]