Answered step by step
Verified Expert Solution
Question
1 Approved Answer
When I was debugging my .c file using lldb on terminal for Mac, I some how cannot find the location of the segmentation fault. I
When I was debugging my .c file using lldb on terminal for Mac, I some how cannot find the location of the segmentation fault. I have debugged the code numerous of times and it is still producing the same error. I tried using Valgrind but Mac doesn't support Valgrind. Can someone help me on why I can find the location of segmentation fault.
(11db) target create "average", Current executable set to 'average' (x86_64). [(lldb) run Process 19134 launched: '/Users/amanpatel/Desktop/College/Sophomore Year/CSE31/Lab_2/average' (x86_64) Enter input values (enter 0 to finish): Process 19134 stopped * thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x2) frame #0: Ox00007fff6548efda libsystem_c.dylib_svfscanf 1 + 273 libsystem_c.dylib' _svfscanf 1: -> 0x7fff6548efda : mov1 %eax, (%rcx) 0x7fff6548efdc : jmp 0x7fff65490696 ; Ox7fff6548efe1 : mova (%r11), %rcx 0x7fff6548efe4 : leaq 0x8(%rcx), %rdx Target 0: (average) stopped. [(lldb) continue Process 19134 resuming Process 19134 stopped * thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x2) frame #0: 0x00007fff6548efda libsystem_c.dylib__svfscanf_1 + 273 libsystemc.dylibsvfscanf 1: -> Ox7fff6548efda : movl %eax, (%rcx) @x7fff6548efdc : jmp Ox7fff65490696 ; 0x7fff6548efe1 : movg (%r11), %rcx @x7fff6548efe4 : leag 0x8(%rcx), %rdx Target 0: (average) stopped. (lldb) (11db) target create "average", Current executable set to 'average' (x86_64). [(lldb) run Process 19134 launched: '/Users/amanpatel/Desktop/College/Sophomore Year/CSE31/Lab_2/average' (x86_64) Enter input values (enter 0 to finish): Process 19134 stopped * thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x2) frame #0: Ox00007fff6548efda libsystem_c.dylib_svfscanf 1 + 273 libsystem_c.dylib' _svfscanf 1: -> 0x7fff6548efda : mov1 %eax, (%rcx) 0x7fff6548efdc : jmp 0x7fff65490696 ; Ox7fff6548efe1 : mova (%r11), %rcx 0x7fff6548efe4 : leaq 0x8(%rcx), %rdx Target 0: (average) stopped. [(lldb) continue Process 19134 resuming Process 19134 stopped * thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x2) frame #0: 0x00007fff6548efda libsystem_c.dylib__svfscanf_1 + 273 libsystemc.dylibsvfscanf 1: -> Ox7fff6548efda : movl %eax, (%rcx) @x7fff6548efdc : jmp Ox7fff65490696 ; 0x7fff6548efe1 : movg (%r11), %rcx @x7fff6548efe4 : leag 0x8(%rcx), %rdx Target 0: (average) stopped. (lldb)Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started