public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug gdb/30825] New: GDB doesn't send Hg packet when switching the inferiors
@ 2023-09-05 10:54 rajesh.palla at amd dot com
  2023-09-05 15:41 ` [Bug gdb/30825] " tromey at sourceware dot org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: rajesh.palla at amd dot com @ 2023-09-05 10:54 UTC (permalink / raw)
  To: gdb-prs

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

            Bug ID: 30825
           Summary: GDB doesn't send Hg packet when switching the
                    inferiors
           Product: gdb
           Version: 12.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: gdb
          Assignee: unassigned at sourceware dot org
          Reporter: rajesh.palla at amd dot com
  Target Milestone: ---

When we switch the inferiors using infe command, I am expecting GDB to send Hg
Packet to the remote stub so that the remote stub can work on the selected
inferior.

But GDB isn't sending the Hg packet every time. 
In a scenario where I have two inferiors, if I switch the inferiors without
doing any operation, I don't see Hg Packet after first time

infe 1
infe 2 
infe 1
infe 2

Output log:
GDB -> $Hgp1.1#af
GDB <- $OK#9a
GDB -> $g#67
GDB <- $0000000000e0030000.....#49


Is it expected to invalidate the pc register from regcache in
<arch>_unwind_pc(). Because if I do so, it works but that will add more latency
when we give step command etc..(it sends more g packets)

Any solution?

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug gdb/30825] GDB doesn't send Hg packet when switching the inferiors
  2023-09-05 10:54 [Bug gdb/30825] New: GDB doesn't send Hg packet when switching the inferiors rajesh.palla at amd dot com
@ 2023-09-05 15:41 ` tromey at sourceware dot org
  2023-09-06  4:29 ` rajesh.palla at amd dot com
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: tromey at sourceware dot org @ 2023-09-05 15:41 UTC (permalink / raw)
  To: gdb-prs

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

Tom Tromey <tromey at sourceware dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |tromey at sourceware dot org

--- Comment #1 from Tom Tromey <tromey at sourceware dot org> ---
remote.c lazily sends Hg.  Simply switching inferiors isn't enough
to trigger this; instead the user has to do some operation that
requires the remote to know about the switch.

I am not completely sure but I think in general the unwind methods
should not be invalidating the regcache.  IIUC this is the job
of higher levels.

Maybe you could say what target this is and/or show your pc-unwind
function.

The other ones in the tree don't seem to do this.

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug gdb/30825] GDB doesn't send Hg packet when switching the inferiors
  2023-09-05 10:54 [Bug gdb/30825] New: GDB doesn't send Hg packet when switching the inferiors rajesh.palla at amd dot com
  2023-09-05 15:41 ` [Bug gdb/30825] " tromey at sourceware dot org
@ 2023-09-06  4:29 ` rajesh.palla at amd dot com
  2023-09-06  4:31 ` rajesh.palla at amd dot com
  2023-09-06 16:38 ` tromey at sourceware dot org
  3 siblings, 0 replies; 5+ messages in thread
From: rajesh.palla at amd dot com @ 2023-09-06  4:29 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #2 from Palla, Rajesh <rajesh.palla at amd dot com> ---
This is the new target we added for AMD cores.
pc_unwind function is similar to default pc_unwind() except that it invalidates
the cache when there is a change in the inferior.

static CORE_ADDR aiengine_unwind_pc (struct gdbarch *gdbarch, struct frame_info
*next_frame)
{
  gdb_byte buf[4];
  struct inferior *inf = current_inferior ();
  if (inf->pid != prev_pid){
    prev_pid = inf->pid;
    get_current_regcache()->invalidate(gdbarch_pc_regnum (gdbarch));
  }
  frame_unwind_register (next_frame, gdbarch_pc_regnum (gdbarch), buf);
  return extract_typed_address (buf, builtin_type (gdbarch)->builtin_func_ptr);
}


Couple of questions:
1. When I tried to debug "arm arch", I see the Hg packets are sent every time
we switch the inferior without doing any operation. (see log.txt attached)
2. In our case, I don't see Hg packet being sent lazily when we give 'c&'
command. See the below log. But for other commands like mem read, I see Hg
packet being sent.

----(gdb) infe 1
GDB -> $Hgp1.1#af
GDB <- $OK#9a
GDB -> $g#67
GDB <- $0000....#df
----(gdb) infe 2
----(gdb) c &
GDB -> $vCont;c:p2.-1#10
GDB <- $OK#9a
----(gdb) infe 1
----(gdb) b producer
GDB -> $m280,4#67
GDB <- $00000000#80
GDB -> $Z0,280,4#b0
GDB <- $OK#9a

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug gdb/30825] GDB doesn't send Hg packet when switching the inferiors
  2023-09-05 10:54 [Bug gdb/30825] New: GDB doesn't send Hg packet when switching the inferiors rajesh.palla at amd dot com
  2023-09-05 15:41 ` [Bug gdb/30825] " tromey at sourceware dot org
  2023-09-06  4:29 ` rajesh.palla at amd dot com
@ 2023-09-06  4:31 ` rajesh.palla at amd dot com
  2023-09-06 16:38 ` tromey at sourceware dot org
  3 siblings, 0 replies; 5+ messages in thread
From: rajesh.palla at amd dot com @ 2023-09-06  4:31 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #3 from Palla, Rajesh <rajesh.palla at amd dot com> ---
Created attachment 15098
  --> https://sourceware.org/bugzilla/attachment.cgi?id=15098&action=edit
log file

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug gdb/30825] GDB doesn't send Hg packet when switching the inferiors
  2023-09-05 10:54 [Bug gdb/30825] New: GDB doesn't send Hg packet when switching the inferiors rajesh.palla at amd dot com
                   ` (2 preceding siblings ...)
  2023-09-06  4:31 ` rajesh.palla at amd dot com
@ 2023-09-06 16:38 ` tromey at sourceware dot org
  3 siblings, 0 replies; 5+ messages in thread
From: tromey at sourceware dot org @ 2023-09-06 16:38 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #4 from Tom Tromey <tromey at sourceware dot org> ---
From that log, the Hg is sent because immediately after,
gdb tries to read memory.
I'm not sure why switching does nothing in your case.
There is no high road to this, you just have to debug gdb.

Invalidating the regcache in the low levels seems wrong to me.
Why don't the higher level invalidations work for you?

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-09-06 16:38 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-05 10:54 [Bug gdb/30825] New: GDB doesn't send Hg packet when switching the inferiors rajesh.palla at amd dot com
2023-09-05 15:41 ` [Bug gdb/30825] " tromey at sourceware dot org
2023-09-06  4:29 ` rajesh.palla at amd dot com
2023-09-06  4:31 ` rajesh.palla at amd dot com
2023-09-06 16:38 ` tromey at sourceware dot org

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).