Thanks for suggestions from @ssbssa. I tried the GDB version 16.2 with the aforementioned settings, and the problem was solved.