[commit] Make solib-frv.c work again

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[commit] Make solib-frv.c work again

Kevin Buettner
At some point in the past year (or so), loading of FR-V shared
libraries became broken.  I have committed the patch below which fixes
this situation.

        * solib-frv.c (lm_base): Bail out if the main executable has
        not been relocated.

Index: solib-frv.c
===================================================================
RCS file: /cvs/src/src/gdb/solib-frv.c,v
retrieving revision 1.15
diff -u -p -r1.15 solib-frv.c
--- solib-frv.c 20 Feb 2007 12:45:06 -0000 1.15
+++ solib-frv.c 27 Apr 2007 22:17:02 -0000
@@ -361,6 +361,14 @@ lm_base (void)
   CORE_ADDR addr;
   gdb_byte buf[FRV_PTR_SIZE];
 
+  /* One of our assumptions is that the main executable has been relocated.
+     Bail out if this has not happened.  (Note that post_create_inferior()
+     in infcmd.c will call solib_add prior to solib_create_inferior_hook().
+     If we allow this to happen, lm_base_cache will be initialized with
+     a bogus value.  */
+  if (main_executable_lm_info == 0)
+    return 0;
+
   /* If we already have a cached value, return it.  */
   if (lm_base_cache)
     return lm_base_cache;