Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1084404

Summary: [ppc64] and [s390x] wrong prologue skip on -O2 -g code
Product: Red Hat Enterprise Linux 7 Reporter: David Spurek <dspurek>
Component: gdbAssignee: Sergio Durigan Junior <sergiodj>
Status: CLOSED ERRATA QA Contact: Miroslav Franc <mfranc>
Severity: high Docs Contact:
Priority: high    
Version: 7.1CC: amarecek, fche, gdb-bugs, jan.kratochvil, mattn, mcermak, mfranc, ohudlick, sergiodj
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: gdb-7.6.1-76.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-11-19 13:01:24 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1205796    
Attachments:
Description Flags
Fix.
none
Test data for the fix in attachment 1015648. none

Description David Spurek 2014-04-04 09:17:27 UTC
Description of problem:
[ppc64] and [s390x] wrong prologue skip on -O2 -g code



Version-Release number of selected component (if applicable):
gdb-7.6.1-51.el7

How reproducible:
100%

Steps to Reproduce:
1.gdb --args sudo sleep 1
2.b select
3.run

Actual results:
Breakpoint isn't reached

Expected results:
Breakpoint reached

Additional info:
case works right on x86_64.

Breakpoint is reached with 'gdb -ex start -ex 'b select' -ex c --args sudo sleep 1'

Comment 1 Jan Kratochvil 2014-04-04 10:43:43 UTC
Probably extend this commit for DW_AT_producer -grecord-gcc-switches:
https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff;h=8be455d765a7cfb8f2cb045ec80e2b2af1597d15

Comment 2 Jan Kratochvil 2014-08-01 12:19:42 UTC
python-libs-2.7.5-16.bs1_0.ppc64le
gdb /usr/lib64/libpython2.7.so
(gdb) break PyObject_Print
Actual:
Breakpoint 3 at 0x3fffb7dd1798: file /usr/src/debug/Python-2.7.5/Objects/object.c, line 329.
Expected:
Breakpoint 3 at 0x3fffb7dd1790: file /usr/src/debug/Python-2.7.5/Objects/object.c, line 329.
00000000000d1790 <PyObject_Print>:
   d1790:       1b 00 4c 3c     addis   r2,r12,27
   d1794:       00 f3 42 38     addi    r2,r2,-3328
   d1798:       a6 02 08 7c     mflr    r0
           producer             (GNU_strp_alt) "GNU C 4.8.2 20140409 (Red Hat 4.8.2-17) -Asystem=linux -Asystem=unix -Asystem=posix -msecure-plt -mcpu=power7 -mtune=power7 -m64 -mcpu=power7 -mtune=power7 -g -g -O2 -O3 -O2 -O3 -fno-strict-aliasing -fstack-protector-strong -fexceptions -fstack-protector-strong -fwrapv -fPIC --param ssp-buffer-size=4 --param ssp-buffer-size=4"

Comment 3 Sergio Durigan Junior 2014-10-14 17:23:07 UTC
Moving to RHEL-7.2.  The fix has proven to be more difficult than I was expecting, so it will need to be investigated/discussed more.

Comment 7 Jan Kratochvil 2015-04-17 15:27:03 UTC
Created attachment 1015648 [details]
Fix.

It does not have regressions on Fedora and it seems OK to me this way.

Comment 8 Sergio Durigan Junior 2015-06-17 16:12:14 UTC
(In reply to Jan Kratochvil from comment #7)
> Created attachment 1015648 [details]
> Fix.
> 
> It does not have regressions on Fedora and it seems OK to me this way.

This patch does not fix the issue, at least as far as I have tested.  I still see the same behavior described in the initial report, and also doing a very simple test (simple program compiled with -O2 -g).

I am starting to investigate this, but the problem seems to be that symtab->locations_valid is never marked as 1 on process_full_comp_unit (this is because cu->language is not asm, and cu->has_loclist is zero), and therefore all the new logic implemented on skip_prologue{,_using}_sal does not kick in.

Comment 9 Jan Kratochvil 2015-06-18 09:01:29 UTC
Created attachment 1040379 [details]
Test data for the fix in attachment 1015648 [details].

before fix:
(gdb) b select
Breakpoint 1 at 0x121840: file ../sysdeps/unix/syscall-template.S, line 82.

after fix:
(gdb) b select
Breakpoint 1 at 0x1217b4: file ../sysdeps/unix/syscall-template.S, line 81.

00000000001217b4 <.__select>:
__GI_select():
/usr/src/debug////////glibc-2.17-c758a686/misc/../sysdeps/unix/syscall-template.S:81
  1217b4:       81 4d 88 d0     lwz     r10,-30512(r13)
  1217b8:       2c 0a 00 00     cmpwi   r10,0
  1217bc:       40 c2 00 14     bne-    1217d0 <___newselect_nocancel+0x10>
00000000001217c0 <___newselect_nocancel>:
___newselect_nocancel():
  1217c0:       38 00 00 8e     li      r0,142
  1217c4:       44 00 00 02     sc
  1217c8:       4c e3 00 20     bnslr+
  1217cc:       4b f2 2e f4     b       446c0 <.__syscall_error>
  1217d0:       f8 21 ff 81     stdu    r1,-128(r1)
[...]
  12183c:       38 21 00 80     addi    r1,r1,128
/usr/src/debug////////glibc-2.17-c758a686/misc/../sysdeps/unix/syscall-template.S:82
  121840:       4c e3 00 20     bnslr+
  121844:       4b f2 2e 7c     b       446c0 <.__syscall_error>
[...]

 <0><37b6d5>: Abbrev Number: 1 (DW_TAG_compile_unit)
    <37b6da>   DW_AT_low_pc      : 0x1217b4
    <37b6e2>   DW_AT_high_pc     : 0x121864
    <37b6ea>   DW_AT_name        : ../sysdeps/unix/syscall-template.S
    <37b73c>   DW_AT_producer    : GNU AS 2.23.52.0.1
    <37b74f>   DW_AT_language    : 32769        (MIPS assembler)

This libc-2.17.so is from some ppc64 rpm, I do not remember its NVRA.
Sergio, maybe you have a different testcase where this fix does not work.

Comment 10 Sergio Durigan Junior 2015-06-18 23:16:03 UTC
I should have said that I am doing tests on s390x as well.  On PPC64, I see that the patch is working correctly indeed (i.e., I cannot break on 'select' without the patch, but can break with it).  However, on s390x I cannot break on 'select' even with the patch applied.

I'm still investigating this.

Comment 12 Jan Kratochvil 2015-06-20 15:45:51 UTC
Comment on attachment 1015648 [details]
Fix.

New fix for both ppc64 and s390x and with a testcase:
[patch] Do not skip prologue for asm (.S) files
https://sourceware.org/ml/gdb-patches/2015-06/msg00415.html

Comment 15 Jan Kratochvil 2015-06-25 15:48:14 UTC
(In reply to Sergio Durigan Junior from comment #14)
> The last patch causes a few regressions on PPC64:

Thanks for the test, fixed in:
  [patchv2] Do not skip prologue for asm (.S) files
  https://sourceware.org/ml/gdb-patches/2015-06/msg00550.html

Comment 16 Jan Kratochvil 2015-06-26 08:37:46 UTC
Re: [patchv2] Do not skip prologue for asm (.S) files
https://sourceware.org/ml/gdb-patches/2015-06/msg00561.html

Comment 17 Jan Kratochvil 2015-06-26 13:16:54 UTC
Checked in as: 6e22494e5076e4d3c0b2c2785883162f83db499e

Comment 18 Jan Kratochvil 2015-06-30 20:08:21 UTC
[testsuite patch] Fix testsuite regression by: Do not skip prologue for asm (.S) files
https://sourceware.org/ml/gdb-patches/2015-06/msg00611.html

Comment 22 errata-xmlrpc 2015-11-19 13:01:24 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHBA-2015-2089.html

Comment 23 errata-xmlrpc 2015-11-19 13:21:36 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHBA-2015-2089.html