summaryrefslogtreecommitdiff
path: root/glibc/debugging/ld_so_console.mdwn
blob: 4ebea00517736e333c8b37587e8bfc2cfd3c9b8d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
[[!meta copyright="Copyright © 2011, 2013 Free Software Foundation, Inc."]]

[[!meta license="""[[!toggle id="license" text="GFDL 1.2+"]][[!toggleable
id="license" text="Permission is granted to copy, distribute and/or modify this
document under the terms of the GNU Free Documentation License, Version 1.2 or
any later version published by the Free Software Foundation; with no Invariant
Sections, no Front-Cover Texts, and no Back-Cover Texts.  A copy of the license
is included in the section entitled [[GNU Free Documentation
License|/fdl]]."]]"""]]

If you need to debug something in the early `ld.so` startup, and can't refrain
from good old `printf` debugging, there is a caveat: the available API in
`ld.so` is rather limited.  See the few functions is `dl-sysdep.c`.  For
example, there's a private `__libc_write`, which you should be able to use for
writing to FD stderr -- but, at early `ld.so` startup, this isn't usable as
`_hurd_init_dtable` is still all zeros, etc.  To get you started, here is a
simple [[dl-sysdep.c.patch]] to get access to the Mach console.
[[!message-id desc="Original submission" "87y5vrpnvi.fsf@gnu.org"]].

Can this be integrated with the other debugging printf functions from
`elf/dl-misc.c` (`_dl_debug_vdprintf`) ([[!taglink open_issue_glibc]])?

In 2013-01, the [[microkernel/mach/gnumach/interface/syscall/mach_print]]
[[system_call]] has been added to [[GNU Mach|microkernel/mach/gnumach]].
It is available when the kernel is built with the in-kernel kdb debugger.