diff options
author | Tom Tromey <tom@tromey.com> | 2023-03-19 16:12:58 -0600 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2023-03-28 15:12:40 -0600 |
commit | 6b3a2759052d1874a5952b7901e2b41890ae992f (patch) | |
tree | 01f270a3fab39bb9c5ed71c12b9cc26667e60b75 /gdb/solib-svr4.c | |
parent | a0719e0a0552679ac51aafaf2f6b30cfecf20ed3 (diff) | |
download | gdb-6b3a2759052d1874a5952b7901e2b41890ae992f.zip gdb-6b3a2759052d1874a5952b7901e2b41890ae992f.tar.gz gdb-6b3a2759052d1874a5952b7901e2b41890ae992f.tar.bz2 |
Use function_view in gdb_bfd_lookup_symbol
This changes gdb_bfd_lookup_symbol to use a function_view. This
simplifies the code a little bit.
Diffstat (limited to 'gdb/solib-svr4.c')
-rw-r--r-- | gdb/solib-svr4.c | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c index b3f6b6a..5a72893 100644 --- a/gdb/solib-svr4.c +++ b/gdb/solib-svr4.c @@ -2301,14 +2301,6 @@ svr4_create_solib_event_breakpoints (svr4_info *info, struct gdbarch *gdbarch, } } -/* Helper function for gdb_bfd_lookup_symbol. */ - -static int -cmp_name_and_sec_flags (const asymbol *sym, const void *data) -{ - return (strcmp (sym->name, (const char *) data) == 0 - && (sym->section->flags & (SEC_CODE | SEC_DATA)) != 0); -} /* Arrange for dynamic linker to hit breakpoint. Both the SunOS and the SVR4 dynamic linkers have, as part of their @@ -2553,9 +2545,15 @@ enable_break (struct svr4_info *info, int from_tty) /* Now try to set a breakpoint in the dynamic linker. */ for (bkpt_namep = solib_break_names; *bkpt_namep != NULL; bkpt_namep++) { - sym_addr = gdb_bfd_lookup_symbol (tmp_bfd.get (), - cmp_name_and_sec_flags, - *bkpt_namep); + sym_addr + = (gdb_bfd_lookup_symbol + (tmp_bfd.get (), + [=] (const asymbol *sym) + { + return (strcmp (sym->name, *bkpt_namep) == 0 + && ((sym->section->flags & (SEC_CODE | SEC_DATA)) + != 0)); + })); if (sym_addr != 0) break; } |