Hi,

I've come across a problem when using libreadline6 in one of my programs.
Whenever I hit the up arrow to go back in history, I got a SEGFAULT.

These are the stats:
  Version: 6.3 (libreadline6-dev in Ubuntu 15.10)
  Machine and OS: PC & Ubuntu 15.10

Debugging the application, I noticed that the SEGFAULT was issued
in HIST_ENTRY *previous_history() in history.c, which was called by
int rl_get_previous_history (count, key) int count, key; in misc.c.

The global variable "the_history" was 0x0 in history.c and some other
sensible value in misc.c.  Since it was 0x0 in history.c, the SEGFAULT
happened.

I guess that the error comes because there are two separate libraries
for each function:
libhistory.so.6 and libreadline.so.6, and each export a different
"the_library" symbol:

$ nm /usr/lib/debug/libreadline.so.6 | grep the_history
0000000000245c38 b the_history
$ nm /usr/lib/debug/libhistory.so.6 | grep the_history
0000000000208178 b the_history

If I compile my program with:
  g++ ... -lhistory -lreadline
I get the problem.

While if I compile the program with the opposite order:
  g++ ... -lreadline -lhistory
Everything works.

Hope this helps.  If this isn't a problem related to the library,
please ignore.

Thanks,
Gyermo.


--
Enviado desde mi 486 clOnico a 50 Mhz.


_______________________________________________
Bug-readline mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/bug-readline

Reply via email to