Randolph Chung randolph@tausq.org
Fri Dec 3 18:15:00 GMT 2004

> Anyway, more relevant, and as daniel asked, can it be done in assember? 
>  A starting point for that might be the gdb.asm test case which uses 
> assembly source code.

i'm working on it, but getting stuck with a weird problem... i'm seeing
a case where i do:

proc get_addr_of_sym { sym } {
  set addr 0
  global gdb_prompt
  global expect_out

  send_gdb "print $sym\n"
  gdb_expect 60 {
    -re ".*($hex) <$sym>.*$gdb_prompt $" {
      set addr $expect_out(1,string)
      pass "got address of $sym = $addr"
    timeout {
      fail "cannot get address of $sym (timed out)."

  return $addr

set foo [get_addr_of_sym "foo"]
set bar [get_addr_of_sym "bar"]

i always get a FAIL on that, and from looking at the log (with --debug)
it seems like the gdb_expect is returning immediately without checking
for results from the previous send_gdb command....

send: sending "print foo\n" to { exp11 }^M
FAIL: gdb.arch/pa-nullify.exp: cannot get address of foo (timed out).
send: sending "print bar\n" to { exp11 }^M
FAIL: gdb.arch/pa-nullify.exp: cannot get address of bar (timed out).

am i doing something obviously wrong?

Randolph Chung
Debian GNU/Linux Developer, hppa/ia64 ports

More information about the Gdb-patches mailing list