[Bug 1000513] New: ltrace shows no parameters when debuginfo installed
http://bugzilla.suse.com/show_bug.cgi?id=1000513 Bug ID: 1000513 Summary: ltrace shows no parameters when debuginfo installed Classification: openSUSE Product: openSUSE Tumbleweed Version: Current Hardware: Other OS: Other Status: NEW Severity: Normal Priority: P5 - None Component: Development Assignee: bnc-team-screening@forge.provo.novell.com Reporter: jslaby@suse.com QA Contact: qa-bugs@suse.de Found By: --- Blocker: --- $ ltrace echo __libc_start_main([ "echo" ] <unfinished ...> getenv("POSIXLY_CORRECT") = nil strrchr("echo", '/') = nil setlocale(LC_ALL, "") = "cs_CZ.UTF-8" bindtextdomain("coreutils", "/usr/share/locale") = "/usr/share/locale" textdomain("coreutils") = "coreutils" ... # zypper in coreutils-debuginfo $ ltrace echo __libc_start_main([ "echo" ] <unfinished ...> getenv() = <void> strrchr() = <void> setlocale() = <void> bindtextdomain() = <void> textdomain() = <void> ... Seems like ltrace DW support is broken somehow. -- You are receiving this mail because: You are on the CC list for the bug.
http://bugzilla.suse.com/show_bug.cgi?id=1000513 Jiri Slaby <jslaby@suse.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|bnc-team-screening@forge.pr |schwab@suse.com |ovo.novell.com | -- You are receiving this mail because: You are on the CC list for the bug.
http://bugzilla.suse.com/show_bug.cgi?id=1000513 http://bugzilla.suse.com/show_bug.cgi?id=1000513#c1 --- Comment #1 from Jiri Slaby <jslaby@suse.com> --- Created attachment 693723 --> http://bugzilla.suse.com/attachment.cgi?id=693723&action=edit potential fix This fixes it for me. It really makes no sense to import functions from dwarf which have no prototype in there. The only problem I see with the patch is that dwarf specs says "may have": "A subroutine entry declared with a function prototype style declaration may have a DW_AT_prototyped attribute, which is a flag." -- You are receiving this mail because: You are on the CC list for the bug.
http://bugzilla.suse.com/show_bug.cgi?id=1000513 http://bugzilla.suse.com/show_bug.cgi?id=1000513#c2 --- Comment #2 from Andreas Schwab <schwab@suse.com> --- Why does the debug info have no prototypes? That looks like a bug in the compiler output. -- You are receiving this mail because: You are on the CC list for the bug.
http://bugzilla.suse.com/show_bug.cgi?id=1000513 http://bugzilla.suse.com/show_bug.cgi?id=1000513#c4 --- Comment #4 from Jiri Slaby <jslaby@suse.com> --- (In reply to Michael Matz from comment #3)
Jiri: can you look at coreutils-debuginfo if it contains getenv entries? (Use readelf -wi for inspection).
Yes, it does. I checked it before, that's why the patch works :). <1><1414>: Abbrev Number: 65 (DW_TAG_subprogram) <1415> DW_AT_external : 1 <1415> DW_AT_declaration : 1 <1415> DW_AT_linkage_name: (indirect string, offset: 0x48b): getenv <1419> DW_AT_name : (indirect string, offset: 0x48b): getenv <141d> DW_AT_decl_file : 23 <141e> DW_AT_decl_line : 564 DW_AT_decl_file 23 is /usr/include/stdlib.h: 559-#endif 560- 561- 562-__BEGIN_NAMESPACE_STD 563-/* Return the value of envariable NAME, or NULL if it doesn't exist. */ 564:extern char *getenv (const char *__name) __THROW __nonnull ((1)) __wur; 565-__END_NAMESPACE_STD 566- 567-#ifdef __USE_GNU 568-/* This function is similar to the above but returns NULL if the -- You are receiving this mail because: You are on the CC list for the bug.
http://bugzilla.suse.com/show_bug.cgi?id=1000513 http://bugzilla.suse.com/show_bug.cgi?id=1000513#c6 --- Comment #6 from Andreas Schwab <schwab@suse.com> --- In 13.2 or 42.1 the debuginfo contains fully prototyped entries. Why is factory different? -- You are receiving this mail because: You are on the CC list for the bug.
http://bugzilla.suse.com/show_bug.cgi?id=1000513 http://bugzilla.suse.com/show_bug.cgi?id=1000513#c8 --- Comment #8 from Jiri Slaby <jslaby@suse.com> --- (In reply to Michael Matz from comment #7)
(In reply to Andreas Schwab from comment #6)
In 13.2 or 42.1 the debuginfo contains fully prototyped entries. Why is factory different?
I guess gcc-6 makes the difference in that case. If somebody provides us a preprocessed file I can analyze this.
I tried your example from comment #3. I need -O2 to have getenv in dw. gcc-5 behaves the same. 42.2 have debuginfo with prototypes too. -- You are receiving this mail because: You are on the CC list for the bug.
http://bugzilla.suse.com/show_bug.cgi?id=1000513 http://bugzilla.suse.com/show_bug.cgi?id=1000513#c9 --- Comment #9 from Jiri Slaby <jslaby@suse.com> --- OTOH, gcc-6 on 42.2 does not put getenv into dw. -- You are receiving this mail because: You are on the CC list for the bug.
http://bugzilla.suse.com/show_bug.cgi?id=1000513 http://bugzilla.suse.com/show_bug.cgi?id=1000513#c10 --- Comment #10 from Jiri Slaby <jslaby@suse.com> --- (In reply to Jiri Slaby from comment #9)
OTOH, gcc-6 on 42.2 does not put getenv into dw.
Wrong: gcc-6 on 42.2 DOES put getenv into dw, but without prototype: $ gcc-6 dw.c -o dw.o -g -c -O2 && readelf -wi dw.o|grep -C 5 getenv <359> DW_AT_abstract_origin: <0x36a> <2><35d>: Abbrev Number: 0 <1><35e>: Abbrev Number: 22 (DW_TAG_subprogram) <35f> DW_AT_external : 1 <35f> DW_AT_declaration : 1 <35f> DW_AT_linkage_name: (indirect string, offset: 0x186): getenv <363> DW_AT_name : (indirect string, offset: 0x186): getenv <367> DW_AT_decl_file : 7 <368> DW_AT_decl_line : 564 <1><36a>: Abbrev Number: 23 (DW_TAG_subprogram) <36b> DW_AT_external : 1 <36b> DW_AT_declaration : 1 gcc 4.8 puts in the prototype: gcc-4.8 dw.c -o dw.o -g -c -O2 && readelf -wi dw.o|grep -C 5 getenv <2fb> DW_AT_type : <0x264> <2ff> DW_AT_external : 1 <2ff> DW_AT_declaration : 1 <1><2ff>: Abbrev Number: 19 (DW_TAG_subprogram) <300> DW_AT_external : 1 <300> DW_AT_name : (indirect string, offset: 0x268): getenv <304> DW_AT_decl_file : 6 <305> DW_AT_decl_line : 564 <307> DW_AT_prototyped : 1 <307> DW_AT_type : <0x8b> <30b> DW_AT_declaration : 1 -- You are receiving this mail because: You are on the CC list for the bug.
http://bugzilla.suse.com/show_bug.cgi?id=1000513 http://bugzilla.suse.com/show_bug.cgi?id=1000513#c11 --- Comment #11 from Jiri Slaby <jslaby@suse.com> --- For completeness, gcc 5 on factory: $ gcc-5 dw.c -o dw.o -g -c -O2 && readelf -wi dw.o|grep -C 5 getenv <2f1> DW_AT_external : 1 <2f1> DW_AT_declaration : 1 <1><2f1>: Abbrev Number: 18 (DW_TAG_subprogram) <2f2> DW_AT_external : 1 <2f2> DW_AT_declaration : 1 <2f2> DW_AT_linkage_name: (indirect string, offset: 0x28a): getenv <2f6> DW_AT_name : (indirect string, offset: 0x28a): getenv <2fa> DW_AT_decl_file : 6 <2fb> DW_AT_decl_line : 564 <1><2fd>: Abbrev Number: 19 (DW_TAG_subprogram) <2fe> DW_AT_external : 1 <2fe> DW_AT_declaration : 1 -- You are receiving this mail because: You are on the CC list for the bug.
http://bugzilla.suse.com/show_bug.cgi?id=1000513 http://bugzilla.suse.com/show_bug.cgi?id=1000513#c12 --- Comment #12 from Jiri Slaby <jslaby@suse.com> --- And to fill the gap, 4.9 is still OK: $ gcc-4.9 dw.c -o dw.o -g -c -O2 && readelf -wi dw.o|grep -C 5 getenv <2fb> DW_AT_type : <0x264> <2ff> DW_AT_external : 1 <2ff> DW_AT_declaration : 1 <1><2ff>: Abbrev Number: 19 (DW_TAG_subprogram) <300> DW_AT_external : 1 <300> DW_AT_name : (indirect string, offset: 0x268): getenv <304> DW_AT_decl_file : 6 <305> DW_AT_decl_line : 564 <307> DW_AT_prototyped : 1 <307> DW_AT_type : <0x8b> <30b> DW_AT_declaration : 1 So it has to be something new in gcc-5. -- You are receiving this mail because: You are on the CC list for the bug.
http://bugzilla.suse.com/show_bug.cgi?id=1000513 http://bugzilla.suse.com/show_bug.cgi?id=1000513#c13 --- Comment #13 from Jiri Slaby <jslaby@suse.com> --- Created attachment 694994 --> http://bugzilla.suse.com/attachment.cgi?id=694994&action=edit preprocessed file (In reply to Michael Matz from comment #7)
I guess gcc-6 makes the difference in that case. If somebody provides us a preprocessed file I can analyze this.
Attached. -- You are receiving this mail because: You are on the CC list for the bug.
http://bugzilla.suse.com/show_bug.cgi?id=1000513 Andreas Schwab <schwab@suse.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |schwab@suse.com Assignee|schwab@suse.com |matz@suse.com -- You are receiving this mail because: You are on the CC list for the bug.
http://bugzilla.suse.com/show_bug.cgi?id=1000513 http://bugzilla.suse.com/show_bug.cgi?id=1000513#c15 --- Comment #15 from Richard Biener <rguenther@suse.com> --- It's a "feature" to implement DW_TAG_GNU_call_site / DW_TAG_GNU_call_site_parameter support. You get this non-prototyped decl also with -O0 if you enable -fvar-tracking. The non-prototyped form is the minimal info that is needed it seems. -- You are receiving this mail because: You are on the CC list for the bug.
http://bugzilla.suse.com/show_bug.cgi?id=1000513 http://bugzilla.suse.com/show_bug.cgi?id=1000513#c16 Jiri Slaby <jslaby@suse.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution|--- |FIXED --- Comment #16 from Jiri Slaby <jslaby@suse.com> --- It seems to be fixed somehow. -- You are receiving this mail because: You are on the CC list for the bug.
http://bugzilla.suse.com/show_bug.cgi?id=1000513 http://bugzilla.suse.com/show_bug.cgi?id=1000513#c17 Jiri Slaby <jslaby@suse.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |REOPENED Resolution|FIXED |--- --- Comment #17 from Jiri Slaby <jslaby@suse.com> --- (In reply to Jiri Slaby from comment #1)
Created attachment 693723 [details] potential fix
Reopening as this patch is still needed. No matter whether glibc-debuginfo is installed or not, it behaves the same. Important is how the code below is compiled (-g -Og needed). Source: #include <stdio.h> int main(void) { fwrite("a", 1, 1, stdout); fwrite("b", 1, 1, stdout); fwrite("\n", 1, 1, stdout); return 0; } Build: gcc tracer.c -Og -g Without the patch: $ ltrace ./a.out fwrite() = <void> fwrite() = <void> fwrite(ab ) = <void> +++ exited (status 0) +++ With the patch: ltrace ./a.out fwrite("a", 1, 1, 0x7f049ee5b760) = 1 fwrite("b", 1, 1, 0x7f049ee5b760) = 1 fwrite("\n", 1, 1, 0x7f049ee5b760ab ) = 1 +++ exited (status 0) +++ I tried to build with all these flags, but the issue is not reproducible, so Og must enable some more: -fcombine-stack-adjustments -fcompare-elim -fcprop-registers -fdefer-pop -fforward-propagate -fguess-branch-probability -fipa-profile -fipa-pure-const -fipa-reference -fomit-frame-pointer -freorder-blocks -fshrink-wrap -fsplit-wide-types -ftree-builtin-call-dce -ftree-ccp -ftree-coalesce-vars -ftree-copy-prop -ftree-dce -ftree-dominator-opts -ftree-dse -ftree-fre -ftree-ch -ftree-sink -ftree-slsr -ftree-ter -- You are receiving this mail because: You are on the CC list for the bug.
participants (1)
-
bugzilla_noreply@novell.com