Skip to content

Instantly share code, notes, and snippets.

View chbaker0's full-sized avatar

Collin Baker chbaker0

  • Google
  • New York, NY
View GitHub Profile
@chbaker0
chbaker0 / gist:1f03ead2fcc5faab5ff3788143b8139b
Created July 20, 2022 18:32
assertion backtrace without AST emit
$ rust-gdb --args target/debug/bindgen "./tests/headers/sizeof_dependent_type.hpp" -o "/tmp/bindings.rs.s9U5SH" --rustfmt-bindings --with-derive-default --raw-line '' --raw-line '#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]' --raw-line ''
<...>
bindgen: /usr/local/google/home/collinbaker/llvm-project/clang/lib/AST/ExprConstant.cpp:15224: llvm::APSInt clang::Expr::EvaluateKnownConstInt(const clang::ASTContext&, llvm::SmallVectorImpl<std::pair<clang::SourceLocation, clang::PartialDiagnostic> >*) const: Assertion `!isValueDependent() && "Expression evaluator can't be called on a dependent expression."' failed.
Thread 1 "bindgen" received signal SIGABRT, Aborted.
__GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:49
49 ../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
(gdb) bt
@chbaker0
chbaker0 / gist:c75dd83b78fe9e48af98259db11ed9c0
Created July 20, 2022 18:24
bindgen assertion failure backtrace
$ tests/test-one.sh sizeof_dependent_type
<...>
bindgen: /usr/local/google/home/collinbaker/llvm-project/clang/lib/AST/ExprConstant.cpp:15224: llvm::APSInt clang::Expr::EvaluateKnownConstInt(const clang::ASTContext&, llvm::SmallVectorImpl<std::pair<clang::SourceLocation, clang::PartialDiagnostic> >*) const: Assertion `!isValueDependent() && "Expression evaluator can't be called on a dependent expression."' failed.
tests/test-one.sh: line 51: 258231 Aborted ./target/debug/bindgen "./tests/headers/sizeof_dependent_type.hpp" --emit-ir --emit-ir-graphviz ir.dot --emit-clang-ast -o "/tmp/bindings.rs.s9U5SH" --rustfmt-bindings --with-derive-default --raw-line '' --raw-line '#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)]' --raw-line ''
$ rust-gdb --args target/debug/bindgen "./tests/headers/sizeof_dependent_type.hpp" --emit-ir --emit-ir-graphviz ir.dot --emit-clang-ast -o "/tmp/bindings.rs.s9U5SH" --rustfmt-bindings --with-derive-default --raw-line '' --raw-line
ENTRY(kentry)
KERNEL_BASE = -2048M;
SECTIONS
{
. = KERNEL_BASE + 1M;
.text ALIGN(4K) :
{
ENTRY(_start)
SECTIONS
{
. = 1M;
.init.text : ALIGN(4K)
{
KEEP(*(.multiboot))
*boot.nasm.o(.text)
@chbaker0
chbaker0 / linker.ld
Last active September 11, 2017 15:57
ENTRY(_start)
SECTIONS
{
. = 1M;
.init : ALIGN(4K)
{
*boot.nasm.o(.text)
}

Keybase proof

I hereby claim:

  • I am chbaker0 on github.
  • I am chbaker0 (https://keybase.io/chbaker0) on keybase.
  • I have a public key ASD1IlcKAZC5VKb8ktdUtEqHvsDgMzJaER0qsPjyegljLQo

To claim this, I am signing this object:

@chbaker0
chbaker0 / main.c
Created August 19, 2015 00:46
10141 solution
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
void consume_line()
{
char buf[82];
fgets(buf, sizeof(buf), stdin);
}
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
unsigned long long fib(unsigned long long n)
{
unsigned long long cur = 1;
unsigned long long prev = 0;
for(unsigned long long i = 1; i <= n; ++i)
{