Semaphores macro error
Chris Johns
chrisj at rtems.org
Wed Apr 11 22:05:20 UTC 2007
Joel Sherrill wrote:
> Does changing it to
>
> printf "No waiting threads"
>
> without the formatting string help?
>
> It is very weird.
>
The command 'printf "%s", x' is expecting the string to be one in your target
not inside gdb's address space and called 'x'. If you supply a literal string
GDB cannot side step the target memory requirement so attempts to create the
string on the target for you by allocating some memory and coping the string
into it. You can just print the string if you know what it is as you are now
doing.
If you start a native gdb on a host platform you can:
[cjohns at moa ~]$ gdb
GNU gdb Red Hat Linux (6.3.0.0-1.134.fc5rh)
Copyright 2004 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 "i386-redhat-linux-gnu".
(gdb) printf "%i\n", 2
2
(gdb) printf "%s\n", "Hello World"
evaluation of this expression requires the target program to be active
(gdb) q
Why the difference between a literal integer verses a string ? The code in GDB
uses 'value_as_address' for the string while 'value_as_long' is for the
integer. I have not looked in 'value_as_address' but suspect this is complex
having to deal with all address types for the specific target, eg string,
functions etc. The code after this performs a 'read_memory' from the target
before printing it.
Regards
Chris
More information about the users
mailing list