diff options
Diffstat (limited to 'glibc')
-rw-r--r-- | glibc/debugging.mdwn | 11 | ||||
-rw-r--r-- | glibc/debugging/ld_so_console.mdwn | 20 | ||||
-rw-r--r-- | glibc/debugging/ld_so_console/dl-sysdep.c.patch | 63 | ||||
-rw-r--r-- | glibc/discussion.mdwn | 2 | ||||
-rw-r--r-- | glibc/fork.mdwn | 5 |
5 files changed, 99 insertions, 2 deletions
diff --git a/glibc/debugging.mdwn b/glibc/debugging.mdwn new file mode 100644 index 00000000..6b035c12 --- /dev/null +++ b/glibc/debugging.mdwn @@ -0,0 +1,11 @@ +[[!meta copyright="Copyright © 2011 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]]."]]"""]] + + * [[ld_so_console]] diff --git a/glibc/debugging/ld_so_console.mdwn b/glibc/debugging/ld_so_console.mdwn new file mode 100644 index 00000000..b3d1762f --- /dev/null +++ b/glibc/debugging/ld_so_console.mdwn @@ -0,0 +1,20 @@ +[[!meta copyright="Copyright © 2011 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. + +Can this be integrated with the other debugging printf functions from +`elf/dl-misc.c` (`_dl_debug_vdprintf`) ([[!taglink open_issue_glibc]])? diff --git a/glibc/debugging/ld_so_console/dl-sysdep.c.patch b/glibc/debugging/ld_so_console/dl-sysdep.c.patch new file mode 100644 index 00000000..eec8d7c6 --- /dev/null +++ b/glibc/debugging/ld_so_console/dl-sysdep.c.patch @@ -0,0 +1,63 @@ +diff --git a/sysdeps/mach/hurd/dl-sysdep.c b/sysdeps/mach/hurd/dl-sysdep.c +index ff37add..7e6d352 100644 +--- a/sysdeps/mach/hurd/dl-sysdep.c ++++ b/sysdeps/mach/hurd/dl-sysdep.c +@@ -44,6 +44,8 @@ + #include <dl-machine.h> + #include <dl-procinfo.h> + ++#include <device/device.h> ++ + extern void __mach_init (void); + + extern int _dl_argc; +@@ -116,6 +118,29 @@ static void fmh(void) { + /* XXX loser kludge for vm_map kernel bug */ + #endif + ++/* Return a port to the Mach console. */ ++static mach_port_t ++get_console (void) ++{ ++ mach_port_t device_master, console; ++ /* We cannot use __get_privileged_ports (from hurd/privports.c), as this ++ drags in too much other libc stuff. */ ++#if 0 ++ error_t err = __get_privileged_ports (0, &device_master); ++ ++ if (err) ++ return MACH_PORT_NULL; ++#else ++ error_t err = 0; ++ device_master = 2; ++#endif ++ ++ err = __device_open (device_master, D_WRITE | D_READ, "console", &console); ++ if (err) ++ return MACH_PORT_NULL; ++ ++ return console; ++} + + ElfW(Addr) + _dl_sysdep_start (void **start_argptr, +@@ -256,6 +279,20 @@ unfmh(); /* XXX */ + /* Set up so we can do RPCs. */ + __mach_init (); + ++ /* Open the Mach console so that any message can actually be seen. This is ++ particularly useful at boot time, when started by the bootstrap file ++ system. */ ++ mach_port_t console = get_console (); ++ if (console != MACH_PORT_NULL) ++ { ++ /* stdout = mach_open_devstream (console, "w"); */ ++ /* stderr = stdout; */ ++ /* if (stdout != NULL) */ ++ /* printf ("Hello, world!\n"); */ ++ int written; ++ __device_write_inband (console, 0, 0, "hello, world!\n", 14, &written); ++ } ++ + /* Initialize frequently used global variable. */ + GLRO(dl_pagesize) = __getpagesize ();
\ No newline at end of file diff --git a/glibc/discussion.mdwn b/glibc/discussion.mdwn index 17b4fb32..fac300ea 100644 --- a/glibc/discussion.mdwn +++ b/glibc/discussion.mdwn @@ -14,7 +14,7 @@ License|/fdl]]."]]"""]] ## IRC, freenode, #hurd, 2011-06-11 -[[!tag open_issue_documentation]] +[[!tag open_issue_documentation open_issue_glibc]] <civodul> youpi: local-tls-support.diff removes libc-tsd.h; what's the rationale? diff --git a/glibc/fork.mdwn b/glibc/fork.mdwn index 496dc743..9417106d 100644 --- a/glibc/fork.mdwn +++ b/glibc/fork.mdwn @@ -1,4 +1,4 @@ -[[!meta copyright="Copyright © 2010 Free Software Foundation, Inc."]] +[[!meta copyright="Copyright © 2010, 2011 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 @@ -50,6 +50,9 @@ they have patches for software packages, to avoid using `fork` followed by __mach_port_allocate_name ([...]); if (err == KERN_NAME_EXISTS)` code ([[!taglink open_issue_glibc]]). + * Can we/why can't we use the concept of *inherited ports + array*s/`mach_ports_register` ([[!taglink open_issue_glibc]])? + ## Related |