-
Notifications
You must be signed in to change notification settings - Fork 840
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Seg Fault #76
Comments
Changed int main(int argc, char **argv) {
if (argc != 2) {
fprintf(stderr,"Usage: kilo <filename>\n");
exit(1);
}
fprintf(stderr, "1.Got Arguments, checked them.\n2.Initing... ");
initEditor();
fprintf(stderr, "Inited\n3.Sending filename to select syntax highlighting... ");
editorSelectSyntaxHighlight(argv[1]);
fprintf(stderr, "Sent\n4.Opening editor with filename ... ");
editorOpen(argv[1]);
fprintf(stderr, "Opened\n5.Enabling raw mode on stdin... ");
enableRawMode(STDIN_FILENO);
fprintf(stderr, "Enabled\n6.Setting status message... ");
editorSetStatusMessage(
"HELP: Ctrl-S = save | Ctrl-Q = quit | Ctrl-F = find");
fprintf(stderr, "Set\n7. Begining loop of editor... ");
while(1) {
editorRefreshScreen();
editorProcessKeypress(STDIN_FILENO);
}
return 0;
} Printf debugging :) Ran Ran
Error lies somewhere in EDIT 1 : There is a Things were working till there, but not after. So I ran a loop counter It crashes at 90th iteration , when clip.c has the line : More printing shows that in the 90th iteration , the while loop starts , but crashes in Edit 2: At the 90th line , the values being sent to
Edit 3: Edit 4: Edit 5:
EDIT 6: Found it !Looking in detail, in particular investigating the /* Handle // comments. */
if (prev_sep && *p == scs[0] && *(p+1) == scs[1]) {...} The |
@antirez and any other maintainers here, please note : SummaryWhen opening clip.c in kilo, it segfaults at the 90th line. The origin of this failure is in the order : In main() , at The 90th line : if(fclose(to)) // Close this clipboard Structure of line : Please see what's up with |
Ahh, yes I see the problem! You're on a Crapple platform. Crapple only supports what they think their users want. Consider Windows or Linux in the near future. |
Edit: also causes problems on linux. |
When trying to do
./kilo clip.c
, I getzsh: segmentation fault kilo clip.c
. View clip.c.macOS 11.2.2, on x86_64 Intel CPU, compiled with clang and gcc (tried both, tried all optimisation levels), using default terminal and zsh.
Will try on linux and update.
EDIT 1 :
Possibly due to one/some of the errors posted in #77 .
Most likely:
or some other UB / EB ?
EDIT 2:
It does not instantly seg fault. It takes quite a few seconds. And it seems to use the CPU highly during this.
it is read and writing Gigabytes of data during this ! WTF
The text was updated successfully, but these errors were encountered: