gdb/2237: "set" command refuses to set a register

Stephen Ma stephenma@telus.net
Sat Mar 3 18:38:00 GMT 2007


>Number:         2237
>Category:       gdb
>Synopsis:       "set" command refuses to set a register
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Sat Mar 03 18:38:02 GMT 2007
>Closed-Date:
>Last-Modified:
>Originator:     Stephen Ma <stephenma@telus.net>
>Release:        gdb 6.6-debian
>Organization:
>Environment:
Linux jp 2.6.18-1-686 #1 SMP Fri Sep 29 16:25:40 UTC 2006 i686 GNU/Linux
GNU assembler 2.17 Debian GNU/Linux
This GDB was configured as "i486-linux-gnu"...
>Description:
Sometimes the "set" command refuses to set a machine register, complaining that "Value being assigned to is no longer active".  This refusal presumably has something to do with inactive register variables in C -- but my program is pure assembler.
>How-To-Repeat:
Here is the complete program in file "hello.s":

		.global _start, _1
	
	_start:
	
	# Output "hello world" message.
		mov	$4, %eax	# 4 = write
		mov	$1, %ebx	# stdout
		mov	$msg, %ecx
	_1:	mov	$len, %edx
		int	$0x80
	
	# Exit from program.
		xor	%ebx, %ebx
		mov	$1, %eax
		int	$0x80
	
		ret
	
		.data
	
	msg:	.ascii	"Hello world"
		.byte	0x0a
		.equiv  len, .-msg

Assemble and link it with:

	as -g -o hello.o hello.s  &&  ld -o hello hello.o

Here is a transcript of the GDB session:

	GNU gdb 6.6-debian
	Copyright (C) 2006 Free Software Foundation, Inc.
	GDB is free software, covered by the GNU General Public License, and you are
	welcome to change it and/or distribute copies of it under certain conditions.
	Type "show copying" to see the conditions.
	There is absolutely no warranty for GDB.  Type "show warranty" for details.
	This GDB was configured as "i486-linux-gnu"...
	Using host libthread_db library "/lib/tls/libthread_db.so.1".
	(gdb) b _1
	Breakpoint 1 at 0x804807e: file add.s, line 8.
	(gdb) r
	Starting program: /home/steve/src/smf/add 
	Failed to read a valid object file image from memory.
	
	Breakpoint 1, _1 () at add.s:8
	Current language:  auto; currently asm
	(gdb) set $ebx=0
	Value being assigned to is no longer active.
	(gdb) 

Notice also that gdb says "Failed to read a valid object file image from memory".  Whatever that means....
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the Gdb-prs mailing list