From e4730328287f755eb313c3762d83d389462cde15 Mon Sep 17 00:00:00 2001 From: Simon Marchi Date: Wed, 6 Apr 2022 10:42:02 -0400 Subject: gdb: remove symtab::dirname I think the symtab::dirname method is bogus, or at least very misleading. It makes you think that it returns the directory that was used to find that symtab's file during compilation (i.e. the directory the file refers to in the DWARF line header file table), or the directory part of the symtab's filename maybe. In fact, it returns the compilation unit's directory, which is the CWD of the compiler, at compilation time. At least for DWARF, if the symtab's filename is relative, it will be relative to that directory. But if the symtab's filename is absolute, then the directory returned by symtab::dirname has nothing to do with the symtab's filename. Remove symtab::dirname to avoid this confusion, change all users to fetch the same information through the compunit. At least, it will be clear that this is a compunit property, not a symtab property. Change-Id: I2894c3bf3789d7359a676db3c58be2c10763f5f0 --- gdb/cli/cli-cmds.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'gdb/cli/cli-cmds.c') diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c index 945fd35..31b493e 100644 --- a/gdb/cli/cli-cmds.c +++ b/gdb/cli/cli-cmds.c @@ -2050,8 +2050,8 @@ ambiguous_line_spec (gdb::array_view sals, static int cmp_symtabs (const symtab_and_line &sala, const symtab_and_line &salb) { - const char *dira = sala.symtab->dirname (); - const char *dirb = salb.symtab->dirname (); + const char *dira = sala.symtab->compunit ()->dirname (); + const char *dirb = salb.symtab->compunit ()->dirname (); int r; if (dira == NULL) -- cgit v1.1