11/* macho.c -- Get debug data from an Mach-O file for backtraces.
22 Copyright (C) 2012-2016 Free Software Foundation, Inc.
33 Written by John Colanduoni.
4-
4+
55 Pending upstream pull request:
66 https://github.com/ianlancetaylor/libbacktrace/pull/2
77
@@ -288,7 +288,7 @@ macho_get_commands (struct backtrace_state *state, int descriptor,
288288
289289 archs_total_size = arch_count * sizeof (struct fat_arch );
290290
291- if (!backtrace_get_view (state , descriptor , sizeof (fat_header ),
291+ if (!backtrace_get_view (state , descriptor , sizeof (struct fat_header ),
292292 archs_total_size , error_callback ,
293293 data , & fat_archs_view ))
294294 goto end ;
@@ -1361,7 +1361,7 @@ backtrace_initialize (struct backtrace_state *state, int descriptor,
13611361 current_vmslide = _dyld_get_image_vmaddr_slide (i );
13621362 current_name = _dyld_get_image_name (i );
13631363
1364- if (current_name == NULL )
1364+ if (current_name == NULL || ( i != 0 && current_vmslide == 0 ) )
13651365 continue ;
13661366
13671367 if (!(current_descriptor =
@@ -1370,16 +1370,15 @@ backtrace_initialize (struct backtrace_state *state, int descriptor,
13701370 continue ;
13711371 }
13721372
1373- if (! macho_add (state , error_callback , data , current_descriptor ,
1373+ if (macho_add (state , error_callback , data , current_descriptor ,
13741374 current_name , & macho_fileline_fn , current_vmslide ,
13751375 & current_found_sym , & current_found_dwarf ))
13761376 {
1377- return 0 ;
1377+ found_sym = found_sym || current_found_sym ;
1378+ found_dwarf = found_dwarf || current_found_dwarf ;
13781379 }
13791380
13801381 backtrace_close (current_descriptor , error_callback , data );
1381- found_sym = found_sym || current_found_sym ;
1382- found_dwarf = found_dwarf || current_found_dwarf ;
13831382 }
13841383
13851384 if (!state -> threaded )
0 commit comments