Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: "Ali Tamur via gdb-patches" <gdb-patches@sourceware.org>
To: gdb-patches@sourceware.org
Cc: Tom Tromey <tom@tromey.com>
Subject: Re: [PATCH] Fix infinite recursion bug at get_msymbol_address.
Date: Tue, 19 Nov 2019 03:47:00 -0000	[thread overview]
Message-ID: <CAH=Am=6TBqZveYhvese+Z1c03Z91-5U2KtfFRK0vniMNpH4ZTQ@mail.gmail.com> (raw)
In-Reply-To: <CAH=Am=7Us-uQKEjwoqBxm7JbhScR-rj+tsFzH386LJLymf3K_Q@mail.gmail.com>

If there are no objections, I am planning to check this in a couple days.
Thank you.
Ali

On Wed, Nov 13, 2019 at 10:34 AM Ali Tamur <tamur@google.com> wrote:

> Friendly ping?
>
> On Wed, Nov 6, 2019 at 8:05 PM Ali Tamur <tamur@google.com> wrote:
>
>> The patch 4b610737f0 seems to have introduced the possibility of infinite
>> recursion. I have encountered the problem while debugging a failing
>> in-house
>> test. I am sorry, it is fairly difficult to reduce the test case (and I
>> don't
>> understand most of what is going on) but the stack trace shows a call to
>> objfpy_add_separate_debug_file, which eventually causes
>> lookup_minimal_symbol_by_pc_name to be invoked, which calls
>> get_msymbol_address.
>> Somehow lookup_minimal_symbol_linkage finds the same symbol and the
>> function
>> calls itself with the same parameters. I don't know whether this should be
>> classified as 'it should never happen', but this simple patch makes the
>> test
>> pass and should be harmless, I think.
>>
>> gdb/ChangeLog
>>
>>         * symtab.c (get_msymbol_address): Guard against infinite
>> recursion.
>> ---
>>  gdb/symtab.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/gdb/symtab.c b/gdb/symtab.c
>> index 2c934b9c22..b231cc6e84 100644
>> --- a/gdb/symtab.c
>> +++ b/gdb/symtab.c
>> @@ -6328,7 +6328,7 @@ get_msymbol_address (struct objfile *objf, const
>> struct minimal_symbol *minsym)
>>         {
>>           bound_minimal_symbol found
>>             = lookup_minimal_symbol_linkage (linkage_name, objfile);
>> -         if (found.minsym != nullptr)
>> +         if (found.minsym != nullptr && found.minsym != minsym)
>>             return BMSYMBOL_VALUE_ADDRESS (found);
>>         }
>>      }
>> --
>> 2.24.0.rc1.363.gb1bccd3e3d-goog
>>
>>


  reply	other threads:[~2019-11-19  3:47 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-07  4:05 Ali Tamur via gdb-patches
2019-11-13 18:34 ` Ali Tamur via gdb-patches
2019-11-19  3:47   ` Ali Tamur via gdb-patches [this message]
2019-11-19  5:15 ` Simon Marchi
2019-11-20  0:03   ` Ali Tamur via gdb-patches
2019-11-20  0:35     ` Simon Marchi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAH=Am=6TBqZveYhvese+Z1c03Z91-5U2KtfFRK0vniMNpH4ZTQ@mail.gmail.com' \
    --to=gdb-patches@sourceware.org \
    --cc=tamur@google.com \
    --cc=tom@tromey.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox