Þ±cell_dependenciesÞÙ$d1c8fa7e-8874-45e3-a398-e1fa2322af32„´precedence_heuristic §cell_idÙ$d1c8fa7e-8874-45e3-a398-e1fa2322af32´downstream_cells_map€²upstream_cells_map‚§@md_str�¨getindex�Ù$35ad233c-a500-461a-af82-855d56792841„´precedence_heuristic§cell_idÙ$35ad233c-a500-461a-af82-855d56792841´downstream_cells_map€²upstream_cells_map‚£Pkg‘Ù$47f92d66-0834-4f8d-9bdf-172c55e93cce¬Pkg.activate�Ù$b0efbf09-53d7-40b2-af63-49f794336e9f„´precedence_heuristic §cell_idÙ$b0efbf09-53d7-40b2-af63-49f794336e9f´downstream_cells_map�®valgrind_debug‘Ù$d16d02fb-ad22-4886-aecc-42fc3a9bc2d8²upstream_cells_mapŒ§@md_str�¤Core�¥aside�«PlutoRunner�·PlutoRunner.create_bond�¯Core.applicable�¨getindex�¨Base.get�¥@bind�¤Base�¨Foldable�¨CheckBox�Ù$e3053cb5-186d-4c98-86c7-609be4a7c8dc„´precedence_heuristic §cell_idÙ$e3053cb5-186d-4c98-86c7-609be4a7c8dc´downstream_cells_map€²upstream_cells_map‚­out_of_bounds‘Ù$d50aa7f3-9c15-412e-82c2-f870aab8ffb0¯compile_and_run�Ù$b3f5afd5-3bcc-44ed-8e35-104a3a7c3378„´precedence_heuristic §cell_idÙ$b3f5afd5-3bcc-44ed-8e35-104a3a7c3378´downstream_cells_map€²upstream_cells_map‚§@md_str�¨getindex�Ù$ee9648f2-bd69-4bf4-b95b-cc3fc2bf5b60„´precedence_heuristic §cell_idÙ$ee9648f2-bd69-4bf4-b95b-cc3fc2bf5b60´downstream_cells_map€²upstream_cells_map‚§@md_str�¨getindex�Ù$10e3b9fb-fe77-4106-a512-74f4d7d0cfbb„´precedence_heuristic§cell_idÙ$10e3b9fb-fe77-4106-a512-74f4d7d0cfbb´downstream_cells_map…§MyUtils�§PlutoUI�²ExperimentalLayout�¥Luxor�²PlutoTeachingTools�²upstream_cells_map€Ù$d50aa7f3-9c15-412e-82c2-f870aab8ffb0„´precedence_heuristic §cell_idÙ$d50aa7f3-9c15-412e-82c2-f870aab8ffb0´downstream_cells_map�­out_of_bounds’Ù$ff911f08-d9a3-41f3-8e8d-c8e94fecacf0Ù$e3053cb5-186d-4c98-86c7-609be4a7c8dc²upstream_cells_map�§Example�Ù$52ddb3b6-0f88-4596-a480-d4d17489292c„´precedence_heuristic §cell_idÙ$52ddb3b6-0f88-4596-a480-d4d17489292c´downstream_cells_map€²upstream_cells_map„§@md_str�¢=>�£img�¨getindex�Ù$6764ba72-95ec-4f3b-ac10-4e7e1b2bcf3b„´precedence_heuristic §cell_idÙ$6764ba72-95ec-4f3b-ac10-4e7e1b2bcf3b´downstream_cells_map€²upstream_cells_map‚§@md_str�¨getindex�Ù$5892921c-b019-418c-ba01-3d7a4e4697b3„´precedence_heuristic §cell_idÙ$5892921c-b019-418c-ba01-3d7a4e4697b3´downstream_cells_map€²upstream_cells_map‚§@md_str�¨getindex�Ù$18e1147f-ef60-4368-819b-4e41c1b904df„´precedence_heuristic §cell_idÙ$18e1147f-ef60-4368-819b-4e41c1b904df´downstream_cells_map€²upstream_cells_mapƒ¤Base�®Base.Docs.HTML�©@html_str�Ù$9afe0855-162f-4234-8001-610e08e39bb0„´precedence_heuristic §cell_idÙ$9afe0855-162f-4234-8001-610e08e39bb0´downstream_cells_map€²upstream_cells_map‚§@md_str�¨getindex�Ù$7a9a1afc-16a3-11f0-2474-67fc85a76676„´precedence_heuristic §cell_idÙ$7a9a1afc-16a3-11f0-2474-67fc85a76676´downstream_cells_map€²upstream_cells_map�¦header�Ù$ff911f08-d9a3-41f3-8e8d-c8e94fecacf0„´precedence_heuristic §cell_idÙ$ff911f08-d9a3-41f3-8e8d-c8e94fecacf0´downstream_cells_map€²upstream_cells_map‚­out_of_bounds‘Ù$d50aa7f3-9c15-412e-82c2-f870aab8ffb0¯compile_and_run�Ù$3b928e29-a281-4dc2-9429-41e7d98dad54„´precedence_heuristic §cell_idÙ$3b928e29-a281-4dc2-9429-41e7d98dad54´downstream_cells_map€²upstream_cells_map‚§@md_str�¨getindex�Ù$47f92d66-0834-4f8d-9bdf-172c55e93cce„´precedence_heuristic§cell_idÙ$47f92d66-0834-4f8d-9bdf-172c55e93cce´downstream_cells_map�£Pkg’Ù$35ad233c-a500-461a-af82-855d56792841Ù$a843fc18-5290-414a-a5db-dacd4ac88f1d²upstream_cells_map€Ù$dfb72971-ccf6-46ec-b686-37e071bd9598„´precedence_heuristic §cell_idÙ$dfb72971-ccf6-46ec-b686-37e071bd9598´downstream_cells_map€²upstream_cells_map‚§@md_str�¨getindex�Ù$d16d02fb-ad22-4886-aecc-42fc3a9bc2d8„´precedence_heuristic §cell_idÙ$d16d02fb-ad22-4886-aecc-42fc3a9bc2d8´downstream_cells_map€²upstream_cells_map„¯compile_and_run�¦String�¨valgrind‘Ù$4790109e-06b0-4518-a95f-ed9ca8b5f595®valgrind_debug‘Ù$b0efbf09-53d7-40b2-af63-49f794336e9fÙ$9e9a0b57-30ce-4c9c-b0f5-a111f692d13f„´precedence_heuristic §cell_idÙ$9e9a0b57-30ce-4c9c-b0f5-a111f692d13f´downstream_cells_map€²upstream_cells_map‚§@md_str�¨getindex�Ù$d87d73d9-d9d8-46e9-9599-0daa7fa95e9c„´precedence_heuristic §cell_idÙ$d87d73d9-d9d8-46e9-9599-0daa7fa95e9c´downstream_cells_map€²upstream_cells_map‚§@md_str�¨getindex�Ù$a843fc18-5290-414a-a5db-dacd4ac88f1d„´precedence_heuristic §cell_idÙ$a843fc18-5290-414a-a5db-dacd4ac88f1d´downstream_cells_map€²upstream_cells_map‚£Pkg‘Ù$47f92d66-0834-4f8d-9bdf-172c55e93cce¯Pkg.instantiate�Ù$4790109e-06b0-4518-a95f-ed9ca8b5f595„´precedence_heuristic §cell_idÙ$4790109e-06b0-4518-a95f-ed9ca8b5f595´downstream_cells_map�¨valgrind‘Ù$d16d02fb-ad22-4886-aecc-42fc3a9bc2d8²upstream_cells_map�§Example�Ù$810cdd19-7e3f-4cf4-a337-d9c1244e96ce„´precedence_heuristic §cell_idÙ$810cdd19-7e3f-4cf4-a337-d9c1244e96ce´downstream_cells_map€²upstream_cells_map‚§@md_str�¨getindex�´cell_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-dacd4ac88f1d´last_hot_reload_timeË®process_status¥ready¤pathÙ6/home/runner/work/LEPL1503/LEPL1503/Lectures/Cours5.jl­pluto_version¨v0.20.21ªcell_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-74f4d7d0cfbb±published_objects€¥nbpkgжwaiting_for_permissionÂÙ,waiting_for_permission_but_probably_disabled²installed_versions€°terminal_outputs€§enabled¬instantiated÷restart_recommended_msgÀ´restart_required_msgÀ¯install_time_nsÀ­busy_packages�«cell_inputsÞÙ$d1c8fa7e-8874-45e3-a398-e1fa2322af32„§cell_idÙ$d1c8fa7e-8874-45e3-a398-e1fa2322af32¤codeÙ7md"## Vérifiez qu'il n'y a pas de fuites de mémoires"¨metadataƒ©show_logsèdisabled®skip_as_script«code_foldedÃÙ$35ad233c-a500-461a-af82-855d56792841„§cell_idÙ$35ad233c-a500-461a-af82-855d56792841¤code±Pkg.activate(".")¨metadataƒ©show_logsèdisabled®skip_as_script«code_foldedÂÙ$b0efbf09-53d7-40b2-af63-49f794336e9f„§cell_idÙ$b0efbf09-53d7-40b2-af63-49f794336e9f¤codeÙÎaside( 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, )¨metadataƒ©show_logsèdisabled®skip_as_script«code_foldedÃÙ$e3053cb5-186d-4c98-86c7-609be4a7c8dc„§cell_idÙ$e3053cb5-186d-4c98-86c7-609be4a7c8dc¤codeÙ|compile_and_run(out_of_bounds, valgrind = false, verbose = true, cflags = ["-Wno-array-bounds", "-fsanitize=address", "-g"])¨metadataƒ©show_logsèdisabled®skip_as_script«code_foldedÃÙ$b3f5afd5-3bcc-44ed-8e35-104a3a7c3378„§cell_idÙ$b3f5afd5-3bcc-44ed-8e35-104a3a7c3378¤code¼md"## Exemple avec sanitize"¨metadataƒ©show_logsèdisabled®skip_as_script«code_foldedÃÙ$ee9648f2-bd69-4bf4-b95b-cc3fc2bf5b60„§cell_idÙ$ee9648f2-bd69-4bf4-b95b-cc3fc2bf5b60¤codeÚ„md""" * 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. """¨metadataƒ©show_logsèdisabled®skip_as_script«code_foldedÃÙ$10e3b9fb-fe77-4106-a512-74f4d7d0cfbb„§cell_idÙ$10e3b9fb-fe77-4106-a512-74f4d7d0cfbb¤codeÙMusing Luxor, PlutoUI, PlutoUI.ExperimentalLayout, MyUtils, PlutoTeachingTools¨metadataƒ©show_logsèdisabled®skip_as_script«code_foldedÃÙ$d50aa7f3-9c15-412e-82c2-f870aab8ffb0„§cell_idÙ$d50aa7f3-9c15-412e-82c2-f870aab8ffb0¤codeÙ+out_of_bounds = Example("out_of_bounds.c");¨metadataƒ©show_logsèdisabled®skip_as_script«code_foldedÃÙ$52ddb3b6-0f88-4596-a480-d4d17489292c„§cell_idÙ$52ddb3b6-0f88-4596-a480-d4d17489292c¤codeÙËmd""" 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/) """¨metadataƒ©show_logsèdisabled®skip_as_script«code_foldedÃÙ$6764ba72-95ec-4f3b-ac10-4e7e1b2bcf3b„§cell_idÙ$6764ba72-95ec-4f3b-ac10-4e7e1b2bcf3b¤code¼md"## Clarifications projet"¨metadataƒ©show_logsèdisabled®skip_as_script«code_foldedÃÙ$5892921c-b019-418c-ba01-3d7a4e4697b3„§cell_idÙ$5892921c-b019-418c-ba01-3d7a4e4697b3¤codeÚNmd""" 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] > ``` """¨metadataƒ©show_logsèdisabled®skip_as_script«code_foldedÃÙ$18e1147f-ef60-4368-819b-4e41c1b904df„§cell_idÙ$18e1147f-ef60-4368-819b-4e41c1b904df¤codeÙahtml"

The End

"¨metadataƒ©show_logsèdisabled®skip_as_script«code_foldedÃÙ$9afe0855-162f-4234-8001-610e08e39bb0„§cell_idÙ$9afe0855-162f-4234-8001-610e08e39bb0¤codeÚŒmd""" * 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! """¨metadataƒ©show_logsèdisabled®skip_as_script«code_foldedÃÙ$7a9a1afc-16a3-11f0-2474-67fc85a76676„§cell_idÙ$7a9a1afc-16a3-11f0-2474-67fc85a76676¤codeÙMheader("LEPL1503/LSINC1503 - Cours 5", "O. Bonaventure, B. Legat, M. Baerts")¨metadataƒ©show_logsèdisabled®skip_as_script«code_foldedÃÙ$ff911f08-d9a3-41f3-8e8d-c8e94fecacf0„§cell_idÙ$ff911f08-d9a3-41f3-8e8d-c8e94fecacf0¤codeÙfcompile_and_run(out_of_bounds, valgrind = false, verbose = true, cflags = ["-Wno-array-bounds", "-g"])¨metadataƒ©show_logsèdisabled®skip_as_script«code_foldedÃÙ$3b928e29-a281-4dc2-9429-41e7d98dad54„§cell_idÙ$3b928e29-a281-4dc2-9429-41e7d98dad54¤code¼md"## Exemple sans sanitize"¨metadataƒ©show_logsèdisabled®skip_as_script«code_foldedÃÙ$47f92d66-0834-4f8d-9bdf-172c55e93cce„§cell_idÙ$47f92d66-0834-4f8d-9bdf-172c55e93cce¤codeªimport Pkg¨metadataƒ©show_logsèdisabled®skip_as_script«code_foldedÂÙ$dfb72971-ccf6-46ec-b686-37e071bd9598„§cell_idÙ$dfb72971-ccf6-46ec-b686-37e071bd9598¤code½md"## Interface par fichiers"¨metadataƒ©show_logsèdisabled®skip_as_script«code_foldedÃÙ$d16d02fb-ad22-4886-aecc-42fc3a9bc2d8„§cell_idÙ$d16d02fb-ad22-4886-aecc-42fc3a9bc2d8¤codeÙgcompile_and_run(valgrind, valgrind = true, verbose = true, cflags = valgrind_debug ? ["-g"] : String[])¨metadataƒ©show_logsèdisabled®skip_as_script«code_foldedÂÙ$9e9a0b57-30ce-4c9c-b0f5-a111f692d13f„§cell_idÙ$9e9a0b57-30ce-4c9c-b0f5-a111f692d13f¤code°md"## Debugging"¨metadataƒ©show_logsèdisabled®skip_as_script«code_foldedÃÙ$d87d73d9-d9d8-46e9-9599-0daa7fa95e9c„§cell_idÙ$d87d73d9-d9d8-46e9-9599-0daa7fa95e9c¤codeÙ(md"## Chacun doit contribuer sur le Git"¨metadataƒ©show_logsèdisabled®skip_as_script«code_foldedÃÙ$a843fc18-5290-414a-a5db-dacd4ac88f1d„§cell_idÙ$a843fc18-5290-414a-a5db-dacd4ac88f1d¤code±Pkg.instantiate()¨metadataƒ©show_logsèdisabled®skip_as_script«code_foldedÃÙ$4790109e-06b0-4518-a95f-ed9ca8b5f595„§cell_idÙ$4790109e-06b0-4518-a95f-ed9ca8b5f595¤codeÙ!valgrind = Example("valgrind.c");¨metadataƒ©show_logsèdisabled®skip_as_script«code_foldedÃÙ$810cdd19-7e3f-4cf4-a337-d9c1244e96ce„§cell_idÙ$810cdd19-7e3f-4cf4-a337-d9c1244e96ce¤codeÚwmd""" * 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. """¨metadataƒ©show_logsèdisabled®skip_as_script«code_foldedënotebook_idÙ$02d19e3e-9184-11f1-95f4-6d0947d6241d¥bonds€¬cell_resultsÞÙ$d1c8fa7e-8874-45e3-a398-e1fa2322af32Цqueued¤logs�§running¦output†¤bodyÙœ

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

°persist_js_state¤mime©text/html²last_run_timestampËAÚ�{†öà·has_pluto_hook_features¬rootassigneeÀ§cell_idÙ$d1c8fa7e-8874-45e3-a398-e1fa2322af32¹depends_on_disabled_cells§runtimeÎøËµpublished_object_keys�¸depends_on_skipped_cells§erroredÂÙ$35ad233c-a500-461a-af82-855d56792841Цqueued¤logs‘ˆ¤lineÿ£msg’ÙO Activating project at `~/work/LEPL1503/LEPL1503/Lectures` ªtext/plain§cell_idÙ$35ad233c-a500-461a-af82-855d56792841¦kwargs�¢id´PlutoRunner_d1acb81e¤fileÙP/home/runner/.julia/packages/Pluto/CBqeh/src/runner/PlutoRunner/src/io/stdout.jl¥group¦stdout¥level®LogLevel(-555)§running¦output†¤body °persist_js_state¤mimeªtext/plain²last_run_timestampËAÚ�€l3 ·has_pluto_hook_features¬rootassigneeÀ§cell_idÙ$35ad233c-a500-461a-af82-855d56792841¹depends_on_disabled_cells§runtimeÎ µ­µpublished_object_keys�¸depends_on_skipped_cells§erroredÂÙ$b0efbf09-53d7-40b2-af63-49f794336e9fЦqueued¤logs�§running¦output†¤bodyÚ °persist_js_state¤mime©text/html²last_run_timestampËAÚ��¯«·has_pluto_hook_features¬rootassigneeÀ§cell_idÙ$b0efbf09-53d7-40b2-af63-49f794336e9f¹depends_on_disabled_cells§runtimeÎ LÝwµpublished_object_keys�¸depends_on_skipped_cells§erroredÂÙ$e3053cb5-186d-4c98-86c7-609be4a7c8dcЦqueued¤logs”ˆ¤lineÿ£msg’Ù´Compiling : `/home/runner/.julia/artifacts/207eb5b8330e24674fe59b50d72f4b3d946219c8/tools/clang -Wno-array-bounds -fsanitize=address -g /tmp/jl_XL8R4T/main.c -o /tmp/jl_XL8R4T/bin`ªtext/plain§cell_idÙ$e3053cb5-186d-4c98-86c7-609be4a7c8dc¦kwargs�¢id°MyUtils_6794ab28¤fileÙA/home/runner/work/LEPL1503/LEPL1503/Lectures/MyUtils/src/clang.jl¥group¥clang¥level¤Infoˆ¤lineÿ£msg’¾Running : `/tmp/jl_XL8R4T/bin`ªtext/plain§cell_idÙ$e3053cb5-186d-4c98-86c7-609be4a7c8dc¦kwargs�¢id°MyUtils_0f723ef4¤fileÙA/home/runner/work/LEPL1503/LEPL1503/Lectures/MyUtils/src/clang.jl¥group¥clang¥level¤Infoˆ¤lineÿ£msg’¶ProcessFailedExceptionªtext/plain§cell_idÙ$e3053cb5-186d-4c98-86c7-609be4a7c8dc¦kwargs�¢id°MyUtils_18a9260c¤fileÙA/home/runner/work/LEPL1503/LEPL1503/Lectures/MyUtils/src/clang.jl¥group¥clang¥level¤Warnˆ¤lineÿ£msg’Ú Î================================================================= ==11639==ERROR: AddressSanitizer: stack-buffer-overflow on address 0x7f846d20002c at pc 0x55ed1d26bbca bp 0x7ffd790bfbd0 sp 0x7ffd790bfbc8 WRITE of size 4 at 0x7f846d20002c thread T0 #0 0x55ed1d26bbc9 (/tmp/jl_XL8R4T/bin+0x162bc9) #1 0x7f846f22a1c9 (/lib/x86_64-linux-gnu/libc.so.6+0x2a1c9) (BuildId: 328820b908de8ea1ef79afa8995e302e819163d7) #2 0x7f846f22a28a (/lib/x86_64-linux-gnu/libc.so.6+0x2a28a) (BuildId: 328820b908de8ea1ef79afa8995e302e819163d7) #3 0x55ed1d1343f4 (/tmp/jl_XL8R4T/bin+0x2b3f4) Address 0x7f846d20002c is located in stack of thread T0 at offset 44 in frame #0 0x55ed1d26baaf (/tmp/jl_XL8R4T/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_XL8R4T/bin+0x162bc9) Shadow bytes around the buggy address: 0x7f846d1ffd80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x7f846d1ffe00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x7f846d1ffe80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x7f846d1fff00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x7f846d1fff80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 =>0x7f846d200000: f1 f1 f1 f1 04[f2]00 f3 f3 f3 f3 f3 00 00 00 00 0x7f846d200080: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x7f846d200100: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x7f846d200180: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x7f846d200200: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x7f846d200280: 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 ==11639==ABORTING ªtext/plain§cell_idÙ$e3053cb5-186d-4c98-86c7-609be4a7c8dc¦kwargs�¢id´PlutoRunner_d1acb81e¤fileÙP/home/runner/.julia/packages/Pluto/CBqeh/src/runner/PlutoRunner/src/io/stdout.jl¥group¦stdout¥level®LogLevel(-555)§running¦output†¤bodyÚÓ
#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;
}
°persist_js_state¤mime©text/html²last_run_timestampËAÚ�‚N63·has_pluto_hook_features¬rootassigneeÀ§cell_idÙ$e3053cb5-186d-4c98-86c7-609be4a7c8dc¹depends_on_disabled_cells§runtimeΖ#Iµpublished_object_keys�¸depends_on_skipped_cells§erroredÂÙ$b3f5afd5-3bcc-44ed-8e35-104a3a7c3378Цqueued¤logs�§running¦output†¤bodyÙV

Exemple avec sanitize

°persist_js_state¤mime©text/html²last_run_timestampËAÚ�{•‹i·has_pluto_hook_features¬rootassigneeÀ§cell_idÙ$b3f5afd5-3bcc-44ed-8e35-104a3a7c3378¹depends_on_disabled_cells§runtimeÎß˵published_object_keys�¸depends_on_skipped_cells§erroredÂÙ$ee9648f2-bd69-4bf4-b95b-cc3fc2bf5b60Цqueued¤logs�§running¦output†¤bodyÚ
°persist_js_state¤mime©text/html²last_run_timestampËAÚ�{†Ü·has_pluto_hook_features¬rootassigneeÀ§cell_idÙ$ee9648f2-bd69-4bf4-b95b-cc3fc2bf5b60¹depends_on_disabled_cells§runtimeÎqµpublished_object_keys�¸depends_on_skipped_cells§erroredÂÙ$10e3b9fb-fe77-4106-a512-74f4d7d0cfbbЦqueued¤logs�§running¦output†¤body °persist_js_state¤mimeªtext/plain²last_run_timestampËAÚ�€¤^ú·has_pluto_hook_features¬rootassigneeÀ§cell_idÙ$10e3b9fb-fe77-4106-a512-74f4d7d0cfbb¹depends_on_disabled_cells§runtimeÎ(x¹Íµpublished_object_keys�¸depends_on_skipped_cells§erroredÂÙ$d50aa7f3-9c15-412e-82c2-f870aab8ffb0Цqueued¤logs�§running¦output†¤body °persist_js_state¤mimeªtext/plain²last_run_timestampËAÚ�‚7Š·has_pluto_hook_features¬rootassigneeÀ§cell_idÙ$d50aa7f3-9c15-412e-82c2-f870aab8ffb0¹depends_on_disabled_cells§runtimeÍEǵpublished_object_keys�¸depends_on_skipped_cells§erroredÂÙ$52ddb3b6-0f88-4596-a480-d4d17489292cЦqueued¤logs�§running¦output†¤bodyÛlB

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

°persist_js_state¤mime©text/html²last_run_timestampËAÚ��ˆ6Û·has_pluto_hook_features¬rootassigneeÀ§cell_idÙ$52ddb3b6-0f88-4596-a480-d4d17489292c¹depends_on_disabled_cells§runtimeÎ ?òÙµpublished_object_keys�¸depends_on_skipped_cells§erroredÂÙ$6764ba72-95ec-4f3b-ac10-4e7e1b2bcf3bЦqueued¤logs�§running¦output†¤bodyÙV

Clarifications projet

°persist_js_state¤mime©text/html²last_run_timestampËAÚ�{Ý�·has_pluto_hook_features¬rootassigneeÀ§cell_idÙ$6764ba72-95ec-4f3b-ac10-4e7e1b2bcf3b¹depends_on_disabled_cells§runtimeΰ“µpublished_object_keys�¸depends_on_skipped_cells§erroredÂÙ$5892921c-b019-418c-ba01-3d7a4e4697b3Цqueued¤logs�§running¦output†¤bodyÚ'

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]
°persist_js_state¤mime©text/html²last_run_timestampËAÚ�{”íF·has_pluto_hook_features¬rootassigneeÀ§cell_idÙ$5892921c-b019-418c-ba01-3d7a4e4697b3¹depends_on_disabled_cells§runtimeκœµpublished_object_keys�¸depends_on_skipped_cells§erroredÂÙ$18e1147f-ef60-4368-819b-4e41c1b904dfЦqueued¤logs�§running¦output†¤bodyÙY

The End

°persist_js_state¤mime©text/html²last_run_timestampËAÚ�{žÞ·has_pluto_hook_features¬rootassigneeÀ§cell_idÙ$18e1147f-ef60-4368-819b-4e41c1b904df¹depends_on_disabled_cells§runtimeÎd!õµpublished_object_keys�¸depends_on_skipped_cells§erroredÂÙ$9afe0855-162f-4234-8001-610e08e39bb0Цqueued¤logs�§running¦output†¤bodyÚà
°persist_js_state¤mime©text/html²last_run_timestampËAÚ�{•V·has_pluto_hook_features¬rootassigneeÀ§cell_idÙ$9afe0855-162f-4234-8001-610e08e39bb0¹depends_on_disabled_cells§runtimeÎ>µpublished_object_keys�¸depends_on_skipped_cells§erroredÂÙ$7a9a1afc-16a3-11f0-2474-67fc85a76676Цqueued¤logs�§running¦output†¤bodyÚVF

LEPL1503/LSINC1503 - Cours 5

O. Bonaventure, B. Legat, M. Baerts

      °persist_js_state¤mime©text/html²last_run_timestampËAÚ��;,·has_pluto_hook_features¬rootassigneeÀ§cell_idÙ$7a9a1afc-16a3-11f0-2474-67fc85a76676¹depends_on_disabled_cells§runtimeÎmÁWµpublished_object_keys�¸depends_on_skipped_cells§erroredÂÙ$ff911f08-d9a3-41f3-8e8d-c8e94fecacf0Цqueued¤logs“ˆ¤lineÿ£msg’Ù¡Compiling : `/home/runner/.julia/artifacts/207eb5b8330e24674fe59b50d72f4b3d946219c8/tools/clang -Wno-array-bounds -g /tmp/jl_bIQOXe/main.c -o /tmp/jl_bIQOXe/bin`ªtext/plain§cell_idÙ$ff911f08-d9a3-41f3-8e8d-c8e94fecacf0¦kwargs�¢id°MyUtils_6794ab28¤fileÙA/home/runner/work/LEPL1503/LEPL1503/Lectures/MyUtils/src/clang.jl¥group¥clang¥level¤Infoˆ¤lineÿ£msg’¾Running : `/tmp/jl_bIQOXe/bin`ªtext/plain§cell_idÙ$ff911f08-d9a3-41f3-8e8d-c8e94fecacf0¦kwargs�¢id°MyUtils_0f723ef4¤fileÙA/home/runner/work/LEPL1503/LEPL1503/Lectures/MyUtils/src/clang.jl¥group¥clang¥level¤Infoˆ¤lineÿ£msg’Ù5&i = 0x7ffdfedc3118 &a = 0x7ffdfedc3110 i = -1000000 ªtext/plain§cell_idÙ$ff911f08-d9a3-41f3-8e8d-c8e94fecacf0¦kwargs�¢id´PlutoRunner_d1acb81e¤fileÙP/home/runner/.julia/packages/Pluto/CBqeh/src/runner/PlutoRunner/src/io/stdout.jl¥group¦stdout¥level®LogLevel(-555)§running¦output†¤bodyÚÓ
#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;
}
°persist_js_state¤mime©text/html²last_run_timestampËAÚ�‚;Ö·has_pluto_hook_features¬rootassigneeÀ§cell_idÙ$ff911f08-d9a3-41f3-8e8d-c8e94fecacf0¹depends_on_disabled_cells§runtimeÎô¢‡µpublished_object_keys�¸depends_on_skipped_cells§erroredÂÙ$3b928e29-a281-4dc2-9429-41e7d98dad54Цqueued¤logs�§running¦output†¤bodyÙV

Exemple sans sanitize

°persist_js_state¤mime©text/html²last_run_timestampËAÚ�{•q·has_pluto_hook_features¬rootassigneeÀ§cell_idÙ$3b928e29-a281-4dc2-9429-41e7d98dad54¹depends_on_disabled_cells§runtimeÎG9µpublished_object_keys�¸depends_on_skipped_cells§erroredÂÙ$47f92d66-0834-4f8d-9bdf-172c55e93cceЦqueued¤logs�§running¦output†¤body °persist_js_state¤mimeªtext/plain²last_run_timestampËAÚ�€0}ò·has_pluto_hook_features¬rootassigneeÀ§cell_idÙ$47f92d66-0834-4f8d-9bdf-172c55e93cce¹depends_on_disabled_cells§runtimeΖ«µpublished_object_keys�¸depends_on_skipped_cells§erroredÂÙ$dfb72971-ccf6-46ec-b686-37e071bd9598Цqueued¤logs�§running¦output†¤bodyÙX

Interface par fichiers

°persist_js_state¤mime©text/html²last_run_timestampËAÚ�{‡²·has_pluto_hook_features¬rootassigneeÀ§cell_idÙ$dfb72971-ccf6-46ec-b686-37e071bd9598¹depends_on_disabled_cells§runtimeÎìÒµpublished_object_keys�¸depends_on_skipped_cells§erroredÂÙ$d16d02fb-ad22-4886-aecc-42fc3a9bc2d8Цqueued¤logs“ˆ¤lineÿ£msg’ÙŒCompiling : `/home/runner/.julia/artifacts/207eb5b8330e24674fe59b50d72f4b3d946219c8/tools/clang /tmp/jl_hXEhAg/main.c -o /tmp/jl_hXEhAg/bin`ªtext/plain§cell_idÙ$d16d02fb-ad22-4886-aecc-42fc3a9bc2d8¦kwargs�¢id°MyUtils_6794ab28¤fileÙA/home/runner/work/LEPL1503/LEPL1503/Lectures/MyUtils/src/clang.jl¥group¥clang¥level¤Infoˆ¤lineÿ£msg’Ù'Running : `valgrind /tmp/jl_hXEhAg/bin`ªtext/plain§cell_idÙ$d16d02fb-ad22-4886-aecc-42fc3a9bc2d8¦kwargs�¢id°MyUtils_0f723ef4¤fileÙA/home/runner/work/LEPL1503/LEPL1503/Lectures/MyUtils/src/clang.jl¥group¥clang¥level¤Infoˆ¤lineÿ£msg’Ú8==11631== Memcheck, a memory error detector ==11631== Copyright (C) 2002-2022, and GNU GPL'd, by Julian Seward et al. ==11631== Using Valgrind-3.22.0 and LibVEX; rerun with -h for copyright info ==11631== Command: /tmp/jl_hXEhAg/bin ==11631== ==11631== Invalid write of size 4 ==11631== at 0x10915A: f (in /tmp/jl_hXEhAg/bin) ==11631== by 0x109183: main (in /tmp/jl_hXEhAg/bin) ==11631== Address 0x4a79068 is 0 bytes after a block of size 40 alloc'd ==11631== at 0x4846828: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so) ==11631== by 0x109151: f (in /tmp/jl_hXEhAg/bin) ==11631== by 0x109183: main (in /tmp/jl_hXEhAg/bin) ==11631== ==11631== ==11631== HEAP SUMMARY: ==11631== in use at exit: 40 bytes in 1 blocks ==11631== total heap usage: 1 allocs, 0 frees, 40 bytes allocated ==11631== ==11631== LEAK SUMMARY: ==11631== definitely lost: 40 bytes in 1 blocks ==11631== indirectly lost: 0 bytes in 0 blocks ==11631== possibly lost: 0 bytes in 0 blocks ==11631== still reachable: 0 bytes in 0 blocks ==11631== suppressed: 0 bytes in 0 blocks ==11631== Rerun with --leak-check=full to see details of leaked memory ==11631== ==11631== For lists of detected and suppressed errors, rerun with: -s ==11631== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0) ªtext/plain§cell_idÙ$d16d02fb-ad22-4886-aecc-42fc3a9bc2d8¦kwargs�¢id´PlutoRunner_d1acb81e¤fileÙP/home/runner/.julia/packages/Pluto/CBqeh/src/runner/PlutoRunner/src/io/stdout.jl¥group¦stdout¥level®LogLevel(-555)§running¦output†¤bodyÚ¤
#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
°persist_js_state¤mime©text/html²last_run_timestampËAÚ�‚6z5·has_pluto_hook_features¬rootassigneeÀ§cell_idÙ$d16d02fb-ad22-4886-aecc-42fc3a9bc2d8¹depends_on_disabled_cells§runtimeÎOB¢µpublished_object_keys�¸depends_on_skipped_cells§erroredÂÙ$9e9a0b57-30ce-4c9c-b0f5-a111f692d13fЦqueued¤logs�§running¦output†¤bodyÙ>

Debugging

°persist_js_state¤mime©text/html²last_run_timestampËAÚ�{•V·has_pluto_hook_features¬rootassigneeÀ§cell_idÙ$9e9a0b57-30ce-4c9c-b0f5-a111f692d13f¹depends_on_disabled_cells§runtimeÎ@µpublished_object_keys�¸depends_on_skipped_cells§erroredÂÙ$d87d73d9-d9d8-46e9-9599-0daa7fa95e9cЦqueued¤logs�§running¦output†¤bodyÙn

Chacun doit contribuer sur le Git

°persist_js_state¤mime©text/html²last_run_timestampËAÚ�{†¥±·has_pluto_hook_features¬rootassigneeÀ§cell_idÙ$d87d73d9-d9d8-46e9-9599-0daa7fa95e9c¹depends_on_disabled_cells§runtimeÎN µpublished_object_keys�¸depends_on_skipped_cells§erroredÂÙ$a843fc18-5290-414a-a5db-dacd4ac88f1dЦqueued¤logs�§running¦output†¤body °persist_js_state¤mimeªtext/plain²last_run_timestampËAÚ�„�pe·has_pluto_hook_features¬rootassigneeÀ§cell_idÙ$a843fc18-5290-414a-a5db-dacd4ac88f1d¹depends_on_disabled_cells§runtimeÏ ˆ$+µpublished_object_keys�¸depends_on_skipped_cells§erroredÂÙ$4790109e-06b0-4518-a95f-ed9ca8b5f595Цqueued¤logs�§running¦output†¤body °persist_js_state¤mimeªtext/plain²last_run_timestampËAÚ��ÅÍu·has_pluto_hook_features¬rootassigneeÀ§cell_idÙ$4790109e-06b0-4518-a95f-ed9ca8b5f595¹depends_on_disabled_cells§runtimeÍP€µpublished_object_keys�¸depends_on_skipped_cells§erroredÂÙ$810cdd19-7e3f-4cf4-a337-d9c1244e96ceЦqueued¤logs�§running¦output†¤bodyÚô
°persist_js_state¤mime©text/html²last_run_timestampËAÚ�{†‚I·has_pluto_hook_features¬rootassigneeÀ§cell_idÙ$810cdd19-7e3f-4cf4-a337-d9c1244e96ce¹depends_on_disabled_cells§runtimeÎ upµpublished_object_keys�¸depends_on_skipped_cells§errored©shortpath©Cours5.jl®last_save_timeËAÚ�yá§«in_temp_dir¨metadata€