public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug gdb/28609] New: GDB does not recognize the movn mips instruction
@ 2021-11-20  3:13 andrew.lamarra at gmail dot com
  2022-03-05 14:54 ` [Bug gdb/28609] " andrew.lamarra at gmail dot com
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: andrew.lamarra at gmail dot com @ 2021-11-20  3:13 UTC (permalink / raw)
  To: gdb-prs

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

            Bug ID: 28609
           Summary: GDB does not recognize the movn mips instruction
           Product: gdb
           Version: 9.2
            Status: UNCONFIRMED
          Severity: minor
          Priority: P2
         Component: gdb
          Assignee: unassigned at sourceware dot org
          Reporter: andrew.lamarra at gmail dot com
  Target Milestone: ---

It seems that GDB does not recognize the MIPS "movn" instruction:
(gdb) x/3i $pc
=> 0x402db0 <main_loop+612>:    slt     a0,s0,v0
   0x402db4 <main_loop+616>:    0x44800b
   0x402db8 <main_loop+620>:    addiu   v0,v1,18636

That instructions should be: movn s0,v0,a0

Let me know if you'd like the binary that I was debugging when I found this.

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

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

* [Bug gdb/28609] GDB does not recognize the movn mips instruction
  2021-11-20  3:13 [Bug gdb/28609] New: GDB does not recognize the movn mips instruction andrew.lamarra at gmail dot com
@ 2022-03-05 14:54 ` andrew.lamarra at gmail dot com
  2022-03-06 17:09 ` tromey at sourceware dot org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: andrew.lamarra at gmail dot com @ 2022-03-05 14:54 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #1 from Andrew Lamarra <andrew.lamarra at gmail dot com> ---
Has this been seen yet?

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

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

* [Bug gdb/28609] GDB does not recognize the movn mips instruction
  2021-11-20  3:13 [Bug gdb/28609] New: GDB does not recognize the movn mips instruction andrew.lamarra at gmail dot com
  2022-03-05 14:54 ` [Bug gdb/28609] " andrew.lamarra at gmail dot com
@ 2022-03-06 17:09 ` tromey at sourceware dot org
  2022-03-06 19:19 ` andrew.lamarra at gmail dot com
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: tromey at sourceware dot org @ 2022-03-06 17:09 UTC (permalink / raw)
  To: gdb-prs

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

Tom Tromey <tromey at sourceware dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |tromey at sourceware dot org
   Last reconfirmed|                            |2022-03-06
             Status|UNCONFIRMED                 |WAITING
     Ever confirmed|0                           |1

--- Comment #2 from Tom Tromey <tromey at sourceware dot org> ---
Can you try git gdb?  Maybe it's been fixed there.

gdb gets its knowledge of assembly from libopcodes, which is
more maintained by the binutils developers.  So we may just
reassign this.

The executable is fine to attach, might be helpful.

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

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

* [Bug gdb/28609] GDB does not recognize the movn mips instruction
  2021-11-20  3:13 [Bug gdb/28609] New: GDB does not recognize the movn mips instruction andrew.lamarra at gmail dot com
  2022-03-05 14:54 ` [Bug gdb/28609] " andrew.lamarra at gmail dot com
  2022-03-06 17:09 ` tromey at sourceware dot org
@ 2022-03-06 19:19 ` andrew.lamarra at gmail dot com
  2022-03-06 20:04 ` tromey at sourceware dot org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: andrew.lamarra at gmail dot com @ 2022-03-06 19:19 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #3 from Andrew Lamarra <andrew.lamarra at gmail dot com> ---
I'm trying to build gdb but I keep coming across this:

../../binutils-gdb/gas/itbl-lex-wrapper.c:25:10: fatal error: itbl-lex.c: No
such file or directory
   25 | #include "itbl-lex.c"
      |          ^~~~~~~~~~~~

I'm on Ubuntu 20.04. Am I missing a package? I've tried installing binutils-dev
and a bunch of others.

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

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

* [Bug gdb/28609] GDB does not recognize the movn mips instruction
  2021-11-20  3:13 [Bug gdb/28609] New: GDB does not recognize the movn mips instruction andrew.lamarra at gmail dot com
                   ` (2 preceding siblings ...)
  2022-03-06 19:19 ` andrew.lamarra at gmail dot com
@ 2022-03-06 20:04 ` tromey at sourceware dot org
  2022-03-06 20:12 ` andrew.lamarra at gmail dot com
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: tromey at sourceware dot org @ 2022-03-06 20:04 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #4 from Tom Tromey <tromey at sourceware dot org> ---
I don't really know but you can also --disable-gas to avoid this.
You may also want --disable-{binutils,gold,gprof,ld} to avoid
unnecessary compilations if you're just trying to get gdb.

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

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

* [Bug gdb/28609] GDB does not recognize the movn mips instruction
  2021-11-20  3:13 [Bug gdb/28609] New: GDB does not recognize the movn mips instruction andrew.lamarra at gmail dot com
                   ` (3 preceding siblings ...)
  2022-03-06 20:04 ` tromey at sourceware dot org
@ 2022-03-06 20:12 ` andrew.lamarra at gmail dot com
  2022-03-06 21:00 ` andrew.lamarra at gmail dot com
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: andrew.lamarra at gmail dot com @ 2022-03-06 20:12 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #5 from Andrew Lamarra <andrew.lamarra at gmail dot com> ---
Sorry, yeah. I just found this page:
https://sourceware.org/gdb/wiki/BuildingNatively

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

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

* [Bug gdb/28609] GDB does not recognize the movn mips instruction
  2021-11-20  3:13 [Bug gdb/28609] New: GDB does not recognize the movn mips instruction andrew.lamarra at gmail dot com
                   ` (4 preceding siblings ...)
  2022-03-06 20:12 ` andrew.lamarra at gmail dot com
@ 2022-03-06 21:00 ` andrew.lamarra at gmail dot com
  2022-03-07 14:27 ` andrew.lamarra at gmail dot com
  2022-03-07 14:31 ` andrew.lamarra at gmail dot com
  7 siblings, 0 replies; 9+ messages in thread
From: andrew.lamarra at gmail dot com @ 2022-03-06 21:00 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #6 from Andrew Lamarra <andrew.lamarra at gmail dot com> ---
So I made a really small test file:
int main() {
    __asm__("movn $s0,$v0,$a0");
    return 0;
}


And compiled with:
$ mips-linux-gnu-gcc -static test.c -o test


Now I noticed that when disassembling that binary with gdb-multiarch, it shows
the instruction:
$ gdb-multiarch -nx -q test
Reading symbols from test...
(No debugging symbols found in test)
(gdb) show architecture 
The target architecture is set automatically (currently mips:isa32r2)
(gdb) disassemble main
Dump of assembler code for function main:
   0x00400790 <+0>:     addiu   sp,sp,-8
   0x00400794 <+4>:     sw      s8,4(sp)
   0x00400798 <+8>:     move    s8,sp
   0x0040079c <+12>:    movn    s0,v0,a0
   0x004007a0 <+16>:    move    v0,zero
   0x004007a4 <+20>:    move    sp,s8
   0x004007a8 <+24>:    lw      s8,4(sp)
   0x004007ac <+28>:    addiu   sp,sp,8
   0x004007b0 <+32>:    jr      ra
   0x004007b4 <+36>:    nop
End of assembler dump.


However, when I do remote debugging via qemu or gdbserver, it doesn't display.
So I start it with:
$ qemu-mips-static -g 1234 test


Then attach to it & disassemble:
$ ./gdb/gdb -q -nx --data-directory=./gdb/data-directory/ \
    -ex "set architecture mips" \
    -ex "file /home/andrew/test" \
    -ex "target remote 127.1:1234" \
    -ex "disas main"
The target architecture is set to "mips".
Reading symbols from /home/andrew/test...
(No debugging symbols found in /home/andrew/test)
Remote debugging using 127.1:1234
0x00400590 in __start ()
Dump of assembler code for function main:
   0x00400790 <+0>:     addiu   sp,sp,-8
   0x00400794 <+4>:     sw      s8,4(sp)
   0x00400798 <+8>:     move    s8,sp
   0x0040079c <+12>:    0x44800b
   0x004007a0 <+16>:    move    v0,zero
   0x004007a4 <+20>:    move    sp,s8
   0x004007a8 <+24>:    lw      s8,4(sp)
   0x004007ac <+28>:    addiu   sp,sp,8
   0x004007b0 <+32>:    jr      ra
   0x004007b4 <+36>:    nop
End of assembler dump.


Same results when I put the binary on a mips machine and start a session via
gdbserver.

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

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

* [Bug gdb/28609] GDB does not recognize the movn mips instruction
  2021-11-20  3:13 [Bug gdb/28609] New: GDB does not recognize the movn mips instruction andrew.lamarra at gmail dot com
                   ` (5 preceding siblings ...)
  2022-03-06 21:00 ` andrew.lamarra at gmail dot com
@ 2022-03-07 14:27 ` andrew.lamarra at gmail dot com
  2022-03-07 14:31 ` andrew.lamarra at gmail dot com
  7 siblings, 0 replies; 9+ messages in thread
From: andrew.lamarra at gmail dot com @ 2022-03-07 14:27 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #7 from Andrew Lamarra <andrew.lamarra at gmail dot com> ---
I should also point out that no matter how I debug, be it from gdbserver, qemu,
or locally, the bytes for the instruction are always the same.

(gdb) x/1wx 0x0040079c
0x40079c <main+12>:     0x0044800b

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

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

* [Bug gdb/28609] GDB does not recognize the movn mips instruction
  2021-11-20  3:13 [Bug gdb/28609] New: GDB does not recognize the movn mips instruction andrew.lamarra at gmail dot com
                   ` (6 preceding siblings ...)
  2022-03-07 14:27 ` andrew.lamarra at gmail dot com
@ 2022-03-07 14:31 ` andrew.lamarra at gmail dot com
  7 siblings, 0 replies; 9+ messages in thread
From: andrew.lamarra at gmail dot com @ 2022-03-07 14:31 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #8 from Andrew Lamarra <andrew.lamarra at gmail dot com> ---
Ok, I see the difference now. When I started debugging locally, it's assumed
architecture was slightly different than when I was manually setting it in a
remote debug session.

(gdb) show architecture 
The target architecture is assumed to be mips
(gdb) x/1i 0x0040079c
   0x40079c <main+12>:  0x44800b
(gdb) set architecture mips:isa32r2
The target architecture is assumed to be mips:isa32r2
(gdb) x/1i 0x0040079c
   0x40079c <main+12>:  movn    s0,v0,a0


Seems the issue only appears when the target architecture is set to just
"mips".

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

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

end of thread, other threads:[~2022-03-07 14:31 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-20  3:13 [Bug gdb/28609] New: GDB does not recognize the movn mips instruction andrew.lamarra at gmail dot com
2022-03-05 14:54 ` [Bug gdb/28609] " andrew.lamarra at gmail dot com
2022-03-06 17:09 ` tromey at sourceware dot org
2022-03-06 19:19 ` andrew.lamarra at gmail dot com
2022-03-06 20:04 ` tromey at sourceware dot org
2022-03-06 20:12 ` andrew.lamarra at gmail dot com
2022-03-06 21:00 ` andrew.lamarra at gmail dot com
2022-03-07 14:27 ` andrew.lamarra at gmail dot com
2022-03-07 14:31 ` andrew.lamarra at gmail dot com

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