comeon010 / ios-toolchain-based-on-clang-for-linux

Automatically exported from code.google.com/p/ios-toolchain-based-on-clang-for-linux
0 stars 0 forks source link

gdb Inconsistent DBX_SYMBOL_SIZE #3

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Now I have remote gdb to device working. Have to copy some system file from 
OSX10 to Linux because I can't find them in ios 6.0.1

the system files are /System/Library/Frameworks/Foundation.framework/Foundation 
/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation ( these are 
links to /Versions/C) 

=========Here it goes. 
(gdb) target remote-macosx iphone:4321
Remote debugging using iphone:4321
[New thread 5635]
[Switching to process 5635 thread 0x1603]
0x2feb7028 in ?? ()
Reading symbols for shared libraries warning: Inconsistent DBX_SYMBOL_SIZE 
(nlist record size was 16, is now 12 with /usr/lib)

. done
Reading symbols for shared libraries . done
(gdb) list
1       #import <Foundation/Foundation.h>
2
3       int main(int argc, char **argv)
4       {
5         @autoreleasepool {
6           NSLog(@"Hello World");
7         }
8       }
(gdb) c
Continuing.
warning: Invalid remote reply: vCont;c;C;s;S
2012-12-18 00:38:14.908 hello-c[44946:303] Hello World

Program exited normally.
(gdb) 

Original issue reported on code.google.com by titan....@gmail.com on 18 Dec 2012 at 8:49

GoogleCodeExporter commented 8 years ago
Unfortunately, My environment is iOS 5.x, I can not verify the debugserver and 
remote debug for iOS 6.x.

I checked debugserver provided by xcode 4.5 for iOS 6.x, it seems contains some 
information of lldb? I am not sure about that.

"warning: Invalid remote reply: vCont;c;C;s;S".

this message mean the remote debug protocol is not fit the 
arm-apple-darwin11-gdb very well. (debugserver for 5.x works well)

Just a guess, I am not sure about that.

And I noticed that "Reading symbols for shared libraries warning: Inconsistent 
DBX_SYMBOL_SIZE (nlist record size was 16, is now 12 with /usr/lib)"

Did you "set shlib-path-substitutions / /<sdk absolute path>/" in gdb?

It tell gdb use <sdk> as sys root and library loading path.

refer to:
http://code.google.com/p/ios-toolchain-based-on-clang-for-linux/wiki/Howto_debug
_en

Original comment by cjac...@gmail.com on 18 Dec 2012 at 6:38

GoogleCodeExporter commented 8 years ago
I patched "macosx-nat-dyld-info.c" to match clangwrapper SDK setting. Now we 
can start darwin-gdb without init.  
Too many gdbs, too lazy to track them.  Full file is attached.

===========================
char * get_sdkpath()
{
    char tmpname[PATH_MAX],line[PATH_MAX],*p;
    FILE* fd;

    sprintf(tmpname,"%s/.iphonesdk",getenv("HOME"));
    if(!file_exists_p(tmpname))
        return NULL;
    fd= fopen(tmpname,"r");
    fgets(line,PATH_MAX,fd);
    line[strlen(line)-1] =0;   /* remove \n*/
    fclose(fd);

    p = strstr(line,"SDK_FULL_PATH=");
    if(p==NULL)
        return p;
    return &line[strlen("SDK_FULL_PATH=")];

}

/* Return the appropriate filename for the given dyld_objfile_entry.

   If TYPE is DYLD_ENTRY_FILENAME_BASE, give the base filename as
   given by dyld.
   If TYPE is DYLD_ENTRY_FILENAME_USER, return the user-specified filename,
   if there is one; else use the name given by dyld.
   If TYPE is DYLD_ENTRY_FILENAME_LOADED, return the symbol file actually
   loaded for that entry.

   All filenames are processed according to the path information
   contained in D; if the function is unable to resolve a pathname
   according to D, it will return NULL. */

const char *
dyld_entry_filename (const struct dyld_objfile_entry *e,
                     const struct dyld_path_info *d, 
                     enum dyld_entry_filename_type type)
{
  CHECK_FATAL (e != NULL);
  CHECK_FATAL (e->allocated);
  char tmpname[PATH_MAX];

  const char *name = NULL;
  char *resolved = NULL;
  int name_is_absolute = 0;

  if (e->text_name != NULL)
    {
      name = e->text_name;
      name_is_absolute = 0;
    }

  if (e->image_name != NULL)
    {
      name = e->image_name;
      name_is_absolute = 0;
    }

  if (e->dyld_name != NULL)
    {
      name = e->dyld_name;
      name_is_absolute = 1;
    }

  if ((name == NULL || type == DYLD_ENTRY_FILENAME_USER
       || type == DYLD_ENTRY_FILENAME_LOADED)
      && e->user_name != NULL)
    {
      name = e->user_name;
      name_is_absolute = 1;
    }

  if ((name == NULL || type == DYLD_ENTRY_FILENAME_LOADED)
      && e->loaded_name != NULL)
    {
      name = e->loaded_name;
      name_is_absolute = 1;
    }

  if (name == NULL)
    return NULL;
/* force sdk path here*/
  if(strncmp(name,"/System",7)==0 || strncmp(name,"/usr",4)==0)
  {
      sprintf(tmpname,"%s%s",get_sdkpath(),name);
      name = tmpname;

  }

Original comment by titan....@gmail.com on 19 Dec 2012 at 2:13

Attachments: