This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[patch]change dwarf2_start_subfile() to adapt inappropriate dir name
- From: JuYoung Kim <j0 dot kim at samsung dot com>
- To: "gdb-patches at sourceware dot org" <gdb-patches at sourceware dot org>
- Cc: êìì <j0 dot kim at samsung dot com>
- Date: Mon, 15 Nov 2010 01:21:14 +0000 (GMT)
- Subject: [patch]change dwarf2_start_subfile() to adapt inappropriate dir name
- Msgkey: 20101115011123135@j0.kim
- Reply-to: j0 dot kim at samsung dot com
Hello, My name is Kim, Juyoung at TmaxCore co. in south korea.
I've sent this email last week but haven't receive any reply or inform.
Today I found the email was encoded in korean and maybe you could not read it.
So, I send this mail again, and I hope you reply me as possible as you can, please.
It is about subfile for DWARF.
When you see the function dwarf2_start_subfile() in the source, there is a comment about source's file name.
Some compiler ( like RCVT3.1 ) include '/' at the end of dir name.
For example,
in case, DW_AT_name: /srcdir/list0.c
you expect
ÂÂ Â files.files[0].name: list0.h
ÂÂ Â files.files[0].dir: /srcdir
but, the DWARF made by RVCT3.1 is like this.
ÂÂ Âfiles.files[0].name: list0.h
ÂÂ Âfiles.files[0].dir: /srcdir/
then the function dwarf2_start_subfile(); make the fullname "/srcdir//list0.c"
, which result in the gdb cannot find the source's debugging information.
The function dwarf2_start_subfile() is at gdb/dwarf2read.c:8650.
The original source code is
.........
ÂÂif (!IS_ABSOLUTE_PATH (filename) && dirname != NULL) {
ÂÂ Âfullname = concat (dirname, SLASH_STRING, filename, (char *)NULL);
ÂÂ}
ÂÂelse
ÂÂ Âfullname = filename;
........
I changed it as below.
........
ÂÂif (!IS_ABSOLUTE_PATH (filename) && dirname != NULL) {
ÂÂ Â if (dirname[strlen(dirname)-1] == '/' || dirname[strlen(dirname)-1] == '')
    fullname = concat (dirname, filename, (char *)NULL);
ÂÂ Â else fullname = concat (dirname, SLASH_STRING, filename, (char *)NULL);
ÂÂ}
ÂÂelse
ÂÂ Â fullname = filename;
..........
This is my first time to report the patch.
So please, inform me if my way of reporting is not proper.
Thanks.