Skip to content

Instantly share code, notes, and snippets.

View mikesart's full-sized avatar

Michael Sartain mikesart

  • Journalytic
  • Colorado Springs
View GitHub Profile
@mikesart
mikesart / gist:6467648
Created September 6, 2013 18:10
simple pthread sample app
/*
* pthread example test app for lldb, from Michael Sartain's post at
* http://linux-debugger-bits.blogspot.com/2013/07/linux-pthread-test-app-with-lldb.html
*
* clang -Wall -g -o mikesart_pthread -lpthread mikesart_pthread.c
*/
#include <stdio.h>
#include <string.h>
#include <pthread.h>
@mikesart
mikesart / gist:6832418
Last active January 30, 2023 04:58
SSE/AVX/MMX test code
// Output from my cmake VERBOSE=1 command for building:
// c++ -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGE_FILES -march=native -g -O0 -std=c++0x -g -o sse.cpp.o -c sse.cpp
// c++ -march=native -g -O0 -std=c++0x -g sse.cpp.o -o sse -rdynamic -ldl -lpthread
// SSE
//
#include <stdio.h>
#include <stdlib.h>
// #include <mmintrin.h> // MMX
@mikesart
mikesart / gist:7143615
Created October 24, 2013 19:37
diff to get busybox 1.13 stable building on my Ubuntu 64-bit 12.04 machine with gcc 4.8.
diff --git a/include/libbb.h b/include/libbb.h
index 08fed90..ee166c2 100644
--- a/include/libbb.h
+++ b/include/libbb.h
@@ -89,6 +89,7 @@ int klogctl(int type, char *b, int len);
char *dirname(char *path);
/* Include our own copy of struct sysinfo to avoid binary compatibility
* problems with Linux 2.4, which changed things. Grumble, grumble. */
+#if 0
struct sysinfo {
@mikesart
mikesart / gist:7218195
Created October 29, 2013 16:40
apt-get shell script that checks compiler version. Might be useful to safe yourself from breaking kernel modules that won't compile.
#!/bin/sh
gcc_version_check_func()
{
CFILE="$(mktemp)"-gcc-version-check.c
grep -A 9999 "^// PAYLOAD$" "$0" > $CFILE
rm -f gcc-version-check
gcc "$CFILE" -o gcc-version-check > /dev/null 2>&1
diff --git a/external/libunwind/include/tdep-aarch64/libunwind_i.h b/external/libunwind/include/tdep-aarch64/libunwind_i.h
index b162271..a03fbc4 100644
--- a/external/libunwind/include/tdep-aarch64/libunwind_i.h
+++ b/external/libunwind/include/tdep-aarch64/libunwind_i.h
@@ -255,7 +255,7 @@ dwarf_put (struct dwarf_cursor *c, dwarf_loc_t loc, unw_word_t val)
#define tdep_cache_frame(c,rs) do {} while(0)
#define tdep_reuse_frame(c,rs) do {} while(0)
#define tdep_stash_frame(c,rs) do {} while(0)
-#define tdep_trace(cur,addr,n) (-UNW_ENOINFO)
+#define tdep_trace(cur,addr,n,skip) (-UNW_ENOINFO)
@mikesart
mikesart / clock_overhead.c
Created January 29, 2014 17:23
clock overhead blurb
// clock_overhead
// (code started from http://stackoverflow.com/questions/6814792/why-is-clock-gettime-so-erratic)
#include <time.h>
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <inttypes.h>
/* Compiled & executed with:
gcc clock_overhead.c -O0 -lrt -o clock_overhead
@mikesart
mikesart / gist:11274126
Last active August 29, 2015 14:00
Debugging Bash with Symbols vs. without
mikesart@mikesart-petra:~/dev/voglproj/vogl_chroot/vogl (vMcJohn-master)$ gdb --args /bin/bash
GNU gdb (GDB) 7.6.1-ubuntu
Source directories searched: /home/mikesart/src/eglibc-2.17/csu:/home/mikesart/src/eglibc-2.17/stdlib:...
Reading symbols from /bin/bash...Reading symbols from /usr/lib/debug/bin/bash...done.
(gdb) b parse_and_execute
Breakpoint 1 at 0x4722a0: file ../../bash/builtins/evalstring.c, line 174.
(gdb) dir ~/src/bash-4.2/bash-4.2/builtins
Source directories searched: /home/mikesart/src/bash-4.2/bash-4.2/builtins:/home/mikesart/src/eglibc-2.17/csu:/home/mikesart/src/eglibc-2.17/stdlib:/home/mikesart/src/eglibc-2.17/nss:/home/mikesart/src/eglibc-2.17/stdio-common:/home/mikesart/src/eglibc-2.17/malloc:/home/mikesart/src/eglibc-2.17/elf:/home/mikesart/src/eglibc-2.17/libio:/home/mikesart/src/eglibc-2.17/sysdeps:$cdir:$cwd
(gdb) r
//-----------------------------------------------------------------------------
// Purpose: Returns bounds of the usable workspace area, including multiple monitors
//-----------------------------------------------------------------------------
void CLinuxSurface::GetWorkspaceBounds( int &x0, int &y0, int &x1, int &y1, VPANEL panel )
{
// Build list of monitors
CUtlVector<XineramaScreenInfo> monitors;
GetMonitorList(monitors);
// Get the bounds of the window we're dealing with.
@mikesart
mikesart / gist:dbee9d3787c409974cd1
Created August 13, 2014 00:37
GDB Python Print not working.
I'm trying to figure out why 'python print "hello"' is giving me invalid syntax.
(gdb) python import gdb
(gdb) python print "hello"
File "<string>", line 1
print "hello"
^
SyntaxError: invalid syntax
Error while executing Python code.
@mikesart
mikesart / gist:b33762363153e2b8c7c7
Created August 27, 2015 17:16
E-mail Date: fields
13 Feb 08 02:15:46
15 Oct 09 16:20:45 EDT ; EDT MSD
02 Jul 2003 01:33 GMT
2 Aug 2006 19:09:11 GMT
19 Oct 05 20:59 -0800
13 Oct 12 02:12:41 +0200
Fri, 8 Mar 2002 21:29:44
03 Apr 2008 12:36:15 PDT ; PDT PST GMT
Fri Apr 06 12:37:39 2007
1-Apr-1997 07:46:20 -0700