public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "simark at simark dot ca" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug gdb/26876] gdb error: internal-error: Unknown CFA rule when debugging the linux kernel with qemu
Date: Sat, 14 Nov 2020 02:52:17 +0000	[thread overview]
Message-ID: <bug-26876-4717-zNIbmvOuWF@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-26876-4717@http.sourceware.org/bugzilla/>

https://sourceware.org/bugzilla/show_bug.cgi?id=26876

--- Comment #2 from Simon Marchi <simark at simark dot ca> ---
Well, to my surprise, I managed to reproduce!

1. I installed an ubuntu 20.04 guest in qemu
2. I built and installed a kernel in it
3. I debugged the qemu guest (add -s to the qemu command line, don't forget to
pass nokaslr to the Linux kernel)

First, the backtrace:

#0  0x000055befa524260 in execute_cfa_program (fde=0x621000f84c90,
insn_ptr=0x7fab8d86da86 <error: Cannot access memory at address
0x7fab8d86da86>, insn_end=0x7fab8d86da90 <error: Cannot access memory at
address 0x7fab8d86da90>, gdbarch=0x621000be3d10, pc=0xffffffff81b3318e,
fs=0x7ffe0a288d10, text_offset=0x0) at
/home/smarchi/src/binutils-gdb/gdb/dwarf2/frame.c:367
#1  0x000055befa52bf02 in dwarf2_frame_cache (this_frame=0x6210006cfde0,
this_cache=0x6210006cfdf8) at
/home/smarchi/src/binutils-gdb/gdb/dwarf2/frame.c:1025
#2  0x000055befa52ea38 in dwarf2_frame_this_id (this_frame=0x6210006cfde0,
this_cache=0x6210006cfdf8, this_id=0x6210006cfe40) at
/home/smarchi/src/binutils-gdb/gdb/dwarf2/frame.c:1226
#3  0x000055befa8dde95 in compute_frame_id (fi=0x6210006cfde0) at
/home/smarchi/src/binutils-gdb/gdb/frame.c:588
#4  0x000055befa8de53e in get_frame_id (fi=0x6210006cfde0) at
/home/smarchi/src/binutils-gdb/gdb/frame.c:636
#5  0x000055befa8ecf33 in get_prev_frame (this_frame=0x6210006cfde0) at
/home/smarchi/src/binutils-gdb/gdb/frame.c:2504
#6  0x000055befb1ff582 in frame_info_to_frame_object (frame=0x6210006cfde0) at
/home/smarchi/src/binutils-gdb/gdb/python/py-frame.c:364
#7  0x000055befb201016 in gdbpy_newest_frame (self=0x7fabbcb11a40, args=0x0) at
/home/smarchi/src/binutils-gdb/gdb/python/py-frame.c:599
#8  0x00007fabc25f01aa in cfunction_vectorcall_NOARGS (func=0x7fabbca78d60,
args=<optimized out>, nargsf=<optimized out>, kwnames=<optimized out>) at
../Objects/methodobject.c:459
#9  0x00007fabc2405d6d in _PyObject_Vectorcall (kwnames=<optimized out>,
nargsf=<optimized out>, args=<optimized out>, callable=<optimized out>) at
../Include/cpython/abstract.h:127
#10 call_function (tstate=0x612000009940, pp_stack=0x7ffe0a289370,
oparg=<optimized out>, kwnames=0x0) at ../Python/ceval.c:4963
#11 0x00007fabc240def6 in _PyEval_EvalFrameDefault (f=<optimized out>,
throwflag=<optimized out>) at ../Python/ceval.c:3469
#12 0x00007fabc241106b in function_code_fastcall (co=<optimized out>,
args=<optimized out>, nargs=1, globals=<optimized out>) at
../Objects/call.c:283
#13 0x00007fabc2405d6d in _PyObject_Vectorcall (kwnames=<optimized out>,
nargsf=<optimized out>, args=<optimized out>, callable=<optimized out>) at
../Include/cpython/abstract.h:127
#14 call_function (tstate=0x612000009940, pp_stack=0x7ffe0a289540,
oparg=<optimized out>, kwnames=0x0) at ../Python/ceval.c:4963
#15 0x00007fabc240def6 in _PyEval_EvalFrameDefault (f=<optimized out>,
throwflag=<optimized out>) at ../Python/ceval.c:3469
#16 0x00007fabc241106b in function_code_fastcall (co=<optimized out>,
args=<optimized out>, nargs=2, globals=<optimized out>) at
../Objects/call.c:283
#17 0x00007fabc2405d6d in _PyObject_Vectorcall (kwnames=<optimized out>,
nargsf=<optimized out>, args=<optimized out>, callable=<optimized out>) at
../Include/cpython/abstract.h:127
#18 call_function (tstate=0x612000009940, pp_stack=0x7ffe0a289710,
oparg=<optimized out>, kwnames=0x0) at ../Python/ceval.c:4963
#19 0x00007fabc2407018 in _PyEval_EvalFrameDefault (f=<optimized out>,
throwflag=<optimized out>) at ../Python/ceval.c:3486
#20 0x00007fabc255bd3b in _PyEval_EvalCodeWithName (_co=<optimized out>,
globals=<optimized out>, locals=<optimized out>, args=<optimized out>,
argcount=1, kwnames=0x0, kwargs=0x7fabbcb17d98, kwcount=0, kwstep=1, defs=0x0,
defcount=0, kwdefs=0x0, closure=0x7fabbca970a0, name=0x7fabbcbc9470,
qualname=0x7faba48cfc90) at ../Python/ceval.c:4298
#21 0x00007fabc2638de4 in _PyFunction_Vectorcall (func=<optimized out>,
stack=<optimized out>, nargsf=<optimized out>, kwnames=<optimized out>) at
../Objects/call.c:435
#22 0x00007fabc2405d6d in _PyObject_Vectorcall (kwnames=<optimized out>,
nargsf=<optimized out>, args=<optimized out>, callable=<optimized out>) at
../Include/cpython/abstract.h:127
#23 call_function (tstate=0x612000009940, pp_stack=0x7ffe0a2899c8,
oparg=<optimized out>, kwnames=0x0) at ../Python/ceval.c:4963
#24 0x00007fabc240746d in _PyEval_EvalFrameDefault (f=<optimized out>,
throwflag=<optimized out>) at ../Python/ceval.c:3500
#25 0x00007fabc255bd3b in _PyEval_EvalCodeWithName (_co=<optimized out>,
globals=<optimized out>, locals=<optimized out>, args=<optimized out>,
argcount=1, kwnames=0x0, kwargs=0x7faba4734c50, kwcount=0, kwstep=1, defs=0x0,
defcount=0, kwdefs=0x0, closure=0x0, name=0x7faba4742a30,
qualname=0x7faba4736210) at ../Python/ceval.c:4298
#26 0x00007fabc2638de4 in _PyFunction_Vectorcall (func=<optimized out>,
stack=<optimized out>, nargsf=<optimized out>, kwnames=<optimized out>) at
../Objects/call.c:435
#27 0x00007fabc2405d6d in _PyObject_Vectorcall (kwnames=<optimized out>,
nargsf=<optimized out>, args=<optimized out>, callable=<optimized out>) at
../Include/cpython/abstract.h:127
#28 call_function (tstate=0x612000009940, pp_stack=0x7ffe0a289c70,
oparg=<optimized out>, kwnames=0x0) at ../Python/ceval.c:4963
#29 0x00007fabc2407018 in _PyEval_EvalFrameDefault (f=<optimized out>,
throwflag=<optimized out>) at ../Python/ceval.c:3486
#30 0x00007fabc241106b in function_code_fastcall (co=<optimized out>,
args=<optimized out>, nargs=3, globals=<optimized out>) at
../Objects/call.c:283
#31 0x00007fabc2639da8 in _PyObject_Vectorcall (kwnames=0x0, nargsf=3,
args=0x7ffe0a289d80, callable=0x7faba48d8430) at
../Include/cpython/abstract.h:127
#32 _PyObject_FastCall (nargs=3, args=0x7ffe0a289d80, func=0x7faba48d8430) at
../Include/cpython/abstract.h:147
#33 object_vacall (base=base@entry=0x7faba48da080, callable=0x7faba48d8430,
vargs=vargs@entry=0x7ffe0a289e10) at ../Objects/call.c:1186
#34 0x00007fabc263a14c in PyObject_CallMethodObjArgs (obj=0x7faba48da080,
name=<optimized out>) at ../Objects/call.c:1214
#35 0x000055befb1f0966 in cmdpy_function (command=0x6110001d2d00,
args=0x55befd892b20 "", from_tty=1) at
/home/smarchi/src/binutils-gdb/gdb/python/py-cmd.c:141
#36 0x000055befa256cb4 in cmd_func (cmd=0x6110001d2d00, args=0x0, from_tty=1)
at /home/smarchi/src/binutils-gdb/gdb/cli/cli-decode.c:2181
#37 0x000055befb9c2ace in execute_command (p=0x60200005109b "", from_tty=1) at
/home/smarchi/src/binutils-gdb/gdb/top.c:668
#38 0x000055befa858fca in command_handler (command=0x602000051090 "lx-symbols
") at /home/smarchi/src/binutils-gdb/gdb/event-top.c:589
#39 0x000055befa859cc5 in command_line_handler (rl=...) at
/home/smarchi/src/binutils-gdb/gdb/event-top.c:774
#40 0x000055befa856f93 in gdb_rl_callback_handler (rl=0x602000051010
"lx-symbols ") at /home/smarchi/src/binutils-gdb/gdb/event-top.c:219
#41 0x000055befbda9a4d in rl_callback_read_char () at
/home/smarchi/src/binutils-gdb/readline/readline/callback.c:281
#42 0x000055befa8569d4 in gdb_rl_callback_read_char_wrapper_noexcept () at
/home/smarchi/src/binutils-gdb/gdb/event-top.c:177
#43 0x000055befa856c02 in gdb_rl_callback_read_char_wrapper
(client_data=0x60f000000310) at
/home/smarchi/src/binutils-gdb/gdb/event-top.c:194
#44 0x000055befa85856c in stdin_event_handler (error=0,
client_data=0x60f000000310) at
/home/smarchi/src/binutils-gdb/gdb/event-top.c:516
#45 0x000055befcec2717 in handle_file_event (file_ptr=0x606000069260,
ready_mask=1) at /home/smarchi/src/binutils-gdb/gdbsupport/event-loop.cc:575
#46 0x000055befcec2f58 in gdb_wait_for_event (block=1) at
/home/smarchi/src/binutils-gdb/gdbsupport/event-loop.cc:701
#47 0x000055befcec0cf6 in gdb_do_one_event () at
/home/smarchi/src/binutils-gdb/gdbsupport/event-loop.cc:237
#48 0x000055befadfda4e in start_event_loop () at
/home/smarchi/src/binutils-gdb/gdb/main.c:347
#49 0x000055befadfde7d in captured_command_loop () at
/home/smarchi/src/binutils-gdb/gdb/main.c:407
#50 0x000055befae02861 in captured_main (data=0x7ffe0a28ab80) at
/home/smarchi/src/binutils-gdb/gdb/main.c:1234
#51 0x000055befae02944 in gdb_main (args=0x7ffe0a28ab80) at
/home/smarchi/src/binutils-gdb/gdb/main.c:1249
#52 0x000055bef9c3e442 in main (argc=2, argv=0x7ffe0a28acf8) at
/home/smarchi/src/binutils-gdb/gdb/gdb.c:32

So we are executing the CIE of this FDE:

(top-gdb) p *fde
$4 = {
  cie = 0x621000f84bb0,
  initial_location = 0xffffffff81b33180,
  address_range = 0xf,
  instructions = 0x7fab8d86db08 <error: Cannot access memory at address
0x7fab8d86db08>,
  end = 0x7fab8d86db08 <error: Cannot access memory at address 0x7fab8d86db08>,
  eh_frame_p = 0 '\000'
}

It's really strange that top-gdb can't access the memory of the program we are
supposed to be executing:

(top-gdb) p insn_ptr
$9 = (const gdb_byte *) 0x7fab8d86da86 <error: Cannot access memory at address
0x7fab8d86da86>
(top-gdb) p fde.cie.initial_instructions 
$10 = (const gdb_byte *) 0x7fab8d86da85 <error: Cannot access memory at address
0x7fab8d86da85>

-- 
You are receiving this mail because:
You are on the CC list for the bug.

  parent reply	other threads:[~2020-11-14  2:52 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-13  9:58 [Bug gdb/26876] New: " robert at robertbuhren dot de
2020-11-13 21:35 ` [Bug gdb/26876] " simark at simark dot ca
2020-11-14  2:52 ` simark at simark dot ca [this message]
2020-11-14  3:29 ` simark at simark dot ca
2020-11-14  9:06 ` robert at robertbuhren dot de
2020-11-14 17:23 ` simark at simark dot ca
2020-11-14 22:46 ` tromey at sourceware dot org
2020-11-14 23:38 ` simark at simark dot ca
2020-11-15  2:48 ` simark at simark dot ca
2020-11-16 18:21 ` simark at simark dot ca
2020-12-03 19:09 ` simark at simark dot ca
2020-12-03 20:48 ` cvs-commit at gcc dot gnu.org
2020-12-03 20:49 ` simark at simark dot ca
2021-06-27 17:55 ` ahmedsayeed1982 at yahoo dot com
2021-08-19  6:02 ` ucelsanicin at yahoo dot com
2021-08-19 10:31 ` mark at klomp dot org
2021-08-27 18:01 ` ribevi6798 at enamelme dot com
2021-08-28 20:47 ` vincent at bernat dot im
2021-09-02 10:07 ` josef.grieb at gmail dot com
2021-09-02 11:07 ` donipah907 at mtlcz dot com
2021-09-02 15:23 ` simark at simark dot ca
2021-09-05  7:34 ` kimolsun2020 at yahoo dot com
2021-09-06  9:09 ` focixujo at livinginsurance dot co.uk
2021-09-10 19:39 ` mehmetgelisin at aol dot com
2021-09-26 13:31 ` tes.vik1986 at gmail dot com
2021-10-09  8:47 ` vficaj at ukr dot net
2021-10-09 11:00 ` gulsenenginar at aol dot com
2021-10-18 19:58 ` ahmedsayeed1982 at hotmail dot com
2021-10-19  7:14 ` progonsaytu at gmail dot com
2021-10-23 13:46 ` fiteva5725 at bomoads dot com
2021-10-24 10:02 ` glassmtech at ukr dot net
2021-11-06 21:12 ` paneki8601 at dukeoo dot com
2021-11-13 19:33 ` tesaso8237 at funboxcn dot com
2021-11-16 19:04 ` xecana8007 at funboxcn dot com
2021-11-16 19:08 ` xecana8007 at funboxcn dot com
2021-11-16 19:12 ` xecana8007 at funboxcn dot com
2021-11-16 19:16 ` xecana8007 at funboxcn dot com
2021-11-16 19:46 ` vincent at bernat dot im
2021-11-22  7:39 ` gexed96894 at keagenan dot com

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=bug-26876-4717-zNIbmvOuWF@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=gdb-prs@sourceware.org \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).