public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
From: "R. Diez" <rdiezmail-temp2@yahoo.de>
To: Pedro Alves <pedro@palves.net>, Andrew Burgess <aburgess@redhat.com>
Cc: gdb@sourceware.org
Subject: Re: Refresh TUI source panel after "monitor reset"
Date: Fri, 2 Sep 2022 14:34:26 +0200	[thread overview]
Message-ID: <b0c0bdfb-6b51-071a-5545-e55f117fb749@yahoo.de> (raw)
In-Reply-To: <d227ffe0-39ba-263e-c8e9-de0a5ca34dad@palves.net>


> Pedro Alves wrote:
> Did you try just "frame"?  That's what I typically use to make the source pane refocus on the current frame, where
> the program is stopped.

> Andrew Burgess wrote:
> Completely untested, but I wonder if 'list *$pc' does what you want?

I have been investigating a little more. It's been some time, so I'll start from the beginning again.

I have a bootloader and the main firmware. Normally, I program the main firmware with OpenOCD, so GDB knows where the firmware source code is located.

The bootloader on the target does not normally change. It is a different project, its debug information is in a different .elf file, so its source code is not automatically available when I debug the main firmware.

Say I pause execution by pressing Ctrl+C in GDB. The TUI interface shows then the source line that corresponds to the current PC. So far so good.

Now I do a "monitor reset halt", followed by a "flushregs". However, the TUI interface still shows the old source code position. That is misleading.

If I issue command "print $pc", I can see that the PC register was updated fine.

Command "frame" does not help. It prints the right frame address (the same address as the PC), and that is all.

Command "list *$pc" is ignored, because the PC points to the bootloader, and its source code is not available when debugging the main firmware. It is particularly annoying that no hint or error indication is printed.

Command "disassemble $pc,+10" dumps the disassembly on the command pane, and does not really help.

Say you now switch to "layout split" mode. Both the source panel and the disassembly panel still show the old source code position, which is wrong.

If you now issue command "disassemble $pc,+10", then the disassembly panel jumps to the right position, and the source panel (if any) shows "[ No Source Available ]". That is now more helpful.

However, TUI still remembers its internal "current source position", which is still the old (wrong) one. If you now resize the GDB window with the mouse, then both source and disassembly panels jump to the old, wrong position, which is very misleading. After all, resizing the window should not change the displayed addresses.

TUI's internal "current source position" only gets updated after you execute one assembly instruction. I was hoping there was some way to tell GDB to update that "current display position" right after command "monitor reset halt" and/or "flushregs".

Regards,
   rdiez

      reply	other threads:[~2022-09-02 12:34 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <48b5be62-64c1-c7bb-a560-e454ffe2f0ba.ref@yahoo.de>
2022-06-21 11:30 ` R. Diez
2022-06-24 14:05   ` Andrew Burgess
2022-06-24 14:57     ` R. Diez
2022-06-28 13:43       ` Pedro Alves
2022-09-02 12:34         ` R. Diez [this message]

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=b0c0bdfb-6b51-071a-5545-e55f117fb749@yahoo.de \
    --to=rdiezmail-temp2@yahoo.de \
    --cc=aburgess@redhat.com \
    --cc=gdb@sourceware.org \
    --cc=pedro@palves.net \
    /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).