This is the mail archive of the libc-help@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: how to redirect glibc's dump output ? (stack 'backtrace', etc)


On Sat, Jul 19, 2014 at 1:30 AM, Linda A. Walsh <gnu@tlinx.org> wrote:
> Linda A. Walsh wrote:
>>
>> How can I redirect glibc's dump output to a file -- it seems to ignore
>> redirection of stdout and stderr.

The code you are interested in is in sysdeps/posix/libc_fatal.c:

65	/* Abort with an error message.  */
66	void
67	__libc_message (int do_abort, const char *fmt, ...)
68	{
...
78	  /* Open a descriptor for /dev/tty unless the user explicitly
79	     requests errors on standard error.  */
80	  const char *on_2 = __libc_secure_getenv ("LIBC_FATAL_STDERR_");
81	  if (on_2 == NULL || *on_2 == '\0')
82	    fd = open_not_cancel_2 (_PATH_TTY, O_RDWR | O_NOCTTY | O_NDELAY);


So, if you want to have libc messages go to stderr, set the
LIBC_FATAL_STDERR_ environment variable to non-empty.


>>
>> Barring that, how can I disable the output -- i.e. just let it leave the
>> coredump?
>>
>> Thanks
>
> In case This wasn't clear, I mean output like the below.
>
> Maybe good enough would be redirection or elimination of the
> memory map, which seems to be uniquely useless.
>
> Even the stack backtrace echoed to the screen is useless for
> most purposes
> -- no one is willing or able to work from such useless output

Useless to you does not mean useless to others.
In fact it *is* often quite useful to me.

> so why is it dumped to the screen anyway?
>
>
> *** Error in `./xosview': free(): invalid next size (fast):
> 0x0000000001d05270 ***
> ======= Backtrace: =========
> /lib64/libc.so.6[0x300207410f]
> /lib64/libc.so.6[0x300207996e]
> /lib64/libc.so.6[0x300207a647]
> /usr/lib64/libstdc++.so.6(_ZNSsD1Ev+0x1f)[0x303d0be71f]
> ./xosview[0x40beec]
> ./xosview[0x40f0c2]
> ./xosview[0x4361c0]
> ./xosview[0x434ed4]
> ./xosview[0x43643a]
> ./xosview[0x4182c3]
> ./xosview[0x417d57]
> ./xosview[0x415635]
> ./xosview[0x4194c9]
> ./xosview[0x4119c5]
> /lib64/libc.so.6(__libc_start_main+0xf5)[0x3002021be5]
> ./xosview[0x405a49]
> ======= Memory map: ========
> 00400000-00455000 r-xp 00000000 fe:0a 1477607463
> /home/tools/xosview/xosview-1.8.4.2/xosview
> 00455000-00458000 rw-p 00055000 fe:0a 1477607463
> /home/tools/xosview/xosview-1.8.4.2/xosview
> 01ce6000-01d28000 rw-p 00000000 00:00 0
> [heap]
> 3000000000-3000020000 r-xp 00000000 08:21 51558553
> /lib64/ld-2.18.so
> 300021f000-3000220000 r--p 0001f000 08:21 51558553
> /lib64/ld-2.18.so
> 3000220000-3000221000 rw-p 00020000 08:21 51558553
> /lib64/ld-2.18.so
> 3000221000-3000222000 rw-p 00000000 00:00 0
> 3002000000-30021a5000 r-xp 00000000 08:21 51558555
> /lib64/libc-2.18.so
> 30021a5000-30023a5000 ---p 001a5000 08:21 51558555
> /lib64/libc-2.18.so
> 30023a5000-30023a9000 r--p 001a5000 08:21 51558555
> /lib64/libc-2.18.so
> 30023a9000-30023ab000 rw-p 001a9000 08:21 51558555
> /lib64/libc-2.18.so
> 30023ab000-30023af000 rw-p 00000000 00:00 0
> 3002800000-3002803000 r-xp 00000000 08:21 51558588
> /lib64/libdl-2.18.so
> 3002803000-3002a02000 ---p 00003000 08:21 51558588
> /lib64/libdl-2.18.so
> 3002a02000-3002a03000 r--p 00002000 08:21 51558588
> /lib64/libdl-2.18.so
> 3002a03000-3002a04000 rw-p 00003000 08:21 51558588
> /lib64/libdl-2.18.so
> 3002c00000-3002d02000 r-xp 00000000 08:21 51558581
> /lib64/libm-2.18.so
> 3002d02000-3002f01000 ---p 00102000 08:21 51558581
> /lib64/libm-2.18.so
> 3002f01000-3002f02000 r--p 00101000 08:21 51558581
> /lib64/libm-2.18.so
> 3002f02000-3002f03000 rw-p 00102000 08:21 51558581
> /lib64/libm-2.18.so
> 3003400000-3003416000 r-xp 00000000 08:21 51558618
> /lib64/libgcc_s.so.1
> 3003416000-3003615000 ---p 00016000 08:21 51558618
> /lib64/libgcc_s.so.1
> 3003615000-3003616000 r--p 00015000 08:21 51558618
> /lib64/libgcc_s.so.1
> 3003616000-3003617000 rw-p 00016000 08:21 51558618
> /lib64/libgcc_s.so.1
> 3004400000-3004403000 r-xp 00000000 08:26 38247401
> /usr/lib64/libXau.so.6.0.0
> 3004403000-3004602000 ---p 00003000 08:26 38247401
> /usr/lib64/libXau.so.6.0.0
> 3004602000-3004603000 r--p 00002000 08:26 38247401
> /usr/lib64/libXau.so.6.0.0
> 3004603000-3004604000 rw-p 00003000 08:26 38247401
> /usr/lib64/libXau.so.6.0.0
> 3004800000-300481e000 r-xp 00000000 08:26 38340784
> /usr/lib64/libxcb.so.1.1.0
> 300481e000-3004a1d000 ---p 0001e000 08:26 38340784
> /usr/lib64/libxcb.so.1.1.0
> 3004a1d000-3004a1e000 r--p 0001d000 08:26 38340784
> /usr/lib64/libxcb.so.1.1.0
> 3004a1e000-3004a1f000 rw-p 0001e000 08:26 38340784
> /usr/lib64/libxcb.so.1.1.0
> 3004c00000-3004d38000 r-xp 00000000 08:26 39049543
> /usr/lib64/libX11.so.6.3.0
> 3004d38000-3004f38000 ---p 00138000 08:26 39049543
> /usr/lib64/libX11.so.6.3.0
> 3004f38000-3004f39000 r--p 00138000 08:26 39049543
> /usr/lib64/libX11.so.6.3.0
> 3004f39000-3004f3e000 rw-p 00139000 08:26 39049543
> /usr/lib64/libX11.so.6.3.0
> 3006c00000-3006c05000 r-xp 00000000 08:26 39253754
> /usr/lib64/libXfixes.so.3.1.0
> 3006c05000-3006e04000 ---p 00005000 08:26 39253754
> /usr/lib64/libXfixes.so.3.1.0
> 3006e04000-3006e05000 r--p 00004000 08:26 39253754
> /usr/lib64/libXfixes.so.3.1.0
> 3006e05000-3006e06000 rw-p 00005000 08:26 39253754
> /usr/lib64/libXfixes.so.3.1.0
> 3007c00000-3007c09000 r-xp 00000000 08:26 39251734
> /usr/lib64/libXrender.so.1.3.0
> 3007c09000-3007e08000 ---p 00009000 08:26 39251734
> /usr/lib64/libXrender.so.1.3.0
> 3007e08000-3007e09000 r--p 00008000 08:26 39251734
> /usr/lib64/libXrender.so.1.3.0
> 3007e09000-3007e0a000 rw-p 00009000 08:26 39251734
> /usr/lib64/libXrender.so.1.3.0
> 3008c00000-3008c0a000 r-xp 00000000 08:26 39253790
> /usr/lib64/libXcursor.so.1.0.2
> 3008c0a000-3008e09000 ---p 0000a000 08:26 39253790
> /usr/lib64/libXcursor.so.1.0.2
> 3008e09000-3008e0a000 r--p 00009000 08:26 39253790
> /usr/lib64/libXcursor.so.1.0.2
> 3008e0a000-3008e0b000 rw-p 0000a000 08:26 39253790
> /usr/lib64/libXcursor.so.1.0.2
> 3029400000-3029411000 r-xp 00000000 08:26 38531865
> /usr/lib64/libXpm.so.4.11.0
> 3029411000-3029610000 ---p 00011000 08:26 38531865
> /usr/lib64/libXpm.so.4.11.0
> 3029610000-3029611000 r--p 00010000 08:26 38531865
> /usr/lib64/libXpm.so.4.11.0
> 3029611000-3029612000 rw-p 00011000 08:26 38531865
> /usr/lib64/libXpm.so.4.11.0
> 303d000000-303d0ea000 r-xp 00000000 08:26 34114354
> /usr/lib64/libstdc++.so.6.0.18
> 303d0ea000-303d2e9000 ---p 000ea000 08:26 34114354
> /usr/lib64/libstdc++.so.6.0.18
> 303d2e9000-303d2f1000 r--p 000e9000 08:26 34114354
> /usr/lib64/libstdc++.so.6.0.18
> 303d2f1000-303d2f3000 rw-p 000f1000 08:26 34114354
> /usr/lib64/libstdc++.so.6.0.18
> 303d2f3000-303d308000 rw-p 00000000 00:00 0
> 7f64ea784000-7f64ea7c5000 rw-p 00000000 00:00 0
> 7f64ea7c5000-7f64ea7d1000 r-xp 00000000 08:21 50467012
> /lib64/libnss_files-2.18.so
> 7f64ea7d1000-7f64ea9d0000 ---p 0000c000 08:21 50467012
> /lib64/libnss_files-2.18.so
> 7f64ea9d0000-7f64ea9d1000 r--p 0000b000 08:21 50467012
> /lib64/libnss_files-2.18.so
> 7f64ea9d1000-7f64ea9d2000 rw-p 0000c000 08:21 50467012
> /lib64/libnss_files-2.18.so
> 7f64ea9d2000-7f64ea9d9000 rw-p 00000000 00:00 0
> 7f64eaa13000-7f64eaa16000 rw-p 00000000 00:00 0
> 7fff8c28f000-7fff8c2b1000 rw-p 00000000 00:00 0
> [stack]
> 7fff8c3ff000-7fff8c400000 r-xp 00000000 00:00 0
> [vdso]
> ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0
> [vsyscall]
>



-- 
Paul Pluzhnikov


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]