discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: segmentation failure plmerge / building libs back


From: Riccardo Mottola
Subject: Re: segmentation failure plmerge / building libs back
Date: Sun, 19 Aug 2018 12:56:20 +0200
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Firefox/52.0 SeaMonkey/2.49.3

Hi Richard,

sorry for the late answer, I was away without access to that specific computer.

Richard Frith-Macdonald wrote:
I wouldn't say that.
You can see that this is building a string from +initialize in NSBundle.m at 
line 1180
You can then look at the source and check that the format string looks correct 
and the number of argument passed is correct.
You can also look at where those two arguments come from, and see that they are 
(most likely) to be literal/constant strings produced by the compiler.

If this is using David's new ABI ... the problem might well be a bug in the new 
code or (more likely) a mismatch between the layout the compiler is producing 
and the library is expecting.

Well, it is libobjc2 "head" of git and I configured to use "ng" runtime, so it should be David's ABI.


Anyway, it tells you that you can run the program under gdb, set a breakpoint 
in +[NSBundle initialize] and look at exactly what's being passed to narrow 
things down more.

As you suggested, I put a breakpoint in [NSBundle initialize]

I was able to step until 1180 and print put the variables and as you supposed they are string constants looking fine.

1180            gnustep_target_dir = [[NSString alloc] initWithFormat: @"%@-%@",
(gdb) p gnustep_target_cpu
$1 = (struct NSString *) 0xb7f59920 <.objc_str>
(gdb) p gnustep_target_os
$2 = (struct NSString *) 0xb7f5992c <.objc_str>
(gdb) po gnustep_target_cpu
ix86
(gdb) po gnustep_target_os
linux-gnu

however, as could be guessed, the next step fails
(gdb) n

Program received signal SIGSEGV, Segmentation fault.
0xb7b76294 in GSPrivateFormat (s=0xbfffdc34, format=0xbfffe45c,
    ap=0xbfffecc0 " \231\365\267,\231\365\267\204\237\365\267\210\221\365\314/\350\273\267\320\003\016\bP\032\275\267$\217\365\267\060\217\365\267\204\237\365\267P\220\365\267D\220\365\267\004r\"\b\016\b\324\267\030\217\365\267\360\217\365\267\344\217\365\267\330\217\365\267\314\217\365\267\300\217\365\267\264\217\365\267\f\217\365\267\250\217\365\267\234\217\365\267\220\217\365\267\204\217\365\267x\217\365\267`\217\365\267l\217\365\267T\217\365\267<\217\365\267\354\220\365\267\340\220\365\267\324\220\365\267\310\220\365\267\274\220\365\267\260\220\365\267\244\220\365\267\230\220\365\267\214\220\365\267 \220\365\267\200\220\365\267\024\220\365\267t\220\365\267h\220\365\267\070\220\365\267,\220\365\267\374\217\365\267\\\220\365\267\314\235\365\267"..., locale=0x0) at GSFormat.m:1046
1046        for (; (size_t) nspecs_done < nspecs; ++nspecs_done)

I tried to setp into the string allocation and see where it fails and it appears here:

(gdb) s
Single stepping until exit from function objc_msgSend,
which has no line number information.
+[NSObject alloc] (self=0xb7bbe82f <+[NSBundle initialize]+15>, _cmd=0x80e03d0)
    at NSObject.m:1120
1120    + (id) alloc

(gdb) n
1122      return [self allocWithZone: NSDefaultMallocZone()];
(gdb) n

Program received signal SIGSEGV, Segmentation fault.

#0  0xb7b76294 in GSPrivateFormat (s=0xbfffdc34, format=0xbfffe45c,
    ap=0xbfffecc0 " \231\365\267,\231\365\267\204\237\365\267\210\221\365\267/\350\273\267\320\003\016\bP\032\275\267$\217\365\267\060\217\365\267\204\237\365\267P\220\365\267D\220\365\267\004r\"\b\016\b\324\267\030\217\365\267\360\217\365\267\344\217\365\267\330\217\365\267\314\217\365\267\300\217\365\267\264\217\365\267\f\217\365\267\250\217\365\267\234\217\365\267\220\217\365\267\204\217\365\267x\217\365\267`\217\365\267l\217\365\267T\217\365\267<\217\365\267\354\220\365\267\340\220\365\267\324\220\365\267\310\220\365\267\274\220\365\267\260\220\365\267\244\220\365\267\230\220\365\267\214\220\365\267 \220\365\267\200\220\365\267\024\220\365\267t\220\365\267h\220\365\267\070\220\365\267,\220\365\267\374\217\365\267\\\220\365\267\314\235\365\267"..., locale=0x0) at GSFormat.m:1046
#1  0xb7b8c54e in -[GSPlaceholderString initWithFormat:locale:arguments:] (
    self=0x8171ab4, _cmd=0xb7f904e4 <.objc_selector_list+432>,
    format=0xb7f59194 <.objc_str.170>, locale=0x0,
    argList=0xbfffecc0 " \231\365\267,\231\365\267\204\237\365\267\210\221\365\267/\350\273\267\320\003\016\bP\032\275\267$\217\365\267\060\217\365\267\204\237\365\267P\220\365\267D\220\365\267\004r\"\b\016\b\324\267\030\217\365\267\360\217\365\267\344\217\365\267\330\217\365\267\314\217\365\267\300\217\365\267\264\217\365\267\f\217\365\267\250\217\365\267\234\217\365\267\220\217\365\267\204\217\365\267x\217\365\267`\217\365\267l\217\365\267T\217\365\267<\217\365\267\354\220\365\267\340\220\365\267\324\220\365\267\310\220\365\267\274\220\365\267\260\220\365\267\244\220\365\267\230\220\365\267\214\220\365\267 \220\365\267\200\220\365\267\024\220\365\267t\220\365\267h\220\365\267\070\220\365\267,\220\365\267\374\
#2  0xb7ca9552 in -[NSString initWithFormat:] (self=<optimized out>,
    _cmd=<optimized out>, format=<optimized out>) at NSString.m:1366
#3  0xb7bbf0ac in +[NSBundle initialize] (self=<optimized out>,
    _cmd=<optimized out>) at NSBundle.m:1180
#4  0xb79da15c in objc_send_initialize ()
   from /System/Library/Libraries/libobjc.so.4.6
#5  0xb79e64d8 in slowMsgLookup ()
   from /System/Library/Libraries/libobjc.so.4.6
#6  0xb79ec5e1 in objc_msgSend () from /System/Library/Libraries/libobjc.so.4.6
#7  0xb7b665e0 in GSLanguageFromLocale (locale=<optimized out>)
    at GSLocale.m:264
#8  0xb7cdc51f in +[NSUserDefaults standardUserDefaults] (
    self=<optimized out>, _cmd=<optimized out>) at NSUserDefaults.m:995
#9  0xb7c08915 in -[NSDictionary writeToFile:atomically:] (
    self=<optimized out>, _cmd=<optimized out>, path=<optimized out>,
    useAuxiliaryFile=<optimized out>) at NSDictionary.m:1096
#10 0x080496e4 in main (argc=<optimized out>, argv=<optimized out>,
    env=<optimized out>) at plmerge.m:135

we are at
588      GSPrivateFormat(f, fmt, argList, locale);

I printed out f and fmt locale is 0x0

(gdb) p *f
$4 = {<> = {<> = {<> = {
        isa = 0x8098f00}, <No data fields>}, <No data fields>}, _contents = {
    u = 0x8098f00, c = 0x8098f00 "P\222\t\b`\267\017\b\255\225\324\267"},
  _count = 134844160, _flags = {wide = 0, owned = 0, unused = 0,
    hash = 8427760}, _capacity = 134844160, _zone = 0x8098f00}

(gdb) p *fmt
$6 = 37



Can we assume that NSObject's alloc (line 1122) passed successfully? Do you get any smarter? I don't...


Riccardo



reply via email to

[Prev in Thread] Current Thread [Next in Thread]