malloc'd memory from gdb command line cannot be freed from within binary on remote gdbserver in RHEL

Solution Verified - Updated -

Issue

The malloc'd memory from gdb command line cannot be freed from within binary on remote gdb server.  This is caused by the prelink utility, which randomizes virtual addresses of segments to be loaded, and also the addresses of symbols accordingly.

Because of the prelink, and the fact that gdb calculates addresses of symbols from libraries stored on local computer rather than the computer gdbserver is running on, it can happen and happens every 14 days that libraries get prelinked by prelink through crond. Thus the client gdb tries to call functions with different address than address of the same function loaded in the binary on the gdbserver side, which leads to accessing wrong address of un-allocated memory and that is the reason of the SIGSEGV. That is also why it  works when gdbserver and gdb are running on the same computer.

Environment

  • Red Hat Enterprise Linux (RHEL) 5
  • gdb 6.5 - gdb 7.0

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In
Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.