bondscell_results$ee9648f2-bd69-4bf4-b95b-cc3fc2bf5b60queued¤logsrunning¦outputbody
mimetext/htmlrootassigneelast_run_timestampA|Cpersist_js_state·has_pluto_hook_features§cell_id$ee9648f2-bd69-4bf4-b95b-cc3fc2bf5b60depends_on_disabled_cells§runtimetߵpublished_object_keysdepends_on_skipped_cells§errored$10e3b9fb-fe77-4106-a512-74f4d7d0cfbbqueued¤logsrunning¦outputbodymimetext/plainrootassigneelast_run_timestampA|[persist_js_state·has_pluto_hook_features§cell_id$10e3b9fb-fe77-4106-a512-74f4d7d0cfbbdepends_on_disabled_cells§runtime%published_object_keysdepends_on_skipped_cells§errored$7a9a1afc-16a3-11f0-2474-67fc85a76676queued¤logsrunning¦outputbodyVF

LEPL1503/LSINC1503 - Cours 5

O. Bonaventure, B. Legat, M. Baerts

      mimetext/htmlrootassigneelast_run_timestampA|?۰persist_js_state·has_pluto_hook_features§cell_id$7a9a1afc-16a3-11f0-2474-67fc85a76676depends_on_disabled_cells§runtime_Xpublished_object_keysdepends_on_skipped_cells§errored$b0efbf09-53d7-40b2-af63-49f794336e9fqueued¤logsrunning¦outputbody mimetext/htmlrootassigneelast_run_timestampA|ưpersist_js_state·has_pluto_hook_features§cell_id$b0efbf09-53d7-40b2-af63-49f794336e9fdepends_on_disabled_cells§runtime published_object_keysdepends_on_skipped_cells§errored$18e1147f-ef60-4368-819b-4e41c1b904dfqueued¤logsrunning¦outputbodyY

The End

mimetext/htmlrootassigneelast_run_timestampA|%persist_js_state·has_pluto_hook_features§cell_id$18e1147f-ef60-4368-819b-4e41c1b904dfdepends_on_disabled_cells§runtimevIpublished_object_keysdepends_on_skipped_cells§errored$5892921c-b019-418c-ba01-3d7a4e4697b3queued¤logsrunning¦outputbody'

On ne partage normalement pas de fichiers binaires (ex : .o) par git car ce n'est pas portable (ex : ce .o ne marche pas sur Mac OS si compilé sur un Raspberry). Lorsque des fichiers auto-générés apparaissent dans la sortie de git status, ajoutez-les dans le .gitignore. Supprimez-les de git avec git rm s'ils ont été ajouté précédemment par accident, ce qui ne devrait pas arriver si git add -p est toujours utilisé au lieu de git add ..

C'est une bonne chose d'écrire des unit tests, mais comme les signatures des fonctions sont libres, nous utiliserons l'interface uniformisée en ligne de commande pour testez votre code. Assurez-vous qu'elle fonctionne comme demandée.

Le Makefile génère un exécutable. Vous pouvez l'utiliser de la façon suivante :

./<nom du fichier> [arguments]
mimetext/htmlrootassigneelast_run_timestampA|persist_js_state·has_pluto_hook_features§cell_id$5892921c-b019-418c-ba01-3d7a4e4697b3depends_on_disabled_cells§runtime[published_object_keysdepends_on_skipped_cells§errored$b3f5afd5-3bcc-44ed-8e35-104a3a7c3378queued¤logsrunning¦outputbodyV

Exemple avec sanitize

mimetext/htmlrootassigneelast_run_timestampA|EFpersist_js_state·has_pluto_hook_features§cell_id$b3f5afd5-3bcc-44ed-8e35-104a3a7c3378depends_on_disabled_cells§runtimepublished_object_keysdepends_on_skipped_cells§errored$47f92d66-0834-4f8d-9bdf-172c55e93ccequeued¤logsrunning¦outputbodymimetext/plainrootassigneelast_run_timestampA|1{5persist_js_state·has_pluto_hook_features§cell_id$47f92d66-0834-4f8d-9bdf-172c55e93ccedepends_on_disabled_cells§runtimeȵpublished_object_keysdepends_on_skipped_cells§errored$9e9a0b57-30ce-4c9c-b0f5-a111f692d13fqueued¤logsrunning¦outputbody>

Debugging

mimetext/htmlrootassigneelast_run_timestampA|ϖpersist_js_state·has_pluto_hook_features§cell_id$9e9a0b57-30ce-4c9c-b0f5-a111f692d13fdepends_on_disabled_cells§runtime/published_object_keysdepends_on_skipped_cells§errored$810cdd19-7e3f-4cf4-a337-d9c1244e96cequeued¤logsrunning¦outputbody
mimetext/htmlrootassigneelast_run_timestampA|)persist_js_state·has_pluto_hook_features§cell_id$810cdd19-7e3f-4cf4-a337-d9c1244e96cedepends_on_disabled_cells§runtime $ǵpublished_object_keysdepends_on_skipped_cells§errored$6764ba72-95ec-4f3b-ac10-4e7e1b2bcf3bqueued¤logsrunning¦outputbodyV

Clarifications projet

mimetext/htmlrootassigneelast_run_timestampA|ypersist_js_state·has_pluto_hook_features§cell_id$6764ba72-95ec-4f3b-ac10-4e7e1b2bcf3bdepends_on_disabled_cells§runtimeµpublished_object_keysdepends_on_skipped_cells§errored$d87d73d9-d9d8-46e9-9599-0daa7fa95e9cqueued¤logsrunning¦outputbodyn

Chacun doit contribuer sur le Git

mimetext/htmlrootassigneelast_run_timestampA| persist_js_state·has_pluto_hook_features§cell_id$d87d73d9-d9d8-46e9-9599-0daa7fa95e9cdepends_on_disabled_cells§runtime>published_object_keysdepends_on_skipped_cells§errored$d1c8fa7e-8874-45e3-a398-e1fa2322af32queued¤logsrunning¦outputbodyٜ

Vérifiez qu'il n'y a pas de fuites de mémoires

mimetext/htmlrootassigneelast_run_timestampA|\>persist_js_state·has_pluto_hook_features§cell_id$d1c8fa7e-8874-45e3-a398-e1fa2322af32depends_on_disabled_cells§runtimepublished_object_keysdepends_on_skipped_cells§errored$d16d02fb-ad22-4886-aecc-42fc3a9bc2d8queued¤logslinemsgٌCompiling : `/home/runner/.julia/artifacts/207eb5b8330e24674fe59b50d72f4b3d946219c8/tools/clang /tmp/jl_JCxQ2q/main.c -o /tmp/jl_JCxQ2q/bin`text/plaincell_id$d16d02fb-ad22-4886-aecc-42fc3a9bc2d8kwargsidMyUtils_6794ab28fileA/home/runner/work/LEPL1503/LEPL1503/Lectures/MyUtils/src/clang.jlgroupclanglevelInfolinemsg'Running : `valgrind /tmp/jl_JCxQ2q/bin`text/plaincell_id$d16d02fb-ad22-4886-aecc-42fc3a9bc2d8kwargsidMyUtils_0f723ef4fileA/home/runner/work/LEPL1503/LEPL1503/Lectures/MyUtils/src/clang.jlgroupclanglevelInfolinemsg8==10754== Memcheck, a memory error detector ==10754== Copyright (C) 2002-2022, and GNU GPL'd, by Julian Seward et al. ==10754== Using Valgrind-3.22.0 and LibVEX; rerun with -h for copyright info ==10754== Command: /tmp/jl_JCxQ2q/bin ==10754== ==10754== Invalid write of size 4 ==10754== at 0x10915A: f (in /tmp/jl_JCxQ2q/bin) ==10754== by 0x109183: main (in /tmp/jl_JCxQ2q/bin) ==10754== Address 0x4a79068 is 0 bytes after a block of size 40 alloc'd ==10754== at 0x4846828: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so) ==10754== by 0x109151: f (in /tmp/jl_JCxQ2q/bin) ==10754== by 0x109183: main (in /tmp/jl_JCxQ2q/bin) ==10754== ==10754== ==10754== HEAP SUMMARY: ==10754== in use at exit: 40 bytes in 1 blocks ==10754== total heap usage: 1 allocs, 0 frees, 40 bytes allocated ==10754== ==10754== LEAK SUMMARY: ==10754== definitely lost: 40 bytes in 1 blocks ==10754== indirectly lost: 0 bytes in 0 blocks ==10754== possibly lost: 0 bytes in 0 blocks ==10754== still reachable: 0 bytes in 0 blocks ==10754== suppressed: 0 bytes in 0 blocks ==10754== Rerun with --leak-check=full to see details of leaked memory ==10754== ==10754== For lists of detected and suppressed errors, rerun with: -s ==10754== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0) text/plaincell_id$d16d02fb-ad22-4886-aecc-42fc3a9bc2d8kwargsidPlutoRunner_d1acb81efileP/home/runner/.julia/packages/Pluto/CBqeh/src/runner/PlutoRunner/src/io/stdout.jlgroupstdoutlevelLogLevel(-555)running¦outputbody
#include <stdlib.h>

void f(void)
{
    int *x = malloc(10 * sizeof(int));
    x[10] = 0; // problem 1: heap block overrun
} // problem 2: memory leak -- x not freed

int main(void)
{
    f();
    return 0;
} // From https://valgrind.org/docs/manual/quick-start.html
mimetext/htmlrootassigneelast_run_timestampA|+|$persist_js_state·has_pluto_hook_features§cell_id$d16d02fb-ad22-4886-aecc-42fc3a9bc2d8depends_on_disabled_cells§runtimeJYppublished_object_keysdepends_on_skipped_cells§errored$4790109e-06b0-4518-a95f-ed9ca8b5f595queued¤logsrunning¦outputbodymimetext/plainrootassigneelast_run_timestampA|1@persist_js_state·has_pluto_hook_features§cell_id$4790109e-06b0-4518-a95f-ed9ca8b5f595depends_on_disabled_cells§runtime5ʵpublished_object_keysdepends_on_skipped_cells§errored$3b928e29-a281-4dc2-9429-41e7d98dad54queued¤logsrunning¦outputbodyV

Exemple sans sanitize

mimetext/htmlrootassigneelast_run_timestampA|,˰persist_js_state·has_pluto_hook_features§cell_id$3b928e29-a281-4dc2-9429-41e7d98dad54depends_on_disabled_cells§runtimepublished_object_keysdepends_on_skipped_cells§errored$ff911f08-d9a3-41f3-8e8d-c8e94fecacf0queued¤logslinemsg١Compiling : `/home/runner/.julia/artifacts/207eb5b8330e24674fe59b50d72f4b3d946219c8/tools/clang -Wno-array-bounds -g /tmp/jl_8zbnAw/main.c -o /tmp/jl_8zbnAw/bin`text/plaincell_id$ff911f08-d9a3-41f3-8e8d-c8e94fecacf0kwargsidMyUtils_6794ab28fileA/home/runner/work/LEPL1503/LEPL1503/Lectures/MyUtils/src/clang.jlgroupclanglevelInfolinemsgRunning : `/tmp/jl_8zbnAw/bin`text/plaincell_id$ff911f08-d9a3-41f3-8e8d-c8e94fecacf0kwargsidMyUtils_0f723ef4fileA/home/runner/work/LEPL1503/LEPL1503/Lectures/MyUtils/src/clang.jlgroupclanglevelInfolinemsg5&i = 0x7ffd644e8478 &a = 0x7ffd644e8470 i = -1000000 text/plaincell_id$ff911f08-d9a3-41f3-8e8d-c8e94fecacf0kwargsidPlutoRunner_d1acb81efileP/home/runner/.julia/packages/Pluto/CBqeh/src/runner/PlutoRunner/src/io/stdout.jlgroupstdoutlevelLogLevel(-555)running¦outputbody
#include <stdio.h>
#include <stdlib.h>

int main()
{
    int i = 0;
    int a[2];
    a[-1] = 1000000;
    a[2] = -1000000;
    printf("&i = %p\n", &i);
    printf("&a = %p\n", &a);
    printf("i = %d\n", i);
    return EXIT_SUCCESS;
}
mimetext/htmlrootassigneelast_run_timestampA|01persist_js_state·has_pluto_hook_features§cell_id$ff911f08-d9a3-41f3-8e8d-c8e94fecacf0depends_on_disabled_cells§runtime`published_object_keysdepends_on_skipped_cells§errored$dfb72971-ccf6-46ec-b686-37e071bd9598queued¤logsrunning¦outputbodyX

Interface par fichiers

mimetext/htmlrootassigneelast_run_timestampA|u>persist_js_state·has_pluto_hook_features§cell_id$dfb72971-ccf6-46ec-b686-37e071bd9598depends_on_disabled_cells§runtime7published_object_keysdepends_on_skipped_cells§errored$35ad233c-a500-461a-af82-855d56792841queued¤logslinemsgO Activating project at `~/work/LEPL1503/LEPL1503/Lectures` text/plaincell_id$35ad233c-a500-461a-af82-855d56792841kwargsidPlutoRunner_d1acb81efileP/home/runner/.julia/packages/Pluto/CBqeh/src/runner/PlutoRunner/src/io/stdout.jlgroupstdoutlevelLogLevel(-555)running¦outputbodymimetext/plainrootassigneelast_run_timestampA|x#persist_js_state·has_pluto_hook_features§cell_id$35ad233c-a500-461a-af82-855d56792841depends_on_disabled_cells§runtime1published_object_keysdepends_on_skipped_cells§errored$9afe0855-162f-4234-8001-610e08e39bb0queued¤logsrunning¦outputbody
mimetext/htmlrootassigneelast_run_timestampA|persist_js_state·has_pluto_hook_features§cell_id$9afe0855-162f-4234-8001-610e08e39bb0depends_on_disabled_cells§runtime˵published_object_keysdepends_on_skipped_cells§errored$d50aa7f3-9c15-412e-82c2-f870aab8ffb0queued¤logsrunning¦outputbodymimetext/plainrootassigneelast_run_timestampA|,persist_js_state·has_pluto_hook_features§cell_id$d50aa7f3-9c15-412e-82c2-f870aab8ffb0depends_on_disabled_cells§runtime1published_object_keysdepends_on_skipped_cells§errored$e3053cb5-186d-4c98-86c7-609be4a7c8dcqueued¤logslinemsgٴCompiling : `/home/runner/.julia/artifacts/207eb5b8330e24674fe59b50d72f4b3d946219c8/tools/clang -Wno-array-bounds -fsanitize=address -g /tmp/jl_BHN6gM/main.c -o /tmp/jl_BHN6gM/bin`text/plaincell_id$e3053cb5-186d-4c98-86c7-609be4a7c8dckwargsidMyUtils_6794ab28fileA/home/runner/work/LEPL1503/LEPL1503/Lectures/MyUtils/src/clang.jlgroupclanglevelInfolinemsgRunning : `/tmp/jl_BHN6gM/bin`text/plaincell_id$e3053cb5-186d-4c98-86c7-609be4a7c8dckwargsidMyUtils_0f723ef4fileA/home/runner/work/LEPL1503/LEPL1503/Lectures/MyUtils/src/clang.jlgroupclanglevelInfolinemsgProcessFailedExceptiontext/plaincell_id$e3053cb5-186d-4c98-86c7-609be4a7c8dckwargsidMyUtils_18a9260cfileA/home/runner/work/LEPL1503/LEPL1503/Lectures/MyUtils/src/clang.jlgroupclanglevelWarnlinemsg ================================================================= ==10762==ERROR: AddressSanitizer: stack-buffer-overflow on address 0x7f5ae2c0002c at pc 0x55d5f4ee9bca bp 0x7ffcc8cd78b0 sp 0x7ffcc8cd78a8 WRITE of size 4 at 0x7f5ae2c0002c thread T0 #0 0x55d5f4ee9bc9 (/tmp/jl_BHN6gM/bin+0x162bc9) #1 0x7f5ae4c2a1c9 (/lib/x86_64-linux-gnu/libc.so.6+0x2a1c9) (BuildId: 8e9fd827446c24067541ac5390e6f527fb5947bb) #2 0x7f5ae4c2a28a (/lib/x86_64-linux-gnu/libc.so.6+0x2a28a) (BuildId: 8e9fd827446c24067541ac5390e6f527fb5947bb) #3 0x55d5f4db23f4 (/tmp/jl_BHN6gM/bin+0x2b3f4) Address 0x7f5ae2c0002c is located in stack of thread T0 at offset 44 in frame #0 0x55d5f4ee9aaf (/tmp/jl_BHN6gM/bin+0x162aaf) This frame has 2 object(s): [32, 36) 'i' (line 6) [48, 56) 'a' (line 7) <== Memory access at offset 44 underflows this variable HINT: this may be a false positive if your program uses some custom stack unwind mechanism, swapcontext or vfork (longjmp and C++ exceptions *are* supported) SUMMARY: AddressSanitizer: stack-buffer-overflow (/tmp/jl_BHN6gM/bin+0x162bc9) Shadow bytes around the buggy address: 0x7f5ae2bffd80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x7f5ae2bffe00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x7f5ae2bffe80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x7f5ae2bfff00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x7f5ae2bfff80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 =>0x7f5ae2c00000: f1 f1 f1 f1 04[f2]00 f3 f3 f3 f3 f3 00 00 00 00 0x7f5ae2c00080: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x7f5ae2c00100: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x7f5ae2c00180: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x7f5ae2c00200: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x7f5ae2c00280: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 Shadow byte legend (one shadow byte represents 8 application bytes): Addressable: 00 Partially addressable: 01 02 03 04 05 06 07 Heap left redzone: fa Freed heap region: fd Stack left redzone: f1 Stack mid redzone: f2 Stack right redzone: f3 Stack after return: f5 Stack use after scope: f8 Global redzone: f9 Global init order: f6 Poisoned by user: f7 Container overflow: fc Array cookie: ac Intra object redzone: bb ASan internal: fe Left alloca redzone: ca Right alloca redzone: cb ==10762==ABORTING text/plaincell_id$e3053cb5-186d-4c98-86c7-609be4a7c8dckwargsidPlutoRunner_d1acb81efileP/home/runner/.julia/packages/Pluto/CBqeh/src/runner/PlutoRunner/src/io/stdout.jlgroupstdoutlevelLogLevel(-555)running¦outputbody
#include <stdio.h>
#include <stdlib.h>

int main()
{
    int i = 0;
    int a[2];
    a[-1] = 1000000;
    a[2] = -1000000;
    printf("&i = %p\n", &i);
    printf("&a = %p\n", &a);
    printf("i = %d\n", i);
    return EXIT_SUCCESS;
}
mimetext/htmlrootassigneelast_run_timestampA|@\persist_js_state·has_pluto_hook_features§cell_id$e3053cb5-186d-4c98-86c7-609be4a7c8dcdepends_on_disabled_cells§runtimeӵpublished_object_keysdepends_on_skipped_cells§errored$52ddb3b6-0f88-4596-a480-d4d17489292cqueued¤logsrunning¦outputbodylB

Lors de la correction, nous vérifierons qu'il n'y a pas de fuites de mémoire avec Valgrind

mimetext/htmlrootassigneelast_run_timestampA|Apersist_js_state·has_pluto_hook_features§cell_id$52ddb3b6-0f88-4596-a480-d4d17489292cdepends_on_disabled_cells§runtime Qpublished_object_keysdepends_on_skipped_cells§errored$a843fc18-5290-414a-a5db-dacd4ac88f1dqueued¤logsrunning¦outputbodymimetext/plainrootassigneelast_run_timestampA|Qy persist_js_state·has_pluto_hook_features§cell_id$a843fc18-5290-414a-a5db-dacd4ac88f1ddepends_on_disabled_cells§runtime^published_object_keysdepends_on_skipped_cells§errored±cell_dependencies$ee9648f2-bd69-4bf4-b95b-cc3fc2bf5b60precedence_heuristic cell_id$ee9648f2-bd69-4bf4-b95b-cc3fc2bf5b60downstream_cells_mapupstream_cells_map@md_strgetindex$10e3b9fb-fe77-4106-a512-74f4d7d0cfbbprecedence_heuristiccell_id$10e3b9fb-fe77-4106-a512-74f4d7d0cfbbdownstream_cells_mapMyUtilsPlutoUIExperimentalLayoutLuxorPlutoTeachingToolsupstream_cells_map$7a9a1afc-16a3-11f0-2474-67fc85a76676precedence_heuristic cell_id$7a9a1afc-16a3-11f0-2474-67fc85a76676downstream_cells_mapupstream_cells_mapheader$b0efbf09-53d7-40b2-af63-49f794336e9fprecedence_heuristic cell_id$b0efbf09-53d7-40b2-af63-49f794336e9fdownstream_cells_mapvalgrind_debug$d16d02fb-ad22-4886-aecc-42fc3a9bc2d8upstream_cells_map@md_strCoreBase.get@bindasideFoldablePlutoRunnerCheckBoxPlutoRunner.create_bondBaseCore.applicablegetindex$18e1147f-ef60-4368-819b-4e41c1b904dfprecedence_heuristic cell_id$18e1147f-ef60-4368-819b-4e41c1b904dfdownstream_cells_mapupstream_cells_mapBaseBase.Docs.HTML@html_str$5892921c-b019-418c-ba01-3d7a4e4697b3precedence_heuristic cell_id$5892921c-b019-418c-ba01-3d7a4e4697b3downstream_cells_mapupstream_cells_map@md_strgetindex$b3f5afd5-3bcc-44ed-8e35-104a3a7c3378precedence_heuristic cell_id$b3f5afd5-3bcc-44ed-8e35-104a3a7c3378downstream_cells_mapupstream_cells_map@md_strgetindex$47f92d66-0834-4f8d-9bdf-172c55e93cceprecedence_heuristiccell_id$47f92d66-0834-4f8d-9bdf-172c55e93ccedownstream_cells_mapPkg$35ad233c-a500-461a-af82-855d56792841$a843fc18-5290-414a-a5db-dacd4ac88f1dupstream_cells_map$9e9a0b57-30ce-4c9c-b0f5-a111f692d13fprecedence_heuristic cell_id$9e9a0b57-30ce-4c9c-b0f5-a111f692d13fdownstream_cells_mapupstream_cells_map@md_strgetindex$810cdd19-7e3f-4cf4-a337-d9c1244e96ceprecedence_heuristic cell_id$810cdd19-7e3f-4cf4-a337-d9c1244e96cedownstream_cells_mapupstream_cells_map@md_strgetindex$6764ba72-95ec-4f3b-ac10-4e7e1b2bcf3bprecedence_heuristic cell_id$6764ba72-95ec-4f3b-ac10-4e7e1b2bcf3bdownstream_cells_mapupstream_cells_map@md_strgetindex$d87d73d9-d9d8-46e9-9599-0daa7fa95e9cprecedence_heuristic cell_id$d87d73d9-d9d8-46e9-9599-0daa7fa95e9cdownstream_cells_mapupstream_cells_map@md_strgetindex$d1c8fa7e-8874-45e3-a398-e1fa2322af32precedence_heuristic cell_id$d1c8fa7e-8874-45e3-a398-e1fa2322af32downstream_cells_mapupstream_cells_map@md_strgetindex$d16d02fb-ad22-4886-aecc-42fc3a9bc2d8precedence_heuristic cell_id$d16d02fb-ad22-4886-aecc-42fc3a9bc2d8downstream_cells_mapupstream_cells_mapcompile_and_runStringvalgrind$4790109e-06b0-4518-a95f-ed9ca8b5f595valgrind_debug$b0efbf09-53d7-40b2-af63-49f794336e9f$4790109e-06b0-4518-a95f-ed9ca8b5f595precedence_heuristic cell_id$4790109e-06b0-4518-a95f-ed9ca8b5f595downstream_cells_mapvalgrind$d16d02fb-ad22-4886-aecc-42fc3a9bc2d8upstream_cells_mapExample$3b928e29-a281-4dc2-9429-41e7d98dad54precedence_heuristic cell_id$3b928e29-a281-4dc2-9429-41e7d98dad54downstream_cells_mapupstream_cells_map@md_strgetindex$ff911f08-d9a3-41f3-8e8d-c8e94fecacf0precedence_heuristic cell_id$ff911f08-d9a3-41f3-8e8d-c8e94fecacf0downstream_cells_mapupstream_cells_mapout_of_bounds$d50aa7f3-9c15-412e-82c2-f870aab8ffb0compile_and_run$dfb72971-ccf6-46ec-b686-37e071bd9598precedence_heuristic cell_id$dfb72971-ccf6-46ec-b686-37e071bd9598downstream_cells_mapupstream_cells_map@md_strgetindex$35ad233c-a500-461a-af82-855d56792841precedence_heuristiccell_id$35ad233c-a500-461a-af82-855d56792841downstream_cells_mapupstream_cells_mapPkg$47f92d66-0834-4f8d-9bdf-172c55e93ccePkg.activate$9afe0855-162f-4234-8001-610e08e39bb0precedence_heuristic cell_id$9afe0855-162f-4234-8001-610e08e39bb0downstream_cells_mapupstream_cells_map@md_strgetindex$d50aa7f3-9c15-412e-82c2-f870aab8ffb0precedence_heuristic cell_id$d50aa7f3-9c15-412e-82c2-f870aab8ffb0downstream_cells_mapout_of_bounds$ff911f08-d9a3-41f3-8e8d-c8e94fecacf0$e3053cb5-186d-4c98-86c7-609be4a7c8dcupstream_cells_mapExample$e3053cb5-186d-4c98-86c7-609be4a7c8dcprecedence_heuristic cell_id$e3053cb5-186d-4c98-86c7-609be4a7c8dcdownstream_cells_mapupstream_cells_mapout_of_bounds$d50aa7f3-9c15-412e-82c2-f870aab8ffb0compile_and_run$52ddb3b6-0f88-4596-a480-d4d17489292cprecedence_heuristic cell_id$52ddb3b6-0f88-4596-a480-d4d17489292cdownstream_cells_mapupstream_cells_map@md_str=>imggetindex$a843fc18-5290-414a-a5db-dacd4ac88f1dprecedence_heuristic cell_id$a843fc18-5290-414a-a5db-dacd4ac88f1ddownstream_cells_mapupstream_cells_mapPkg$47f92d66-0834-4f8d-9bdf-172c55e93ccePkg.instantiatecell_execution_order$47f92d66-0834-4f8d-9bdf-172c55e93cce$35ad233c-a500-461a-af82-855d56792841$10e3b9fb-fe77-4106-a512-74f4d7d0cfbb$7a9a1afc-16a3-11f0-2474-67fc85a76676$6764ba72-95ec-4f3b-ac10-4e7e1b2bcf3b$810cdd19-7e3f-4cf4-a337-d9c1244e96ce$d87d73d9-d9d8-46e9-9599-0daa7fa95e9c$ee9648f2-bd69-4bf4-b95b-cc3fc2bf5b60$d1c8fa7e-8874-45e3-a398-e1fa2322af32$52ddb3b6-0f88-4596-a480-d4d17489292c$b0efbf09-53d7-40b2-af63-49f794336e9f$4790109e-06b0-4518-a95f-ed9ca8b5f595$d16d02fb-ad22-4886-aecc-42fc3a9bc2d8$dfb72971-ccf6-46ec-b686-37e071bd9598$5892921c-b019-418c-ba01-3d7a4e4697b3$9e9a0b57-30ce-4c9c-b0f5-a111f692d13f$9afe0855-162f-4234-8001-610e08e39bb0$3b928e29-a281-4dc2-9429-41e7d98dad54$b3f5afd5-3bcc-44ed-8e35-104a3a7c3378$d50aa7f3-9c15-412e-82c2-f870aab8ffb0$ff911f08-d9a3-41f3-8e8d-c8e94fecacf0$e3053cb5-186d-4c98-86c7-609be4a7c8dc$18e1147f-ef60-4368-819b-4e41c1b904df$a843fc18-5290-414a-a5db-dacd4ac88f1dlast_hot_reload_timeshortpathCours5.jlprocess_statusreadypath6/home/runner/work/LEPL1503/LEPL1503/Lectures/Cours5.jlpluto_versionv0.20.21last_save_timeA| hcell_order$7a9a1afc-16a3-11f0-2474-67fc85a76676$6764ba72-95ec-4f3b-ac10-4e7e1b2bcf3b$810cdd19-7e3f-4cf4-a337-d9c1244e96ce$d87d73d9-d9d8-46e9-9599-0daa7fa95e9c$ee9648f2-bd69-4bf4-b95b-cc3fc2bf5b60$d1c8fa7e-8874-45e3-a398-e1fa2322af32$52ddb3b6-0f88-4596-a480-d4d17489292c$d16d02fb-ad22-4886-aecc-42fc3a9bc2d8$b0efbf09-53d7-40b2-af63-49f794336e9f$4790109e-06b0-4518-a95f-ed9ca8b5f595$dfb72971-ccf6-46ec-b686-37e071bd9598$5892921c-b019-418c-ba01-3d7a4e4697b3$9e9a0b57-30ce-4c9c-b0f5-a111f692d13f$9afe0855-162f-4234-8001-610e08e39bb0$3b928e29-a281-4dc2-9429-41e7d98dad54$ff911f08-d9a3-41f3-8e8d-c8e94fecacf0$b3f5afd5-3bcc-44ed-8e35-104a3a7c3378$e3053cb5-186d-4c98-86c7-609be4a7c8dc$d50aa7f3-9c15-412e-82c2-f870aab8ffb0$18e1147f-ef60-4368-819b-4e41c1b904df$47f92d66-0834-4f8d-9bdf-172c55e93cce$35ad233c-a500-461a-af82-855d56792841$a843fc18-5290-414a-a5db-dacd4ac88f1d$10e3b9fb-fe77-4106-a512-74f4d7d0cfbbpublished_objectsnbpkginstall_time_nsinstantiatedòinstalled_versionsterminal_outputsenabled·restart_recommended_msgrestart_required_msgbusy_packageswaiting_for_permission,waiting_for_permission_but_probably_disabled«cell_inputs$ee9648f2-bd69-4bf4-b95b-cc3fc2bf5b60cell_id$ee9648f2-bd69-4bf4-b95b-cc3fc2bf5b60codemd""" * Pour valider votre contribution au projet, il est nécessaire que vous ayez des merge requests en votre nom qui sont mergées avec des commits également en votre nom * Ces merge requests doivent avoir été finies (donc passer les tests) puis mergées * Elles doivent apporter une contribution significatives au code, par exemple pas juste modifier le README ou reformatter * L'excuse du peer coding (vous programmez à deux sur un ordinateur) n'est pas valide * Ne pas savoir exécuter le code chez soi n'est pas une excuse. Git est facile à installer sous n'importe quelle platforme et les tests s'exécute sur le runner GitLab. """metadatashow_logsèdisabled®skip_as_script«code_folded$10e3b9fb-fe77-4106-a512-74f4d7d0cfbbcell_id$10e3b9fb-fe77-4106-a512-74f4d7d0cfbbcodeMusing Luxor, PlutoUI, PlutoUI.ExperimentalLayout, MyUtils, PlutoTeachingToolsmetadatashow_logsèdisabled®skip_as_script«code_folded$7a9a1afc-16a3-11f0-2474-67fc85a76676cell_id$7a9a1afc-16a3-11f0-2474-67fc85a76676codeMheader("LEPL1503/LSINC1503 - Cours 5", "O. Bonaventure, B. Legat, M. Baerts")metadatashow_logsèdisabled®skip_as_script«code_folded$b0efbf09-53d7-40b2-af63-49f794336e9fcell_id$b0efbf09-53d7-40b2-af63-49f794336e9fcodeaside( Foldable( md"Pourquoi `valgrind` ne donne-t-il pas le numéro de ligne ?", md"On n'a pas compilé avec `-g` ! On essaie avec `-g` ? $(@bind valgrind_debug CheckBox())", ), v_offset = -300, )metadatashow_logsèdisabled®skip_as_script«code_folded$18e1147f-ef60-4368-819b-4e41c1b904dfcell_id$18e1147f-ef60-4368-819b-4e41c1b904dfcodeahtml"

The End

"metadatashow_logsèdisabled®skip_as_script«code_folded$5892921c-b019-418c-ba01-3d7a4e4697b3cell_id$5892921c-b019-418c-ba01-3d7a4e4697b3codeNmd""" On ne partage normalement pas de fichiers binaires (ex : `.o`) par `git` car ce n'est pas portable (ex : ce `.o` ne marche pas sur Mac OS si compilé sur un Raspberry). Lorsque des fichiers auto-générés apparaissent dans la sortie de `git status`, ajoutez-les dans le `.gitignore`. Supprimez-les de git avec `git rm` s'ils ont été ajouté précédemment par accident, ce qui ne devrait pas arriver si `git add -p` est toujours utilisé au lieu de `git add .`. C'est une bonne chose d'écrire des unit tests, mais comme les signatures des fonctions sont libres, nous utiliserons l'interface uniformisée en ligne de commande pour testez votre code. Assurez-vous qu'elle fonctionne comme demandée. > Le Makefile génère un exécutable. Vous pouvez l'utiliser de la façon suivante : > > ``` > ./ [arguments] > ``` """metadatashow_logsèdisabled®skip_as_script«code_folded$b3f5afd5-3bcc-44ed-8e35-104a3a7c3378cell_id$b3f5afd5-3bcc-44ed-8e35-104a3a7c3378codemd"## Exemple avec sanitize"metadatashow_logsèdisabled®skip_as_script«code_folded$47f92d66-0834-4f8d-9bdf-172c55e93ccecell_id$47f92d66-0834-4f8d-9bdf-172c55e93ccecodeimport Pkgmetadatashow_logsèdisabled®skip_as_script«code_folded$9e9a0b57-30ce-4c9c-b0f5-a111f692d13fcell_id$9e9a0b57-30ce-4c9c-b0f5-a111f692d13fcodemd"## Debugging"metadatashow_logsèdisabled®skip_as_script«code_folded$810cdd19-7e3f-4cf4-a337-d9c1244e96cecell_id$810cdd19-7e3f-4cf4-a337-d9c1244e96cecodewmd""" * Il est important de lire [la partie multithread du syllabus](https://lepl1503.info.ucl.ac.be/syllabus/theorie/index.html#systemes-multiprocesseurs) pour savoir faire la deuxième partie * Amenez le Raspberry aux séances de TP pour que votre tuteur puissent vérifier que vous savez l'utiliser et que votre code fonctionne dessus. Les mesures devront être faites sur le Raspeberry pour être valable. On ne considère pas les mesures sur une autre plateforme. * N'oubliez de régulièrement récupérer les modifications réalisées sur le dépôt parent. * Rappel : l'utilisation de logiciels d'IA générative tels que chatGPT, GitHub copilot, ... est interdite pour l'écriture de code source en langage C et les reviews. Par ailleurs, les sources d'information externes doivent être systématiquement citées en respectant les normes de référencement bibliographique. """metadatashow_logsèdisabled®skip_as_script«code_folded$6764ba72-95ec-4f3b-ac10-4e7e1b2bcf3bcell_id$6764ba72-95ec-4f3b-ac10-4e7e1b2bcf3bcodemd"## Clarifications projet"metadatashow_logsèdisabled®skip_as_script«code_folded$d87d73d9-d9d8-46e9-9599-0daa7fa95e9ccell_id$d87d73d9-d9d8-46e9-9599-0daa7fa95e9ccode(md"## Chacun doit contribuer sur le Git"metadatashow_logsèdisabled®skip_as_script«code_folded$d1c8fa7e-8874-45e3-a398-e1fa2322af32cell_id$d1c8fa7e-8874-45e3-a398-e1fa2322af32code7md"## Vérifiez qu'il n'y a pas de fuites de mémoires"metadatashow_logsèdisabled®skip_as_script«code_folded$d16d02fb-ad22-4886-aecc-42fc3a9bc2d8cell_id$d16d02fb-ad22-4886-aecc-42fc3a9bc2d8codegcompile_and_run(valgrind, valgrind = true, verbose = true, cflags = valgrind_debug ? ["-g"] : String[])metadatashow_logsèdisabled®skip_as_script«code_folded$4790109e-06b0-4518-a95f-ed9ca8b5f595cell_id$4790109e-06b0-4518-a95f-ed9ca8b5f595code!valgrind = Example("valgrind.c");metadatashow_logsèdisabled®skip_as_script«code_folded$3b928e29-a281-4dc2-9429-41e7d98dad54cell_id$3b928e29-a281-4dc2-9429-41e7d98dad54codemd"## Exemple sans sanitize"metadatashow_logsèdisabled®skip_as_script«code_folded$ff911f08-d9a3-41f3-8e8d-c8e94fecacf0cell_id$ff911f08-d9a3-41f3-8e8d-c8e94fecacf0codefcompile_and_run(out_of_bounds, valgrind = false, verbose = true, cflags = ["-Wno-array-bounds", "-g"])metadatashow_logsèdisabled®skip_as_script«code_folded$dfb72971-ccf6-46ec-b686-37e071bd9598cell_id$dfb72971-ccf6-46ec-b686-37e071bd9598codemd"## Interface par fichiers"metadatashow_logsèdisabled®skip_as_script«code_folded$35ad233c-a500-461a-af82-855d56792841cell_id$35ad233c-a500-461a-af82-855d56792841codePkg.activate(".")metadatashow_logsèdisabled®skip_as_script«code_folded$9afe0855-162f-4234-8001-610e08e39bb0cell_id$9afe0855-162f-4234-8001-610e08e39bb0codemd""" * Ne pas oublier d'utiliser `-g` lors de la compilation * `lldb` : développé par LLVM comme `clang` mais fonctionne aussi avec des binaires compilés avec `gcc`, plus facile à installer sur Mac OS * `gdb` : développé par GNU comme `gcc` mais fonctionne aussi avec des binaires compilés avec `clang` * Il existe des interfaces graphiques pour ces débogueur, ex : [Seer](https://github.com/epasveer/seer) (`apt install seergdb`), [VSCode](https://code.visualstudio.com/docs/cpp/cpp-debug), [lldbg](https://github.com/zmeadows/lldbg), [gdbgui](https://www.gdbgui.com), etc. * Utiliser un débogueur, c'est un bon réflex ! * Utilisez `-fsanitize=address` à la compilation pour que les bornes soient vérifiées. - Le code est peut-être un peu moins rapide donc c'est à désactiver pour les mesures - mais il n'y a pas de bonne raison de ne pas l'utiliser dans la phase de développement! """metadatashow_logsèdisabled®skip_as_script«code_folded$d50aa7f3-9c15-412e-82c2-f870aab8ffb0cell_id$d50aa7f3-9c15-412e-82c2-f870aab8ffb0code+out_of_bounds = Example("out_of_bounds.c");metadatashow_logsèdisabled®skip_as_script«code_folded$e3053cb5-186d-4c98-86c7-609be4a7c8dccell_id$e3053cb5-186d-4c98-86c7-609be4a7c8dccode|compile_and_run(out_of_bounds, valgrind = false, verbose = true, cflags = ["-Wno-array-bounds", "-fsanitize=address", "-g"])metadatashow_logsèdisabled®skip_as_script«code_folded$52ddb3b6-0f88-4596-a480-d4d17489292ccell_id$52ddb3b6-0f88-4596-a480-d4d17489292ccodemd""" Lors de la correction, nous vérifierons qu'il n'y a pas de fuites de mémoire avec [Valgrind $(img("https://valgrind.org/images/st-george-dragon.png", :height => "60"))](https://valgrind.org/) """metadatashow_logsèdisabled®skip_as_script«code_folded$a843fc18-5290-414a-a5db-dacd4ac88f1dcell_id$a843fc18-5290-414a-a5db-dacd4ac88f1dcodePkg.instantiate()metadatashow_logsèdisabled®skip_as_script«code_foldedënotebook_id$2be38f06-42da-11f1-8342-550ce9efca48in_temp_dir¨metadata