I personally reproduced this in glibc-debuginfo-2.18-16.fc20.x86_64, which was compiled with gcc-4.8.3-7.fc20.x86_64. I'm excerpting the cloned info below to my comment on the gcc-relevant piece. +++ This bug was initially created as a clone of Bug #1151196 +++ As for the apparently-bad $bytes value, we're generally at the mercy of what gcc told us in debuginfo. On my system it looks like: [189214] subprogram external (flag_present) Yes name (strp) "__libc_malloc" decl_file (data1) 3 decl_line (data2) 2844 linkage_name (strp) "__GI___libc_malloc" prototyped (flag_present) Yes type (ref4) [182c49] low_pc (addr) +0x000000000007fca0 high_pc (data8) 244 (+0x000000000007fd94) frame_base (exprloc) [ 0] call_frame_cfa sibling (ref4) [18931e] [18923a] formal_parameter name (strp) "bytes" decl_file (data1) 3 decl_line (data2) 2844 type (ref4) [182bce] location (exprloc) [ 0] reg6 So the parameter is in DWARF reg6, which is x86_64 %rbp. However, normal calling convention puts the first parameter in %rdi, and it's only moved to %rbp as part of the function prologue. 000000338927fca0 <__libc_malloc>: 338927fca0: 55 push %rbp 338927fca1: 48 89 fd mov %rdi,%rbp 338927fca4: 53 push %rbx 338927fca5: 48 83 ec 08 sub $0x8,%rsp Ideally, the debuginfo should be telling us to use %rdi from 7fca0..7fca4, and %rbp only from 7fca4 and on (or until that's invalidated). I tried a similar "__libc_malloc" breakpoint in gdb, and it also prints the wrong value for "bytes" on function entry, but it's fine after stepping once.
FWIW, we do get a good location list in glibc-debuginfo-2.20.90-6.fc22.x86_64, which was compiled with gcc-4.9.1-10.fc22.x86_64. [17c020] subprogram external (flag_present) Yes name (strp) "__libc_malloc" decl_file (data1) 2 decl_line (data2) 2882 prototyped (flag_present) Yes type (ref4) [175217] inline (data1) inlined (1) sibling (ref4) [17c0dd] [17c031] formal_parameter name (strp) "bytes" decl_file (data1) 2 decl_line (data2) 2882 type (ref4) [17519c] [17d204] subprogram abstract_origin (ref4) [17c020] linkage_name (strp) "__GI___libc_malloc" low_pc (addr) +0x0000000000085ae0 high_pc (data8) 395 (+0x0000000000085c6b) frame_base (exprloc) [ 0] call_frame_cfa sibling (ref4) [17d39d] [17d223] formal_parameter abstract_origin (ref4) [17c031] location (sec_offset) location list [ ad9ab] [ ad9ab] +0x0000000000085ae0..+0x0000000000085b43 [ 0] reg5 +0x0000000000085b43..+0x0000000000085bb6 [ 0] reg6 +0x0000000000085bb6..+0x0000000000085bb7 [ 0] GNU_entry_value: [ 0] reg5 [ 3] stack_value +0x0000000000085bb7..+0x0000000000085bcc [ 0] reg5 +0x0000000000085bcc..+0x0000000000085bcd [ 0] GNU_entry_value: [ 0] reg5 [ 3] stack_value +0x0000000000085bcd..+0x0000000000085bd6 [ 0] reg5 +0x0000000000085bd6..+0x0000000000085c6b [ 0] reg6 0000000000085ae0 <__libc_malloc>: 85ae0: 55 push %rbp 85ae1: 53 push %rbx 85ae2: 48 83 ec 08 sub $0x8,%rsp ... So this debuginfo specifies the parameter in reg5 (%rdi) from the very start, and later alternates to reg6 (%rbp) or entry_value (unwound %rdi) as available.
Reduced testcase (x86_64-linux) with -std=gnu99 -fgnu89-inline -O2 -fmerge-all-constants -frounding-math -g -dA -fPIC: void *a; extern void *(*d) (__SIZE_TYPE__, const void *); void *foo (void *, __SIZE_TYPE__); void *bar (void *, __SIZE_TYPE__); void * __libc_malloc (__SIZE_TYPE__ bytes) { void *b, *c; if (__builtin_expect (d != 0, 0)) return d (bytes, 0); b = a; if (!b) return 0; c = foo (b, bytes); if (!c) b = bar (b, bytes); return b; } Before trunk http://gcc.gnu.org/r203167 this indeed has DW_AT_location for bytes as DW_OP_reg6 (%rbp), starting with that change which tiny bit changed __builtin_expect heuristics (e.g. no changes at all in *.optimized dump), it is now tracked correctly. There are no debug insns for bytes though, only for b and c: (debug_insn 23 22 24 3 (var_location:DI b (reg/v/f:DI 3 bx [orig:85 b ] [85])) rh1151226.i:12 -1 (debug_insn 31 29 32 4 (var_location:DI c (reg/v/f:DI 0 ax [orig:86 c ] [86])) rh1151226.i:15 -1 (same between r203166 and r203167), and all the references to bytes in *.compgotos are the same between r20316{6,7} too (grep bytes gives): (insn 2 59 60 2 (set (reg/v:DI 6 bp [orig:89 bytes ] [89]) (reg:DI 5 di [ bytes ])) rh1151226.i:8 85 {*movdi_internal} (reg:DI 5 di [orig:89 bytes ] [89])) rh1151226.i:15 85 {*movdi_internal} (expr_list:REG_DEAD (reg:DI 5 di [orig:89 bytes ] [89]) (reg/v:DI 6 bp [orig:89 bytes ] [89])) rh1151226.i:17 85 {*movdi_internal} (expr_list:REG_DEAD (reg/v:DI 6 bp [orig:89 bytes ] [89]) Seems the reason why var-tracking is pretty much disabled is that vt_stack_adjustments fails.
Fix posted for review: https://gcc.gnu.org/ml/gcc-patches/2014-10/msg02340.html
This has been in gcc-4.9-RH for quite a while, now backported to 4.8-RH too: http://gcc.gnu.org/r219299 .
This message is a reminder that Fedora 20 is nearing its end of life. Approximately 4 (four) weeks from now Fedora will stop maintaining and issuing updates for Fedora 20. It is Fedora's policy to close all bug reports from releases that are no longer maintained. At that time this bug will be closed as EOL if it remains open with a Fedora 'version' of '20'. Package Maintainer: If you wish for this bug to remain open because you plan to fix it in a currently maintained version, simply change the 'version' to a later Fedora version. Thank you for reporting this issue and we are sorry that we were not able to fix it before Fedora 20 is end of life. If you would still like to see this bug fixed and are able to reproduce it against a later version of Fedora, you are encouraged change the 'version' to a later Fedora version prior this bug is closed as described in the policy above. Although we aim to fix as many bugs as possible during every release's lifetime, sometimes those efforts are overtaken by events. Often a more recent Fedora release includes newer upstream software that fixes bugs or makes them obsolete.
It still says only reg6 in glibc-debuginfo-2.18-19.fc20.x86_64. There has not been any new F20 gcc since September, but that 4.8-RH backport was in January. However, it looks fine in Fedora 21 and beyond, so this can close with F20 EOL.
Fedora 20 changed to end-of-life (EOL) status on 2015-06-23. Fedora 20 is no longer maintained, which means that it will not receive any further security or bug fix updates. As a result we are closing this bug. If you can reproduce this bug against a currently maintained version of Fedora please feel free to reopen this bug against that version. If you are unable to reopen this bug, please file a new report against the current release. If you experience problems, please add a comment to this bug. Thank you for reporting this bug and we are sorry it could not be fixed.