Bug 15677 - Cannot find bounds of current function after executing strrchr in glibc
Summary: Cannot find bounds of current function after executing strrchr in glibc
Status: RESOLVED WORKSFORME
Alias: None
Product: glibc
Classification: Unclassified
Component: libc (show other bugs)
Version: 2.17
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-06-25 06:19 UTC by Vijay Nag
Modified: 2014-06-13 13:31 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:
fweimer: security-


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Vijay Nag 2013-06-25 06:19:48 UTC
I am trying to debug my executable created from gcc-4.7.2(i686-pc-linux-gnu).  gdb throws an error "cannot find bounds of current function error" the moment the program steps into strrchr function and Im not able to debug my executable after that point. Im not sure if the dwarf records are corrupted or if the problem is with glibc.  I did disassemble the code and noticed that epilogue/prologue sequence for the same was replaced with a call to  "86b4900
<__x86.get_pc_thunk.bx>".  I'm also unable to debug the executable after calls to few functions which have hand-written assembly in glibc.

(gdb) r
Failed to read a valid object file image from memory.
Breakpoint 1, main (argc=5, argv=0xbffff784, env=0xbffff79c) at main.c:205
205    int main(int argc, char **argv, char **env) {
(gdb) n
220        FILE *rva = fopen("/proc/sys/kernel/randomize_va_space", "r+");
(gdb) n
221        if (rva) {
(gdb)
222          int val=0;
(gdb)
224          if (1==fscanf(rva, "%d", &val)) {
(gdb)………………………………….
225        if (val) {
(gdb)
237          fclose(rva);
(gdb)
242          } else if (val) {
(gdb)
273      main_config.argv0short = strrchr(argv[0], '/');
(gdb)
0x08048430 in ?? ()
(gdb)
Cannot find bounds of current function
(gdb)
Cannot find bounds of current function
(gdb)

However if I step-into strrchr function I can continue with debugging.
 I'm not sure if the problem is with gdb or If I'm missing some
compilation
flags while compiling glibc.

Below is the dwarfdump output of strrchr and let me know if it is
missing some important info.

arange starts at 0x1478ac40, length of 0x00000045, cu_die_offset = 0x1a6047c2
187417594 arange end
187417595 COMPILE_UNIT<header overall offset = 0x1a604872>:
187417596 < 0><0x0000000b>  DW_TAG_compile_unit
187417597                     DW_AT_stmt_list             0x01e23163
187417598                     DW_AT_ranges                0x004d5d88
187417599     ranges: 4 at .debug_ranges offset 5070216 (0x004d5d88) (32 bytes)
187417600       [ 0] addr selection 0xffffffff 0x00000000
187417601       [ 1] range entry    0x1478ac90 0x1478ae99
187417602       [ 2] range entry    0x086b4900 0x086b4904
187417603       [ 3] range end      0x00000000 0x00000000
187417604                     DW_AT_name
../sysdeps/i386/i686/multiarch/strrchr.S
187417605                     DW_AT_comp_dir
~/libs/glibc/srcdir/string
187417606                     DW_AT_producer              GNU AS 2.23.1
187417607                     DW_AT_language              DW_LANG_Mips_Assembler
Comment 1 Ondrej Bilka 2013-06-25 08:31:21 UTC
First question do you have glibc-dbg or equivalent package? If not it is just because there are no debugging symbols available.

Second cause could be that you stepped into ifunc which confused gdb. Then it is better to report in gdb.
Comment 2 Ondrej Bilka 2013-08-20 09:48:32 UTC
As there was no reply in this bug I assume that this is a gdb problem.