This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Patch]: Path problems when setting breakpoints using mingw-build-gdb


Hi Eli Zaretskii, Thanks for your reply.

> What is the GDB version you used? where did you get the binary?
gdb-6.6 for score(newly added) target.
and build using gcc-4.2

If you want to reproduce this on your machine, you need to check
out gcc and binutils source and use --target=score-elf to build.
Besides, i will mail the already build score-elf-gdb to you, 
for there is no score simulator source in the gdb source tree. 
I will first try to explan the problem here if we can solve the
problem.

> Personally, I don't think it's related at all, because SLASH_STRING
> should not be used where an absolute file name is taken apart to look
> for the directory and the basename.  Instead, GDB should use other
> macros, such as IS_DIR_SEPARATOR (from include/filenames.h), which do
> cater to Windows filenames.
> 
> SLASH_STRING is only used to _construct_ file names, and that is okay,
> since the Windows file I/O APIs recognize both \ and / as separators.

dwarf-2 info of gcd.elf is in the log file. See function "start_subfile". 
This function is firstly called according to the DIE:

The section .debug_info contains:

  Compilation Unit @ offset 0x0:
   Length:        128 
   Version:       2 
   Abbrev Offset: 0
   Pointer Size:  4
 <0><b>: Abbrev Number: 1 (DW_TAG_compile_unit)
     DW_AT_producer    : GNU C 4.2.0 20070111 (prerelease) 
     DW_AT_language    : 1  (ANSI C)
     DW_AT_name        : F:\gcd\2310gcd\main.c 
     DW_AT_comp_dir    : F:\\gcd\\2310gcd 
     DW_AT_low_pc      : 0xa00011d8 
     DW_AT_high_pc     : 0xa00011e6 
     DW_AT_stmt_list   : 0 

and then create a subfile, we call it subfile1
(gdb) p *subfile1
$88 = {
  next = 0x0, 
  name = 0x8961f60 "F:\\gcd\\2310gcd\\main.c", 
  dirname = 0x8961be8 "F:\\\\gcd\\\\2310gcd", 
  line_vector = 0x0, 
  line_vector_length = 0, 
  language = language_c, 
  debugformat = 0x0
}

Secondly, "start_subfile" is called according to .debug_line's
"Directory Table" and "File Name Table":

gdb will use "SLASH_STRING" to combine full filenames, and create
another subfile, we call it subfile2
(gdb) p *subfile2
$89 = {
  next = 0x8961f40, 
  name = 0x89623a0 "F:\\gcd\\2310gcd/main.c", 
  dirname = 0x89623c0 "F:\\\\gcd\\\\2310gcd", 
  line_vector = 0x0, 
  line_vector_length = 0, 
  language = language_c, 
  debugformat = 0x0
}

subfile1->name and subfile2->name are not equal.
and current_subfile = subfile2;

When setting breakpoint like "b main.c:3" using mingw-build-gdb, 
it will print: No line 3 in file "F:\\gcd\\2310gcd\\main.c".
just for subfile1->line_vector = 0.

I think here gdb should create one "subfile" per source file.
So i modify "SLASH_STRING" to keep "subfile->name" equals to "name",
and "start_subfile" creates only one "subfile" according to both
.debug_info DIE and .debug_line's "Directory Table" and "File Name Table".

> Did you try applying that patch, and if so, did the problem go away?
Yes.



Best regards,
Qinwei
Mail  qinwei@sunnorth.com.cn
Phone +86-010-62981668-2708
Fax   +86-010-62985972

Attachment: log
Description: Binary data


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]