Skip to content
Commit de9ba0d3 authored by Tom Tromey's avatar Tom Tromey Committed by Joel Brobecker
Browse files

Avoid infinite recursion in get_msymbol_address

Sometimes, get_msymbol_address can cause infinite recursion, leading
to a crash.  This was reported previously here:

https://sourceware.org/pipermail/gdb-patches/2019-November/162154.html

A user on irc reported this as well, and with his help and the help of
a friend of his, we found that the problem occurred because, when
reloading a separate debug objfile, the objfile would lose the
OBJF_MAINLINE flag.  This would cause some symbols from this separate
debug objfile to be marked "maybe_copied" -- but then
get_msymbol_address could find the same symbol and fail as reported.

This patch fixes the bug by preserving OBJF_MAINLINE.

No test case, unfortunately, because I could not successfully make
one.

gdb/ChangeLog
2020-04-10  Tom Tromey  <tromey@adacore.com>

	* symfile.c (symbol_file_add_separate): Preserve OBJF_MAINLINE.

(cherry picked from commit 0c4311ab)
parent 40ce64f0
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment