crash-utility / crash

Linux kernel crash utility
https://crash-utility.github.io
837 stars 274 forks source link

Is this `gdb` functionality supposed to work? #31

Open nhed opened 5 years ago

nhed commented 5 years ago

I know i'm able to define macros in ~/.gdbinit (just not interactively using define from the crash prompt)

hoping to have a string comparison in such a macro using $_streq as per https://sourceware.org/gdb/onlinedocs/gdb/Convenience-Funs.html

When I have the test macro

define dotest
  if $_streq("1", "1")
    echo ok\n
  end
end

I observe different results between gdb and crash

(gdb) dotest
ok

vs

crash> dotest
You can't do that without a process to debug.
gdb: gdb request failed: dotest
crash-utility commented 5 years ago

----- Original Message -----

I know i'm able to define macros in ~/.gdbinit (just not interactively using define from the crash prompt)

hoping to have a string comparison in such a macro using $_streq as per https://sourceware.org/gdb/onlinedocs/gdb/Convenience-Funs.html

When I have the test macro

define dotest
  if $_streq("1", "1")
    echo ok\n
  end
end

I observe different results between gdb and crash

(gdb) dotest
ok

vs


crash> dotest
You can't do that without a process to debug.
gdb: gdb request failed: dotest

Apparently not. As the error message states, you can't do it "without a process to debug". And when the crash utility uses gdb, it brings it up as "gdb vmlinux", so there is no concept of a process.

Dave

-- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/crash-utility/crash/issues/31

nhed commented 5 years ago

but the gdb test I tested with was not attached to a running process either (launched just as $ gdb)

crash-utility commented 5 years ago

----- Original Message -----

but the gdb test I tested with was not attached to a running process either (launched just as $ gdb)

Yeah, hmmm, then I don't know what the issue is. I've never tried to use a gdb macro from within crash before.