This is the mail archive of the
mailing list for the GDB project.
Re: setting a breakpoint on a dll, relative path or absolute path issue
- From: Asm warrior <asmwarrior at gmail dot com>
- To: MinGW Users List <mingw-users at lists dot sourceforge dot net>, gdb at sourceware dot org
- Cc: "John E. / TDM" <tdragon at tdragon dot net>, Eli Zaretskii <eliz at gnu dot org>, jan dot kratochvil at redhat dot com, keiths at redhat dot com
- Date: Mon, 13 Jun 2011 14:29:28 +0800
- Subject: Re: setting a breakpoint on a dll, relative path or absolute path issue
- References: <4DF31EB0.email@example.com> <4DF37ADA.firstname.lastname@example.org> <4DF4513A.email@example.com>
I just go a little further, and found that there is a function to look
up a file name in symbol tables.
struct symtab * lookup_symtab (const char *name)
the parameter name is the user supplied file name string to set a
This function will loop all the symbols and do a string match.
symtab_to_fullname() is used to read symbol's filename, it was defined
in the gdb/source.c line 1110
symtab_to_fullname (struct symtab *s)
/* Don't check s->fullname here, the file could have been
deleted/moved/..., look for it again. */
r = find_and_open_source (s->filename, s->dirname, &s->fullname);
if (r >= 0)
When loop on the symbols. I found that at one loop, I get
s->filename = "../../src/common/string.cpp"
s->dirname = "D:\code\wxWidgets-2.8.12\build\msw"
But too badly, the result
This is the reason about the issue, if the result is:
Then, this problem can be fixed.
I'm not sure why gdb does not give a cannical filename, but still leaves
the "../../" in the result.
By the way, gdb's matching algorithm care both "/" and "\" as equivalent
char under Windows.
Look at here: gdb\libiberty\filename_cmp.c
filename_cmp (const char *s1, const char *s2)
return strcmp(s1, s2);
int c1 = TOLOWER (*s1);
int c2 = TOLOWER (*s2);
/* On DOS-based file systems, the '/' and the '\' are equivalent. */
if (c1 == '/')
c1 = '\\';
if (c2 == '/')
c2 = '\\';
if (c1 != c2)
return (c1 - c2);
if (c1 == '\0')
ollydbg from codeblocks' forum