This is the mail archive of the gdb-cvs@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]

src/gdb/testsuite ChangeLog gdb.python/py-infe ...


CVSROOT:	/cvs/src
Module name:	src
Changes by:	brobecke@sourceware.org	2011-06-08 16:56:11

Modified files:
	gdb/testsuite  : ChangeLog 
	gdb/testsuite/gdb.python: py-inferior.c py-inferior.exp 

Log message:
	py-inferior.exp: Make sure local var is allocated on the stack.
	
	The testcase, at some point, is trying to change the contents
	of a string that was defined as follow:
	
	char *str = "hello, testsuite";
	
	The problem is that the string is constant, and str is never used
	to change the contents of the string in the program, so the compiler
	is free to allocate it in a read-only section.  This is what happens
	on x86-windows, for instance.
	
	As a result, trying to change the contents of the string during
	the `python gdb.inferiors()[0].write_memory (addr, str)' results
	in the following error:
	
	(gdb) python gdb.inferiors()[0].write_memory (addr, str)
	gdb: write target memory, 5 bytes at 0x00403064
	Traceback (most recent call last):
	File "<string>", line 1, in <module>
	gdb.MemoryError: Cannot access memory at address 0x403064
	Error while executing Python code.
	
	This patch prevents this from happening by declaring str as an
	array rather than a pointer.
	
	gdb/testsuite/ChangeLog:
	
	* gdb.python/py-inferior.c (f2): Make str an array rather
	than a pointer.
	* gdb.python/py-inferior.exp: Adjust testcase accordingly.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/testsuite/ChangeLog.diff?cvsroot=src&r1=1.2740&r2=1.2741
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/testsuite/gdb.python/py-inferior.c.diff?cvsroot=src&r1=1.2&r2=1.3
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/testsuite/gdb.python/py-inferior.exp.diff?cvsroot=src&r1=1.7&r2=1.8


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