This is the mail archive of the gdb-prs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug gdb/17516] New: gdbarch/architecture becomes sticky after execution, "set architecture" crashes


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

            Bug ID: 17516
           Summary: gdbarch/architecture becomes sticky after execution,
                    "set architecture" crashes
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: gdb
          Assignee: unassigned at sourceware dot org
          Reporter: palves at redhat dot com

Before running a program, you can change the file, and the architecture is
automatically switched:

(gdb) file ~/gdb/tests/main
Load new symbol table from "~/gdb/tests/main"? (y or n) y
Reading symbols from ~/gdb/tests/main...done.
(gdb) show architecture 
The target architecture is set automatically (currently i386:x86-64)
(gdb) file ~/gdb/tests/main32
Load new symbol table from "~/gdb/tests/main32"? (y or n) y
Reading symbols from ~/gdb/tests/main32...done.
(gdb) show architecture 
The target architecture is set automatically (currently i386)
(gdb) file ~/gdb/tests/main
Load new symbol table from "~/gdb/tests/main"? (y or n) y
Reading symbols from ~/gdb/tests/main...done.
(gdb) show architecture 
The target architecture is set automatically (currently i386:x86-64)


However, if you start the program, and then kill it, the architecture becomes
sticky:

(gdb) file ~/gdb/tests/main
Reading symbols from ~/gdb/tests/main...done.
(gdb) show architecture 
The target architecture is set automatically (currently i386:x86-64)
(gdb) start
Temporary breakpoint 1 at 0x4004cf: file main.c, line 5.
Starting program: /home/pedro/gdb/tests/main 

Temporary breakpoint 1, main (argc=1, argv=0x7fffffffd908) at main.c:5
5         return 0;
(gdb) kill
Kill the program being debugged? (y or n) y
(gdb) file ~/gdb/tests/main32
warning: Selected architecture i386 is not compatible with reported target
architecture i386:x86-64
Architecture of file not recognized.
(gdb) 

Furthermore, trying to fix it manually results in an internal error...:

(gdb) set architecture auto 
warning: Selected architecture i386 is not compatible with reported target
architecture i386:x86-64

Breakpoint 1, internal_error (file=0x909410 "src/gdb/arch-utils.c", line=468,
fmt=0x909738 "could not select an architecture automatically")
    at src/gdb/common/errors.c:54
54        va_start (ap, fmt);

(top-gdb) bt
#0  internal_error (file=0x909410 "src/gdb/arch-utils.c", line=468,
fmt=0x909738 "could not select an architecture automatically")
    at src/gdb/common/errors.c:54
#1  0x0000000000629227 in set_architecture (ignore_args=0x0, from_tty=1,
c=0xf7ce30) at src/gdb/arch-utils.c:468
#2  0x00000000004f77c6 in do_sfunc (c=0xf7ce30, args=0x0, from_tty=1) at
src/gdb/cli/cli-decode.c:121
#3  0x00000000005020b1 in do_set_command (arg=0xd31751 "auto ", from_tty=1,
c=0xf7ce30) at src/gdb/cli/cli-setshow.c:455
#4  0x0000000000721ee0 in execute_command (p=0xd31751 "auto ", from_tty=1) at
src/gdb/top.c:468
#5  0x0000000000619670 in command_handler (command=0xd31740 "set architecture
auto ") at src/gdb/event-top.c:432
#6  0x0000000000619c29 in command_line_handler (rl=0x10305d0 "set architecture
auto ") at src/gdb/event-top.c:629
#7  0x00000000007810de in rl_callback_read_char () at
src/readline/callback.c:220
#8  0x00000000006191b5 in rl_callback_read_char_wrapper (client_data=0x0) at
src/gdb/event-top.c:166
#9  0x000000000061958b in stdin_event_handler (error=0, client_data=0x0) at
src/gdb/event-top.c:372
#10 0x000000000061817e in handle_file_event (data=...) at
src/gdb/event-loop.c:762
#11 0x0000000000617665 in process_event () at src/gdb/event-loop.c:339
#12 0x000000000061772c in gdb_do_one_event () at src/gdb/event-loop.c:403
#13 0x000000000061777c in start_event_loop () at src/gdb/event-loop.c:428
#14 0x00000000006191e7 in cli_command_loop (data=0x0) at
src/gdb/event-top.c:181
#15 0x000000000060f56c in current_interp_command_loop () at
src/gdb/interps.c:317
#16 0x0000000000610735 in captured_command_loop (data=0x0) at
src/gdb/main.c:321
#17 0x000000000060c429 in catch_errors (func=0x61071a <captured_command_loop>,
func_args=0x0, errstring=0x8fec41 "", mask=RETURN_MASK_ALL)
    at src/gdb/exceptions.c:237
#18 0x0000000000611c33 in captured_main (data=0x7fffffffd7a0) at
src/gdb/main.c:1149
#19 0x000000000060c429 in catch_errors (func=0x610b32 <captured_main>,
func_args=0x7fffffffd7a0, errstring=0x8fec41 "", mask=RETURN_MASK_ALL)
    at src/gdb/exceptions.c:237
#20 0x0000000000611c5c in gdb_main (args=0x7fffffffd7a0) at src/gdb/main.c:1157
#21 0x000000000045ef57 in main (argc=3, argv=0x7fffffffd8a8) at
src/gdb/gdb.c:32

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]