|
|
| reference environment variables from gdb
scripts |
  United States |
2007-08-23 16:19:44 |
Is there a way to reference an environment variable from a
gdbscript?
I'm hoping a gdb script command to load different script
files based on the
current environment variable.
I can see these variable using "show env" command.
But when I reference them
in a file like below, it gives me errors:
source $HOME/gdb.scripts
Is there a way to do something like this?
Thanks
--
View this message in context: http://www.nabble
.com/reference-environment-variables-from-gdb-scripts-tf4320
152.html#a12302351
Sent from the Sourceware - gdb list mailing list archive at
Nabble.com.
|
|
| Re: reference environment variables from
gdb scripts |
  Czech Republic |
2007-08-24 03:57:40 |
On Thu, 23 Aug 2007 23:19:44 +0200, rockwellkc wrote:
>
> Is there a way to reference an environment variable
from a gdbscript?
Unaware.
> I'm hoping a gdb script command to load different
script files based on the
> current environment variable.
Set bash function and use the --command parameter?
> source $HOME/gdb.scripts
$HOME -> ~
and it should work.
Regards,
Jan
|
|
| Re: reference environment variables from
gdb scripts |
  United States |
2007-08-24 11:37:25 |
Hi,
I use .cshrc to update the current pointer
whenever I login to a 32 or 64 bit machine.
If so, I can keep .gdbinit as it is.
BTW, Is there a gdb script functional document?
Is there a gdb script test vector
(or a complete feature checklist)
for each gdb release?
Thanks,
Sheng-Liang
.gdbinit
source ~/.gdb/current/gdb_stl_utils
(ref: http://ww
w.stanford.edu/~afn/gdb_stl_utils/
I try follow the above examples to make some changes for my
machine.
I feel it is a little bit hard to debug the scripts.
If you have more gdb script examples, could you email me?
Thanks!)
.cshrc
if ( -f ~/.gdb/current ) then
rm ~/.gdb/current
endif
ln -s ~/.gdb/`uname -m` ~/.gdb/current
/home/ssl/.gdb/i686
/home/ssl/.gdb/x86_64
/home/ssl/.gdb/current -> /home/ssl/.gdb/x86_64
Jan Kratochvil wrote:
> On Thu, 23 Aug 2007 23:19:44 +0200, rockwellkc wrote:
>
>> Is there a way to reference an environment variable
from a gdbscript?
>>
>
> Unaware.
>
>
>> I'm hoping a gdb script command to load different
script files based on the
>> current environment variable.
>>
>
> Set bash function and use the --command parameter?
>
>
>> source $HOME/gdb.scripts
>>
>
> $HOME -> ~
> and it should work.
>
>
> Regards,
> Jan
>
|
|
| Re: reference environment variables from
gdb scripts |
  Israel |
2007-08-24 12:29:51 |
> Date: Fri, 24 Aug 2007 09:37:25 -0700
> From: Sheng-Liang Song <ssl baymicrosystems.com>
>
> BTW, Is there a gdb script functional document?
The GDB scripting commands are documented in the GDB user
manual. See
the node "Sequences".
|
|
| Re: reference environment variables from
gdb scripts |
  United States |
2007-08-24 13:26:18 |
Eli Zaretskii wrote:
>> Date: Fri, 24 Aug 2007 09:37:25 -0700
>> From: Sheng-Liang Song <ssl baymicrosystems.com>
>>
>> BTW, Is there a gdb script functional document?
>>
>
> The GDB scripting commands are documented in the GDB
user manual. See
> the node "Sequences".
>
Hi,
I am looking for a more detail document.
(just like this vim script doc with examples):
htt
p://vimdoc.sourceforge.net/htmldoc/usr_41.html
What is the different between "." and
"->" operator in gdb script?
(Looks like no difference to me. works the same.)
What operators does gdb 6.6 support?
Is a gdb script grammar like this one:
http://www.nongnu.org/hcb/
$vec->_M_impl
STL vector does not have the member var _M_impl.
gdb) will report: There is no member or method named
_M_impl.
How do I check if $vec has the member _M_impl?
I would like to write a script like this:
if isMember($vec,_M_impl)
//do something
else
//do something else
end
I have some examples that works on gdb.6.6 only.
define adder
if $argc == 1
print $arg0
end
if $argc == 2
print $arg0 + $arg1
end
if $argc == 3
print $arg0 + $arg1 + $arg2
end
end
define p_stl_vector64
set $vec = ($arg0)
set $vec_begin = 0
set $vec_size = $vec->_M_impl->_M_finish -
$vec->_M_impl->_M_start
set $vec_end = $vec_size - 1
if $argc == 3
set $vec_begin = ($arg1)
end
if $argc == 3
set $vec_end = ($arg2)
end
if ($vec_size != 0)
set $i = 0
while ($i <= $vec_end)
printf "Vector Element %d: ", $i
p *($vec->_M_impl->_M_start+$i)
set $i++
end
end
end
GNU gdb Red Hat Linux (6.3.0.0-1.132.EL4rh)
(DOES NOT WORK!)
(gdb) adder 1 2 3
Invalid type combination in equality test.
GNU gdb 6.6 (works)
(gdb) adder 1 2 3
$1 = 6
|
|
| Re: reference environment variables from
gdb scripts |
  Israel |
2007-08-25 04:54:09 |
|
|
| Re: reference environment variables from
gdb scripts (gdb and unix pipe) |
  United States |
2007-08-28 16:03:18 |
Sheng-Liang Song <ssl baymicrosystems.com>
writes:
> gdb has "shell" command to switch to a unix
shell.
> After switch to a unix shell, can I call gdb
functions/commands?
No; you need to exit the shell before you can give more
commands to
GDB.
> Does gdb supports "pipe" command? Is there a
plan to add a "unix pipe"
> command to gdb debug prompt?
No; we don't have any plans to do so.
We're currently planning to add Python as a scripting
language to
GDB. If that were to happen, the things you mention here
could be
done in a clean and general way.
|
|
| GDB Tool Chains |

|
2007-08-28 16:08:26 |
This is a rookie question but here goes.....
Is there a list of available tool chains for GDB anywhere?
Jay
|
|
| Re: GDB Tool Chains |
  Denmark |
2007-08-28 16:56:01 |
On Tue, 28 Aug 2007, McGuerty, Jay S. wrote:
>
> This is a rookie question but here goes.....
>
> Is there a list of available tool chains for GDB
anywhere?
Tool chains? What do you mean?
>
> Jay
>
>
Best
--
Peter Toft, Ph.D. [pto linuxbog.dk] http://petertoft.dk
Følg min Linux-blog på http://www.ver
sion2.dk/blogs/petertoft
|
|
| Re: GDB Tool Chains |
  United States |
2007-08-28 16:59:11 |
"McGuerty, Jay S." <JAY.S.MCGUERTY saic.com> writes:
> This is a rookie question but here goes.....
>
> Is there a list of available tool chains for GDB
anywhere?
No. GDB is most widely tested against the GNU compiler,
linker, and
debugger. I'd bet it works adequately with the Intel C
compiler. I
expect it would take work to adapt GDB to understand the
DWARF
produced by other compilers.
(By the way, please don't start new threads by replying to
others'
messages; doing so makes it difficult for threaded mail
readers and
web archivers to properly group threads.)
|
|