From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10210 invoked by alias); 3 Jun 2006 09:46:53 -0000 Received: (qmail 10193 invoked by uid 22791); 3 Jun 2006 09:46:49 -0000 X-Spam-Check-By: sourceware.org Received: from nitzan.inter.net.il (HELO nitzan.inter.net.il) (192.114.186.20) by sourceware.org (qpsmtpd/0.31) with ESMTP; Sat, 03 Jun 2006 09:46:12 +0000 Received: from HOME-C4E4A596F7 (IGLD-80-230-158-16.inter.net.il [80.230.158.16]) by nitzan.inter.net.il (MOS 3.7.3-GA) with ESMTP id DOJ57347 (AUTH halo1); Sat, 3 Jun 2006 12:45:59 +0300 (IDT) Date: Sat, 03 Jun 2006 09:46:00 -0000 Message-Id: From: Eli Zaretskii To: Nick Roberts CC: susan@smacchia.net, jimb@codesourcery.com, gdb@sourceware.org In-reply-to: <17536.58772.420434.491191@kahikatea.snap.net.nz> (message from Nick Roberts on Sat, 3 Jun 2006 13:27:48 +1200) Subject: Re: MI: -file-list-exec-source-files Reply-to: Eli Zaretskii References: <20060603004553.33821.qmail@web51812.mail.yahoo.com> <17536.58772.420434.491191@kahikatea.snap.net.nz> X-IsSubscribed: yes Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2006-06/txt/msg00012.txt.bz2 > From: Nick Roberts > Date: Sat, 3 Jun 2006 13:27:48 +1200 > Cc: Jim Blandy , gdb@sourceware.org > > I think it's always best to start with the simplest case: > > mytest.c: > > main () > { > myproc (); > } > > > myproc.c: > > myproc () > { > return 0; > } > > With gcc (GCC) 4.1.0 20060304 (Red Hat 4.1.0-3) > cc -g -c myproc.c > cc -g -o mytest mytest.c myproc.o > > With GNU gdb 6.5.50.20060601-cvs, I get: > > (gdb) > -file-list-exec-source-files > ^done,files=[{file="myproc.c",fullname="/home/nickrob/myproc.c"},{file="myproc.c",fullname="/home/nickrob/myproc.c"},{file="mytest.c",fullname="/home/nickrob/mytest.c"},{file="mytest.c",fullname="/home/nickrob/mytest.c"}] With GDB 6.4 and GCC 3.3.5, just stepping through the code of mi_cmd_file_list_exec_source_files, I clearly see that there are two psymtab entries for each source file: (top-gdb) br mi_cmd_file_list_exec_source_files Breakpoint 3 at 0x80bf7c8: file ../gdb/mi/mi-cmd-file.c, line 74. (top-gdb) cd ../.. Working directory /home/e/eliz. (top-gdb) r --interpreter=mi ./mytest Starting program: /home/e/eliz/gdb-6.4/gdb/gdb --interpreter=mi ./mytest ~"GNU gdb 6.4\n" ~"Copyright 2005 Free Software Foundation, Inc.\n" ~"GDB is free software, covered by the GNU General Public License, and you are\n" ~"welcome to change it and/or distribute copies of it under certain conditions.\n" ~"Type \"show copying\" to see the conditions.\n" ~"There is absolutely no warranty for GDB. Type \"show warranty\" for details.\n" ~"This GDB was configured as \"i686-pc-linux-gnu\"..." ~"Using host libthread_db library \"/lib/tls/libthread_db.so.1\".\n" ~"\n" (gdb) -file-list-exec-source-files Breakpoint 3, mi_cmd_file_list_exec_source_files ( command=0x83304b0 "file-list-exec-source-files", argv= During symbol reading, incomplete CFI data; unspecified registers (e.g., eax) at 0x80bf7c8. 0x83304b0, argc=137561264) at ../gdb/mi/mi-cmd-file.c:74 74 if (!mi_valid_noargs ("mi_cmd_file_list_exec_source_files", argc, argv)) (top-gdb) n 78 ui_out_begin (uiout, ui_out_type_list, "files"); (top-gdb) n 81 ALL_SYMTABS (objfile, s) (top-gdb) n 97 ALL_PSYMTABS (objfile, ps) (top-gdb) p *objfile $3 = {next = 0x0, name = 0x8312838 "/home/e/eliz/mytest", flags = 6, symtabs = 0x0, psymtabs = 0x8335740, free_psymtabs = 0x0, obfd = 0x8312878, mtime = 1149325604, objfile_obstack = {chunk_size = 4072, chunk = 0x83356e0, [...] stats = {n_minsyms = 36, n_psyms = 109, n_syms = 0, n_stabs = 0, n_types = 0, sz_strtab = 0}, cp_namespace_symtab = 0x0} (top-gdb) p *objfile->psymtabs $4 = {next = 0x83356e8, filename = 0x8335788 "/build/buildd/glibc-2.3.2.ds1/build-tree/i386-libc/csu/crtn.S", fullname = 0x0, dirname = 0x8330470 "/build/buildd/glibc-2.3.2.ds1/build-tree/glibc-2.3.2/csu", objfile = 0x8326a98, section_offsets = 0x832cd6c, textlow = 0, texthigh = 0, dependencies = 0x0, number_of_dependencies = 0, globals_offset = 3, n_global_syms = 0, statics_offset = 106, n_static_syms = 0, symtab = 0x0, read_symtab = 0x814e870 , read_symtab_private = 0x8331e38 "±\n", readin = 0 '\0'} (top-gdb) p *objfile->psymtabs->next $5 = {next = 0x8332694, filename = 0x8335730 "myproc.c", fullname = 0x0, dirname = 0x0, objfile = 0x8326a98, section_offsets = 0x832cd6c, textlow = 0, texthigh = 0, dependencies = 0x833573c, number_of_dependencies = 1, globals_offset = 0, n_global_syms = 0, statics_offset = 0, n_static_syms = 0, symtab = 0x0, read_symtab = 0x814e870 , read_symtab_private = 0x0, readin = 0 '\0'} (top-gdb) p *objfile->psymtabs->next->next $6 = {next = 0x833263c, filename = 0x83326dc "myproc.c", fullname = 0x0, dirname = 0x8314b70 "/home/e/eliz", objfile = 0x8326a98, section_offsets = 0x832cd6c, textlow = 134513516, texthigh = 134513526, dependencies = 0x0, number_of_dependencies = 0, globals_offset = 2, n_global_syms = 1, statics_offset = 105, n_static_syms = 1, symtab = 0x0, read_symtab = 0x814e870 , read_symtab_private = 0x8331e24 "9\n", readin = 0 '\0'} (top-gdb) p *objfile->psymtabs->next->next->next $7 = {next = 0x83325e8, filename = 0x8332684 "mytest.c", fullname = 0x0, dirname = 0x0, objfile = 0x8326a98, section_offsets = 0x832cd6c, textlow = 0, texthigh = 0, dependencies = 0x8332690, number_of_dependencies = 1, globals_offset = 0, n_global_syms = 0, statics_offset = 0, n_static_syms = 0, symtab = 0x0, read_symtab = 0x814e870 , read_symtab_private = 0x0, readin = 0 '\0'} (top-gdb) p *objfile->psymtabs->next->next->next->next $8 = {next = 0x8332560, filename = 0x8332630 "mytest.c", fullname = 0x0, dirname = 0x8314300 "/home/e/eliz", objfile = 0x8326a98, section_offsets = 0x832cd6c, textlow = 134513492, texthigh = 134513515, dependencies = 0x0, number_of_dependencies = 0, globals_offset = 1, n_global_syms = 1, statics_offset = 104, n_static_syms = 1, symtab = 0x0, read_symtab = 0x814e870 , read_symtab_private = 0x8331e10 "¬\t", readin = 0 '\0'} (top-gdb) As you see, there are two entries for myproc.c and two entries for mytest.c, one with a NULL dirname, the other with a non-NULL dirname. Sounds like we should implement duplicate removal from the UI lists?