Rephrase comments to make clear distinction between service runtime and nacl dynamic loader

And, minor renaming.
diff --git a/gdb/nacl-tdep.c b/gdb/nacl-tdep.c
index 099c031..97d0983 100644
--- a/gdb/nacl-tdep.c
+++ b/gdb/nacl-tdep.c
@@ -43,10 +43,10 @@
 *******************************************************************************/
 
 
-/* The basic idea of the debugger port is to switch from loader symbols to nacl
-   symbols when needed. For example, we might want to switch to nacl symbols
-   when execution stops in untrusted code. We call this switching gdb states
-   between service runtime state and nacl state.
+/* The basic idea of the debugger port is to switch from service runtime symbols
+   to nacl symbols when needed. For example, we might want to switch to nacl
+   symbols when execution stops in untrusted code. We call this switching gdb
+   states between service runtime state and nacl state.
 
    The only way of switching states in this implementation of gdb is overriding
    a bunch of global variables. This likely leads to gdb inconsistency, as we
@@ -294,7 +294,7 @@
 extern struct so_list *svr4_alloc_so (CORE_ADDR, const char *);
 
 
-struct nacl_ld_so_debugger_interface
+struct nacl_dynamic_loader_debugger_interface
   {
     /* _dl_debug_state - solib event break.  */
     CORE_ADDR _dl_debug_state;
@@ -311,7 +311,7 @@
    We do not read target memory here - it might be not yet initialized!  */
 
 static int
-nacl_discover_ld_so_debugger_interface (struct nacl_ld_so_debugger_interface *i)
+nacl_discover_dynamic_loader_debugger_interface (struct nacl_dynamic_loader_debugger_interface *ni)
 {
   struct minimal_symbol *msymbol;
 
@@ -321,17 +321,17 @@
   msymbol = lookup_minimal_symbol ("_dl_debug_state", NULL, symfile_objfile);
   if (!msymbol || !SYMBOL_VALUE_ADDRESS (msymbol))
     return 0;
-  i->_dl_debug_state = SYMBOL_VALUE_ADDRESS (msymbol);
+  ni->_dl_debug_state = SYMBOL_VALUE_ADDRESS (msymbol);
 
   msymbol = lookup_minimal_symbol ("_r_debug", NULL, symfile_objfile);
   if (!msymbol || !SYMBOL_VALUE_ADDRESS (msymbol))
     return 0;
-  i->_r_debug = SYMBOL_VALUE_ADDRESS (msymbol);
+  ni->_r_debug = SYMBOL_VALUE_ADDRESS (msymbol);
 
   msymbol = lookup_minimal_symbol ("_dl_argv", NULL, symfile_objfile);
   if (!msymbol || !SYMBOL_VALUE_ADDRESS (msymbol))
     return 0;
-  i->_dl_argv = SYMBOL_VALUE_ADDRESS (msymbol);
+  ni->_dl_argv = SYMBOL_VALUE_ADDRESS (msymbol);
 
   return 1;
 }
@@ -340,7 +340,7 @@
 struct so_list *
 nacl_current_sos (void)
 {
-  struct nacl_ld_so_debugger_interface ld_so;
+  struct nacl_dynamic_loader_debugger_interface ni;
 
   nacl_init_sandbox_base ();
   if (!nacl_sandbox_base)
@@ -349,14 +349,14 @@
   if (!nacl_exec_file)
     return NULL;
 
-  if (nacl_discover_ld_so_debugger_interface (&ld_so))
+  if (nacl_discover_dynamic_loader_debugger_interface (&ni))
     {
       CORE_ADDR lm_addr;
       struct so_list *head = 0;
       struct so_list **link_ptr = &head;
 
       /* for (lm_addr = _r_debug.r_map; lm_addr; lm_addr = lm_addr->l_next)  */
-      for (lm_addr = read_memory_unsigned_integer (ld_so._r_debug + 4, 4);
+      for (lm_addr = read_memory_unsigned_integer (ni._r_debug + 4, 4);
            lm_addr;
            lm_addr = read_memory_unsigned_integer (nacl_sandbox_base + lm_addr + 16, 4))
         {
@@ -378,7 +378,7 @@
               /* Native client dynamic executable. */
               xfree (so_name);
 
-              l_name = read_memory_unsigned_integer (ld_so._dl_argv, 4);
+              l_name = read_memory_unsigned_integer (ni._dl_argv, 4);
               l_name = read_memory_unsigned_integer (nacl_sandbox_base + l_name, 4);
               target_read_string (nacl_sandbox_base + l_name, &so_name, SO_NAME_MAX_PATH_SIZE - 1, &err);
 
@@ -409,33 +409,53 @@
 }
 
 
+/* Arrange cooperation with nacl dynamic loader for loading nacl solibs.
+
+   Dynamic loader debugger interface:
+
+   Dynamic loader global structure "_r_debug" contains everything the debugger
+   needs to know. In particular we are interested in 2 fields:
+
+   - "_r_debug.r_map" points to the list of currently loaded solibs;
+
+   - "_r_debug.r_brk" points to the function that is called each time solib is
+     loaded or unloaded. That function is usually called "_dl_debug_state";
+
+   This function might be called when nacl dynamic loader was just loaded by
+   the service runtime but before it started to execute, thus "_r_debug"
+   structure might not be yet initialized.
+
+   Here we set a solib event breakpoint at "_dl_debug_state".  */
+
 int
 nacl_solib_enable_break (void)
 {
-  struct nacl_ld_so_debugger_interface ld_so;
+  struct nacl_dynamic_loader_debugger_interface ni;
 
   gdb_assert (nacl_gdb_state_p ());
   gdb_assert (nacl_sandbox_base);
 
-  if (!nacl_discover_ld_so_debugger_interface (&ld_so))
+  if (!nacl_discover_dynamic_loader_debugger_interface (&ni))
     return 0;
 
-  create_solib_event_breakpoint (ld_so._dl_debug_state);
+  create_solib_event_breakpoint (ni._dl_debug_state);
   return 1;
 }
 
 
-/* Arrange cooperation with trusted loader for loading nacl program.
+/* Arrange cooperation with service runtime for loading nacl program.
 
-   Trusted loader debugger interface:
+   Service runtime debugger interface:
 
-   When nacl program is loaded into memory but before it gets control, loader
-   calls function named "_ovly_debug_event". The name comes from i386 nacl
-   debugger interface, where nacl program loading event was treated as
-   an overlay event. For x86_64, we treat it as a solib event instead.
+   When nacl program is loaded into memory but before it gets control, service
+   runtime calls function named "_ovly_debug_event". The name comes from the
+   debugger interface for i386-nacl, where nacl program loading event was
+   treated as an overlay event. For x86_64-nacl, we treat it as a solib event
+   instead.
 
-   At the moment when "_ovly_debug_event" gets called, loader's global variable
-   "nacl_global_xlate_base" contains the address of the nacl sandbox base.
+   At the moment when "_ovly_debug_event" gets called, service runtime global
+   variable "nacl_global_xlate_base" contains the address of the nacl sandbox
+   base.
 
    Here we set a solib event breakpoint at "_ovly_debug_event".  */
 
@@ -452,7 +472,7 @@
   msymbol = lookup_minimal_symbol ("nacl_global_xlate_base", NULL, symfile_objfile);
   if (!msymbol || !SYMBOL_VALUE_ADDRESS (msymbol))
     {
-      warning (_("failed to find nacl loader debugger interface "
+      warning (_("failed to find service runtime debugger interface "
                  " (nacl_global_xlate_base)"));
       return;
     }
@@ -460,7 +480,7 @@
   msymbol = lookup_minimal_symbol ("_ovly_debug_event", NULL, symfile_objfile);
   if (!msymbol || !SYMBOL_VALUE_ADDRESS (msymbol))
     {
-      warning (_("failed to find nacl loader debugger interface "
+      warning (_("failed to find service runtime debugger interface "
                  " (_ovly_debug_event)"));
       return;
     }
@@ -482,25 +502,24 @@
 
 /* How to use the debugger:
 
-   Primary program being debugged is nacl loader. Specify it as usually:
+   Primary program being debugged is service runtime. Specify it as usually:
 
      file ./sel_ldr
 
-   Set loader command line arguments. For sel_ldr, that should include sel_ldr
-   arguments together with nacl program and nacl program arguments:
+   Set service runtime command line arguments. For sel_ldr, that should include
+   sel_ldr arguments together with nacl program and nacl program arguments:
 
      set args -Q -a -c -f ./runnable-ld.so -- ./a.out
 
    Set nacl program to be debugged. This has to be done explicitly, as we are
-   not always able to deduce nacl program name from the loader command line,
-   for example, chrome picks nacl program name from the html page. For setting
-   nacl program, we have a new command:
+   not always able to deduce nacl program name from the service runtime command
+   line, for example, chrome picks nacl program name from the html page. For
+   setting nacl program, we have a new command:
 
     nacl-file ./runnable-ld.so
 
-   While debugging, we can switch views between trusted (loader aka service
-   runtime) code and untrusted (nacl program) code. Current view is indicated
-   by gdb prompt:
+   While debugging, we can switch views between service runtime (trusted code)
+   and nacl program (untrusted code0. Current view is indicated by gdb prompt:
 
     (sr-gdb) - trusted code view
     (nc-gdb) - untrusted code view
diff --git a/gdb/solib.c b/gdb/solib.c
index 5e5b4cb..053e019 100644
--- a/gdb/solib.c
+++ b/gdb/solib.c
@@ -743,11 +743,11 @@
       /* We didn't loaded nacl executable yet - load it now.  */
       solib_add_1 (pattern, from_tty, target, readsyms);
 
-      /* If we just loaded something, it might be nacl ld.so. Try arranging
-         cooperation with it.  */
+      /* If we just loaded something, probably it was nacl dynamic loader.
+         Try arranging cooperation with it.  */
       if (so_list_head && nacl_solib_enable_break ())
         {
-          /* Yes, it was nacl ld.so. Read solibs it already knows about.  */
+          /* It was nacl dynamic loader - read solibs it knows about.  */
           solib_add_1 (pattern, from_tty, target, readsyms);
         }
     }