forked from Imagelibrary/binutils-gdb
New python attribute gdb.Objfile.build_id.
gdb/ChangeLog: * NEWS: Mention gdb.Objfile.build_id. * build-id.c (build_id_bfd_get): Make non-static. * build-id.h (build_id_bfd_get): Add declaration. * python/py-objfile.c: #include "build-id.h", "elf-bfd.h". (OBJFPY_REQUIRE_VALID): New macro. (objfpy_get_build_id): New function. (objfile_getset): Add "build_id". * utils.c (make_hex_string): New function. * utils.h (make_hex_string): Add declaration. gdb/doc/ChangeLog: * python.texi (Objfiles In Python): Document Objfile.build_id. gdb/testsuite/ChangeLog: * lib/gdb.exp (get_build_id): New function. (build_id_debug_filename_get): Rewrite to use it. * gdb.python/py-objfile.exp: Add test for objfile.build_id.
This commit is contained in:
@@ -39,6 +39,16 @@ gdb_py_test_silent_cmd "python objfile = sym\[0\].symtab.objfile" \
|
||||
|
||||
gdb_test "python print (objfile.filename)" ".*py-objfile.*" \
|
||||
"Get objfile file name"
|
||||
|
||||
set binfile_build_id [get_build_id $binfile]
|
||||
if [string compare $binfile_build_id ""] {
|
||||
verbose -log "binfile_build_id = $binfile_build_id"
|
||||
gdb_test "python print (objfile.build_id)" "$binfile_build_id" \
|
||||
"Get objfile build id"
|
||||
} else {
|
||||
unsupported "build-id is not supported by the compiler"
|
||||
}
|
||||
|
||||
gdb_test "python print (objfile.progspace)" "<gdb\.Progspace object at .*>" \
|
||||
"Get objfile program space"
|
||||
gdb_test "python print (objfile.is_valid())" "True" \
|
||||
|
||||
Reference in New Issue
Block a user