[gdb/testsuite] Fix gdb.dwarf2/dw2-dir-file-name.exp with clang
When running test-case gdb.dwarf2/dw2-dir-file-name.exp with clang, we run
into:
...
(gdb) break *compdir_missing__ldir_missing__file_basename^M
Breakpoint 2 at 0x400580^M
(gdb) continue^M
Continuing.^M
^M
Breakpoint 2, 0x0000000000400580 in \
compdir_missing.ldir_missing.file_basename ()^M
(gdb) FAIL: gdb.dwarf2/dw2-dir-file-name.exp: \
compdir_missing__ldir_missing__file_basename: continue to breakpoint: \
compdir_missing__ldir_missing__file_basename
...
The problem is that the test-case uses labels outside functions, which is know
to cause problem with clang, as documented in the comment for proc
function_range.
Fix this by using get_func_info instead.
Tested on x86_64-linux, with both gcc 7.5.0 and clang 13.0.0.