public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug gdb/18404] New: [8 Regression] gdb fails to handle EM_486/EM_IAMCU binary
@ 2015-05-12 19:56 hjl.tools at gmail dot com
  2015-05-12 19:57 ` [Bug gdb/18404] " hjl.tools at gmail dot com
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: hjl.tools at gmail dot com @ 2015-05-12 19:56 UTC (permalink / raw)
  To: gdb-prs

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

            Bug ID: 18404
           Summary: [8 Regression] gdb fails to handle EM_486/EM_IAMCU
                    binary
           Product: gdb
           Version: 8.0
            Status: NEW
          Severity: normal
          Priority: P2
         Component: gdb
          Assignee: unassigned at sourceware dot org
          Reporter: hjl.tools at gmail dot com
  Target Milestone: ---

EM_IAMCU is defined to 6 which was EM_486 and Linux kernel
treat EM_486/EM_IAMCU the same way was EM_386 binary.  Before
EM_IAMCU support was checked into BFD, we got

[hjl@gnu-6 gdb]$ cat x.c
#include <stdio.h>

int
main ()
{
  printf ("hello\n");
  return 0;
}
[hjl@gnu-6 gdb]$ gcc -m32 -g -static x.c
[hjl@gnu-6 gdb]$ elfedit --output-mach=iamcu a.out 
[hjl@gnu-6 gdb]$ file a.out 
a.out: ELF 32-bit LSB executable, Intel 80486, version 1 (GNU/Linux),
statically linked, for GNU/Linux 2.6.32,
BuildID[sha1]=28d75f29adb627aff35327dc12df4c929bfeaea3, not stripped
[hjl@gnu-6 gdb]$ ./a.out 
hello
[hjl@gnu-6 gdb]$ gdb ./a.out 
GNU gdb (GDB) Fedora 7.7.1-21.fc20
Copyright (C) 2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ./a.out...done.
(gdb) b main
Breakpoint 1 at 0x8048cdd: file x.c, line 6.
(gdb) r
Starting program: /export/home/hjl/bugs/mcu/gdb/a.out 

Breakpoint 1, main () at x.c:6
6         printf ("hello\n");
(gdb) info reg
eax            0x1      1
ecx            0xda77f71a       -629672166
edx            0xffffcf24       -12508
ebx            0x8048190        134513040
esp            0xffffcef0       0xffffcef0
ebp            0xffffcf08       0xffffcf08
esi            0x0      0
edi            0x80e70c4        135164100
eip            0x8048cdd        0x8048cdd <main+9>
eflags         0x286    [ PF SF IF ]
cs             0x23     35
ss             0x2b     43
ds             0x2b     43
es             0x2b     43
fs             0x0      0
gs             0x63     99
(gdb) q
A debugging session is active.

        Inferior 1 [process 16861] will be killed.

Quit anyway? (y or n) y
[hjl@gnu-6 gdb]$

After EM_IAMCU supported was added to BFD, I got

[hjl@gnu-6 gdb]$ ./gdb ./a.out 
GNU gdb (GDB) 7.9.50.20150512-cvs
Copyright (C) 2015 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-unknown-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Architecture of file not recognized.
(gdb) r
Starting program: /export/home/hjl/bugs/mcu/gdb/a.out 
warning: Selected architecture iamcu is not compatible with reported target
architecture i386
warning: Architecture rejected target-supplied description
hello
[Inferior 1 (process 7786) exited normally]
(gdb) b main
Function "main" not defined.
Make breakpoint pending on future shared library load? (y or [n]) y
Breakpoint 1 (main) pending.
(gdb) r
/export/gnu/import/git/sources/binutils-gdb/gdb/target-descriptions.c:400:
internal-error: Could not remove target-supplied description
A problem internal to GDB has been detected,
further debugging may prove unreliable.
Quit this debugging session? (y or n) y

This is a bug, please report it.  For instructions, see:
<http://www.gnu.org/software/gdb/bugs/>.

/export/gnu/import/git/sources/binutils-gdb/gdb/target-descriptions.c:400:
internal-error: Could not remove target-supplied description
A problem internal to GDB has been detected,
further debugging may prove unreliable.
Create a core file of GDB? (y or n) n
[hjl@gnu-6 gdb]$

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


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

* [Bug gdb/18404] [8 Regression] gdb fails to handle EM_486/EM_IAMCU binary
  2015-05-12 19:56 [Bug gdb/18404] New: [8 Regression] gdb fails to handle EM_486/EM_IAMCU binary hjl.tools at gmail dot com
@ 2015-05-12 19:57 ` hjl.tools at gmail dot com
  2023-02-15 17:09 ` tromey at sourceware dot org
  2023-02-16 16:34 ` hjl.tools at gmail dot com
  2 siblings, 0 replies; 4+ messages in thread
From: hjl.tools at gmail dot com @ 2015-05-12 19:57 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #1 from H.J. Lu <hjl.tools at gmail dot com> ---
Created attachment 8308
  --> https://sourceware.org/bugzilla/attachment.cgi?id=8308&action=edit
A patch

This patch seems to work.

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


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

* [Bug gdb/18404] [8 Regression] gdb fails to handle EM_486/EM_IAMCU binary
  2015-05-12 19:56 [Bug gdb/18404] New: [8 Regression] gdb fails to handle EM_486/EM_IAMCU binary hjl.tools at gmail dot com
  2015-05-12 19:57 ` [Bug gdb/18404] " hjl.tools at gmail dot com
@ 2023-02-15 17:09 ` tromey at sourceware dot org
  2023-02-16 16:34 ` hjl.tools at gmail dot com
  2 siblings, 0 replies; 4+ messages in thread
From: tromey at sourceware dot org @ 2023-02-15 17:09 UTC (permalink / raw)
  To: gdb-prs

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

Tom Tromey <tromey at sourceware dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |WAITING
                 CC|                            |tromey at sourceware dot org

--- Comment #2 from Tom Tromey <tromey at sourceware dot org> ---
Is this still relevant / necessary?

I see bfd_arch_iamcu in BFD still, and nothing in gdb.
I don't know how to test this but the patch looks essentially
fine to me.  It would just need an update for some renamings in gdb.

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

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

* [Bug gdb/18404] [8 Regression] gdb fails to handle EM_486/EM_IAMCU binary
  2015-05-12 19:56 [Bug gdb/18404] New: [8 Regression] gdb fails to handle EM_486/EM_IAMCU binary hjl.tools at gmail dot com
  2015-05-12 19:57 ` [Bug gdb/18404] " hjl.tools at gmail dot com
  2023-02-15 17:09 ` tromey at sourceware dot org
@ 2023-02-16 16:34 ` hjl.tools at gmail dot com
  2 siblings, 0 replies; 4+ messages in thread
From: hjl.tools at gmail dot com @ 2023-02-16 16:34 UTC (permalink / raw)
  To: gdb-prs

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

H.J. Lu <hjl.tools at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |NEW

--- Comment #3 from H.J. Lu <hjl.tools at gmail dot com> ---
(In reply to Tom Tromey from comment #2)
> Is this still relevant / necessary?

Yes.

> I see bfd_arch_iamcu in BFD still, and nothing in gdb.
> I don't know how to test this but the patch looks essentially
> fine to me.  It would just need an update for some renamings in gdb.

$ cat x.c
#include <stdio.h>

int
main ()
{
  printf ("hello\n");
  return 0;
}
$ gcc -m32 -g -static x.c
$ elfedit --output-mach=iamcu a.out
$ gdb a.out

will reproduce it.

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

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

end of thread, other threads:[~2023-02-16 16:34 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-12 19:56 [Bug gdb/18404] New: [8 Regression] gdb fails to handle EM_486/EM_IAMCU binary hjl.tools at gmail dot com
2015-05-12 19:57 ` [Bug gdb/18404] " hjl.tools at gmail dot com
2023-02-15 17:09 ` tromey at sourceware dot org
2023-02-16 16:34 ` hjl.tools 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).