gdb: add a new build_id_equal function

Add two versions of a new function build_id_equal which can be used to
compare build-ids, then make use of these functions in GDB.  It seems
better to have a specific function for the task of comparing build-ids
rather than having a length check followed by a memcmp call.

There should be no user visible changes after this commit.

Approved-By: Tom Tromey <tom@tromey.com>
This commit is contained in:
Andrew Burgess
2024-05-06 19:54:27 +01:00
parent e5b12a313f
commit cb1a6b85b8
3 changed files with 29 additions and 6 deletions

View File

@@ -253,10 +253,8 @@ validate_exec_file (int from_tty)
if (target_exec_file_build_id != nullptr)
{
if (exec_file_build_id->size == target_exec_file_build_id->size
&& memcmp (exec_file_build_id->data,
target_exec_file_build_id->data,
exec_file_build_id->size) == 0)
if (build_id_equal (exec_file_build_id,
target_exec_file_build_id))
{
/* Match. */
return;