Skip to content

Instantly share code, notes, and snippets.

View tesuji's full-sized avatar
🦀
...

tesuji

🦀
...
  • D28DBB1A0E26FEDA
View GitHub Profile
# Sample TOML configuration file for building Rust.
changelog-seen = 1
# =============================================================================
# Tweaking how LLVM is compiled
# =============================================================================
[llvm]
# Whether to use Rust CI built LLVM instead of locally building it.
#
@tesuji
tesuji / config.toml.diff
Created April 26, 2020 14:35
config.toml of rustc
--- config.toml.example 2020-04-25 15:21:35.799043057 +0000
+++ config.toml 2020-04-25 16:03:27.412416851 +0000
@@ -36,7 +36,7 @@
#assertions = false
# Indicates whether ccache is used when building LLVM
-#ccache = false
+ccache = true
# or alternatively ...
#ccache = "/path/to/ccache"
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@tesuji
tesuji / request2size.c
Last active November 5, 2019 10:06
glibc 2.29
//! from glibc-2.29
#include <stdio.h>
#include <stdlib.h>
#define INTERNAL_SIZE_T size_t
#define SIZE_SZ sizeof(INTERNAL_SIZE_T)
struct malloc_chunk {
INTERNAL_SIZE_T mchunk_prev_size; /* Size of previous chunk (if free). */
INTERNAL_SIZE_T mchunk_size; /* Size in bytes, including overhead. */
use std::env;
use std::mem::size_of;
const SIZE_SZ: usize = size_of::<usize>();
#[repr(C)]
struct malloc_chunk {
mchunk_prev_size: usize, /* Size of previous chunk (if free). */
mchunk_size: usize, /* Size in bytes, including overhead. */
fd: *mut malloc_chunk, /* double links -- used only if free. */
% git status -s
## tidy-lldb...origin/tidy-lldb
% CARGO_LOG=cargo::core::compiler::fingerprint=info ./x.py test --stage 1 src/test/ui
Updating only changed submodules
Submodules updated in 0.06 seconds
Finished dev [unoptimized] target(s) in 0.23s
Building stage0 std artifacts (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
Finished release [optimized] target(s) in 0.27s
Copying stage0 std from stage0 (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu / x86_64-unknown-linux-gnu)
Building stage0 test artifacts (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
@tesuji
tesuji / shellcode.md
Last active May 31, 2019 13:51
Shellcoding for Linux and Windows Tutorial
title Shellcoding for Linux and Windows Tutorial
description Shellcoding for Linux and Windows Tutorial with example windows and linux shellcode
source http://www.vividmachines.com/shellcode/shellcode.html

Shellcoding for Linux and Windows Tutorial

Table of Contents

<!DOCTYPE html>
<html>
<head>
<title>Testing TOML syntax highlighting</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.15.6/styles/default.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.15.6/highlight.min.js"></script>
<script>hljs.initHighlightingOnLoad();</script>
<link href="prism.css" rel="stylesheet" />
<script src="prism.js"></script>
@tesuji
tesuji / build-clang.sh
Last active August 31, 2020 05:47
Install clang-10
#!/usr/bin/env bash
set -ex
MY_PREFIX="${DEFAULT_PREFIX:-${HOME}/.local}"
LLVM_TAG=llvmorg-10.0.1
mkdir llvm-project && cd $_
curl -L "https://github.com/llvm/llvm-project/archive/${LLVM_TAG}.tar.gz" \

With rustgdb:

(gdb) x/75i drop::main 
   0x7d90 <drop::main>:	sub    rsp,0xa8
   0x7d97 <drop::main+7>:	lea    rax,[rip+0x4bc0a]        # 0x539a8
   0x7d9e <drop::main+14>:	mov    ecx,0x8
   0x7da3 <drop::main+19>:	mov    edx,ecx
   0x7da5 <drop::main+21>:	lea    rdi,[rsp+0x18]
   0x7daa <drop::main+26>:	mov    rsi,rax
   0x7dad <drop::main+29>:	call   0xa760 <<alloc::string::String as core::convert::From<&'a str>>::from>