program crashes on SIGSEGV, how debug it?

fedora fedora at ayni.com
Wed Dec 8 14:50:27 UTC 2010


After writing something beginning with
write(3, "CONF: reserving 8256Kb at 0x1000"..., 71) = 71

and then reading /etc/localtime

your program requested more memory:

munmap(0xb6410000, 4096)

and crashed. doesn't this give you a clue?

suomi

On 2010-12-08 13:10, Frantisek Hanzlik wrote:
> fedora wrote:
>> Hi Franta
>> try to run it under strace
>>
>> strace /path/to/your_failing_program
>>
>> of, in case it is a server:
>>
>> strace -p PID-of-your-failing-program
>>
>> strace logs all system calls in the error log.
>>
>> suomi
>>
>>
>>
>> On 2010-12-08 08:52, Frantisek Hanzlik wrote:
>>> I compile program (on F14 i386), but this crashes after start (probably in some
>>> initialization phase) on SEGV. After installing appropriate debuginfo packages,
>>> its backtrace is this:
>>>
>>> Program received signal SIGSEGV, Segmentation fault.
>>> _dl_lookup_symbol_x (undef_name=0x30bde3 "using_xterm", undef_map=0x862e0a0,
>>> ref=0xbffef550, symbol_scope=0x862e258, version=0x0, type_class=1, flags=1,
>>>       skip_map=0x0) at dl-lookup.c:713
>>> 713	{
>>> (gdb) bt
>>> #0  _dl_lookup_symbol_x (undef_name=0x30bde3 "using_xterm", undef_map=0x862e0a0,
>>> ref=0xbffef550, symbol_scope=0x862e258, version=0x0, type_class=1,
>>>       flags=1, skip_map=0x0) at dl-lookup.c:713
>>> #1  0x00110c98 in _dl_fixup (l=<value optimized out>, reloc_arg=<value optimized
>>> out>) at dl-runtime.c:118
>>> #2  0x001174f0 in _dl_runtime_resolve () at ../sysdeps/i386/dl-trampoline.S:37
>>> #3  0x0030e1eb in terminal_initialize () at terminal.c:404
>>> #4  0x080e5297 in iodev_init () at dev_list.c:107
>>> #5  0x0805e335 in main (argc=1, argv=0xbffff764) at emu.c:426
>>>
>>> Know anyone what about it? These points #2 - #0 are beyond all my understanding.
>>> Maybe they are some glibc routines? Or GDB own routines?
>>> Eventually know anyone some links/reference to cram course about this problems?
>>>
>>> For clarification, this program is probably OK - compiled from same sources and
>>> with same options it run on several F13/i386 machines, and, what weird, it run
>>> on two F14/i386 PCs too. But on other two or three PCs crashes as above.
>>>
>>> Referenced line in "terminal.c" is:
>>>
>>>       403
>>>       404    if (using_xterm())
>>>       405      Video_term.change_config = term_change_config;
>>>
>>> and function "using_xterm()" is defined in same source file as:
>>>
>>>       305
>>>       306 int using_xterm(void)
>>>       307 {
>>>       308    char *term = getenv("TERM");
>>>       309
>>>       310    if (term == NULL)
>>>       311       return 0;
>>>       312
>>>       313    return !strncmp("xterm", term, 5) ||
>>>       314            !strncmp("rxvt", term, 4) ||
>>>       315            !strcmp("dtterm", term);
>>>       316 }
>>>       317
>>>
>>>
>>> Many thanks in advance, Franta Hanzlik
>
> Thank for Your reply. When I tried strace, there aren't differences which seems
> significant. Program at PC, where crashes, ends:
>
> write(3, " uid=530 (cached 530) gid=540 (c"..., 43) = 43
> gettimeofday({1291809188, 371615}, NULL) = 0
> write(3, "DBG_FD already set\n", 19)    = 19
> uname({sys="Linux", node="data.saz.home", ...}) = 0
> write(3, "DOSEMU-1.4.0.1 is coming up on L"..., 112) = 112
> write(3, "Compiled with GCC version 4.5", 29) = 29
> write(3, ".1", 2)                       = 2
> write(3, " -m32\n", 6)                  = 6
> vm86(0, 0, 0, 0, 0)                     = 0
> write(3, "CONF: reserving 640Kb at 0x00000"..., 72) = 72
> write(3, "CONF: reserving 48Kb at 0xF4000 "..., 63) = 63
> gettimeofday({1291809188, 372220}, NULL) = 0
> gettimeofday({1291809188, 372258}, NULL) = 0
> write(3, "CONF: reserving 128Kb at 0xA0000"..., 56) = 56
> mmap2(NULL, 4096, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7738000
> mmap2(NULL, 4096, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7737000
> mremap(0xb7738000, 4096, 4096, MREMAP_MAYMOVE|MREMAP_FIXED, 0xb7737000) = 0xb7737000
> munmap(0xb7738000, 4096)                = 0
> munmap(0xb7737000, 4096)                = 0
> stat64("/tmp", {st_mode=S_IFDIR|S_ISVTX|0777, st_size=4096, ...}) = 0
> gettimeofday({1291809188, 372676}, NULL) = 0
> open("/tmp/tmpfMaDKp9", O_RDWR|O_CREAT|O_EXCL, 0600) = 4
> unlink("/tmp/tmpfMaDKp9")               = 0
> fcntl64(4, F_GETFL)                     = 0x2 (flags O_RDWR)
> fstat64(4, {st_mode=S_IFREG|0600, st_size=0, ...}) = 0
> mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) =
> 0xb7738000
> _llseek(4, 0, [0], SEEK_CUR)            = 0
> ftruncate(4, 0)                         = 0
> ftruncate(4, 11599872)                  = 0
> mmap2(NULL, 11599872, PROT_READ|PROT_WRITE, MAP_SHARED, 4, 0) = 0xb6c11000
> mprotect(0xb6c11000, 11599872, PROT_READ|PROT_WRITE|PROT_EXEC) = 0
> mprotect(0xb6c11000, 11599872, PROT_READ|PROT_WRITE) = 0
> mprotect(0xb6c11000, 1114112, PROT_READ|PROT_WRITE) = 0
> mmap2(NULL, 1114112, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_SHARED|MAP_FIXED, 4, 0) = 0
> mprotect(0, 655360, PROT_NONE)          = 0
> setreuid32(530, 530)                    = 0
> setregid32(540, 540)                    = 0
> munmap(0x100000, 65536)                 = 0
> mmap2(0x100000, 65536, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_SHARED|MAP_FIXED, 4,
> 0) = 0x100000
> mmap2(NULL, 8388608, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) =
> 0xb6411000
> write(3, "CONF: reserving 8256Kb at 0x1000"..., 71) = 71
> gettimeofday({1291809188, 377871}, NULL) = 0
> open("/etc/localtime", O_RDONLY)        = 5
> fstat64(5, {st_mode=S_IFREG|0644, st_size=2246, ...}) = 0
> fstat64(5, {st_mode=S_IFREG|0644, st_size=2246, ...}) = 0
> mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) =
> 0xb6410000
> read(5, "TZif2\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\6\0\0\0\6\0\0\0\0"..., 4096)
> = 2246
> _llseek(5, -28, [2218], SEEK_CUR)       = 0
> read(5, "\nCET-1CEST,M3.5.0,M10.5.0/3\n", 4096) = 28
> close(5)                                = 0
> munmap(0xb6410000, 4096)                = 0
> --- SIGSEGV (Segmentation fault) @ 0 (0) ---
> +++ killed by SIGSEGV (core dumped) +++
>
> while program at PC where run OK continues:
> ...
> mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) =
> 0xb62f8000
> read(5, "TZif2\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\6\0\0\0\6\0\0\0\0"..., 4096)
> = 2246
> _llseek(5, -28, [2218], SEEK_CUR)       = 0
> read(5, "\nCET-1CEST,M3.5.0,M10.5.0/3\n", 4096) = 28
> close(5)                                = 0
> munmap(0xb62f8000, 4096)                = 0
> socket(PF_FILE, SOCK_STREAM|SOCK_CLOEXEC, 0) = 5
> connect(5, {sa_family=AF_FILE, path=@"/tmp/.X11-unix/X0"}, 20) = 0
> getpeername(5, {sa_family=AF_FILE, path=@"/tmp/.X11-unix/X0"...}, [20]) = 0
> ....
>
>
> I'm not seeing any important differences.
> What kind of things I should be aware?


More information about the users mailing list