Skip to content

Conversation

@isidroas
Copy link

We could also create the rest of the solutions in the same format (as a diff from the original) to avoid repeated code.

Offtopic: Thank you so much for the tutorial. The code is so beautiful that it demonstrates that C is the best language for this type of tasks.

@isidroas
Copy link
Author

isidroas commented Dec 5, 2024

Evidence (thanks to villoc ):
2024-12-05-132725_crop

The program used was:

void *ptr1 = malloc(29);
free(ptr1);
malloc(1);
malloc(5);
int *ptr2 = malloc(3);
free(ptr2);
malloc(4);

And executed this way:

$ patch -p1 < exersise_2_split.patch
patching file malloc.c

$ make
$ setarch x86_64 -R ltrace ./wrapper ./test-0 |& tail +6 | tee ltrace.out
malloc(29)                                       = 0x555555559018
free(0x555555559018)                             = <void>
malloc(1)                                        = 0x555555559018
malloc(5)                                        = 0x55555555904d
malloc(3)                                        = 0x555555559031
free(0x555555559031)                             = <void>
malloc(4)                                        = 0x555555559031
+++ exited (status 0) +++

$ cat ltrace.out | /tmp/villoc/villoc.py --chronological --header=24 --round=1 --minsz=0 - - > /tmp/out.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant