[arch-general] SIGSEGV in getopt, libc-problem?

clemens fischer ino-news at spotteswoode.dnsalias.org
Mon Jul 13 13:15:39 EDT 2009


On Tue-2009/07/07-22:17 clemens fischer wrote:

>  (gdb) bt
>  incomplete CFI data; unspecified registers (e.g., eax) at 0xb7fa838a...#0  0xb7fa84dc in _getopt_internal_r ()
>     from /lib/libc.so.6
>  #1  0xb7fa946e in _getopt_internal () from /lib/libc.so.6
>  #2  0xb7fa96b9 in getopt_long () from /lib/libc.so.6
>  #3  0x0804980d in parse_real ()
>  #4  0x08049a07 in args_parse ()
>  #5  0x0804b18e in main ()

A much simpler way to get at the same info is by using extra/ltrace:

$ ltrace -Sif -A9 -n4 /usr/bin/xz
...
[0x804a020]     sysconf(76, 0, 3, 0, 0)                              = -1
[0x8049c63]     strrchr("/usr/bin/xz", '/')                          = "/xz"
[0x8049c7b]     strstr("xz", "lz")                                   = NULL
[0x8049c96]     strstr("xz", "cat")                                  = NULL
[0x8049e94]     strstr("xz", "un")                                   = NULL
[0x8049cbb]     getenv("XZ_OPT")                                     = "-9"
[0x804e097]     strlen("-9")                                         = 2
[0x804e058]     realloc(NULL, 3)                                     = 0x09f92868
[0x804e0ba]     memcpy(0x09f92868, "-9", 3)                          = 0x09f92868
[0x8049ce4]     __ctype_b_loc()                                      = 0xb7d5a68c
[0x804e058]     realloc(NULL, 12)                                    = 0x09f92878
[0x8049d6e]     __ctype_b_loc()                                      = 0xb7d5a68c
[0x80495b4]     getopt_long(2, 0x09f92878, "cC:defF:hHlkM:qrS:tT:vVz01234567"..., 0x0804e520, NULL) = 57
[0x80495b4]     getopt_long(2, 0x09f92878, "cC:defF:hHlkM:qrS:tT:vVz01234567"..., 0x0804e520, NULL) = -1
[0x8049de4]     free(0x09f92878)                                     = <void>
[0x8049def]     free(0x09f92868)                                     = <void>
[0x80495b4]     getopt_long(1, 0xbfdb4004, "cC:defF:hHlkM:qrS:tT:vVz01234567"..., 0x0804e520, NULL <unfinished ...>
[0xb7e0e3cc] --- SIGSEGV (Segmentation fault) ---
[0xffffffff] +++ killed by SIGSEGV +++

I left out a lot of cruft, but it shows where the program busts.


clemens



More information about the arch-general mailing list