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/22560] New: Avoid IPA interfering with regular breakpoints/debugging


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

            Bug ID: 22560
           Summary: Avoid IPA interfering with regular
                    breakpoints/debugging
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: gdb
          Assignee: unassigned at sourceware dot org
          Reporter: palves at redhat dot com
  Target Milestone: ---

As shown in <https://sourceware.org/ml/gdb-patches/2017-12/msg00123.html>, the
IPA is nowadays using standard C++ types like std::vector/std::string and maybe
others, which can conflict with regular debugging.

See example at the bottom.

Having regular debugging interfere with the IPAs internal operations is not
ideal, of course.  Pondering about this at least a few ideas came up:

#1 - maybe we could somehow make GDB just not set user breakpoints in the IPA
(at least by default).  Maybe add a new "do not debug me" attribute to shared
libraries, and then have gdbserver report it for the IPA dso.  (To avoid
hardcoding the name of the IPA library in GDB).  This would make GDB not set
breakpoints on inlined standard C++ functions/methods, but it wouldn't prevent
running into breakpoints for calls to non-inlined standard functions/methods.
(i.e., it'd prevent running into std::vector::end if that's inlined, but not to
std::string::whatever if it's not inlined.)

#2 - just try harder to avoid calling into the C/C++ runtime in all the code
transitively called by gdb_collect.

#3 - Make sure the IPA is fully stripped, except for the symbols that it must
export for fast tracepoint functionality (the symbols that gdbserver must
locate in the agent.  Avoid calling into potentially non-inlined C/C++ runtime
functions.

Maybe solution #3 is the easiest.

  Thread 1 "ftrace" hit Breakpoint 1, main () at
gdb/testsuite/gdb.trace/ftrace.c:50
  50        begin ();
  (gdb) b end
  Breakpoint 2 at 0x40069b: end. (12 locations)
  (gdb) ftrace set_point
  Fast tracepoint 3 at 0x40068b: file src/gdb/testsuite/gdb.trace/ftrace.c,
line 29.
  (gdb) tstart
  (gdb) c
  Continuing.

  Thread 1 "ftrace" hit Breakpoint 2, std::vector<reg*, std::allocator<reg*>
>::end (this=0x613e00) at /usr/include/c++/5.3.1/bits/stl_vector.h:566
  566           { return iterator(this->_M_impl._M_finish); }
  (gdb) bt
  #0  0x00007ffff7b10bc0 in std::vector<reg*, std::allocator<reg*> >::end()
(this=0x613e00) at /usr/include/c++/5.3.1/bits/stl_vector.h:566
  #1  0x00007ffff7b1082c in init_target_desc(target_desc*) (tdesc=0x613e00) at
src/gdb/gdbserver/tdesc.c:27
  #2  0x00007ffff7b14048 in amd64_linux_read_description(unsigned long, bool)
(xcr0=7, is_x32=false)
      at src/gdb/gdbserver/linux-x86-tdesc.c:127
  #3  0x00007ffff7b13e0b in get_ipa_tdesc(int) (idx=2) at
src/gdb/gdbserver/linux-amd64-ipa.c:208
  #4  0x00007ffff7b12d87 in gdb_collect(tracepoint*, unsigned char*)
(tpoint=0x7ffff65c6010, regs=0x7fffffffd830 "\213\006@")
      at src/gdb/gdbserver/tracepoint.c:5800
  #5  0x000000004000007a in  ()
  #6  0x00007ffff65c6010 in  ()
  #7  0x00007ffff7fbf740 in  ()
  #8  0x0000003100000007 in  ()
  #9  0x000000000040068b in marker (anarg=32767) at
src/gdb/testsuite/gdb.trace/ftrace.c:28
  #10 0x00000000004006c3 in main () at src/gdb/testsuite/gdb.trace/ftrace.c:54

-- 
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]