Skip to content

Instantly share code, notes, and snippets.

View fcuny's full-sized avatar
💭
I may be slow to respond.

Franck Cuny fcuny

💭
I may be slow to respond.
View GitHub Profile
@fcuny
fcuny / gist:70b6959eef1892d00197
Created July 12, 2015 01:18
dell-xps-touchpad
mp saved to /sys/class/drm/card0/error
[ 1835.632679] [drm] Enabling RC6 states: RC6 on, RC6p off, RC6pp off
[ 1868.702435] psmouse serio1: TouchPad at isa0060/serio1/input0 lost synchronization, throwing 1
bytes away.
[ 1869.211965] psmouse serio1: resync failed, issuing reconnect request
[ 1876.689924] psmouse serio1: TouchPad at isa0060/serio1/input0 lost synchronization, throwing 1
bytes away.
[ 1877.198899] psmouse serio1: resync failed, issuing reconnect request
[ 1879.545191] psmouse serio1: TouchPad at isa0060/serio1/input0 lost sync at byte 4
[ 1879.546318] psmouse serio1: TouchPad at isa0060/serio1/input0 lost sync at byte 1
@fcuny
fcuny / dmesg
Created July 12, 2015 01:20
Dell XPS13 dmesg
[ 0.000000] Initializing cgroup subsys cpuset
[ 0.000000] Initializing cgroup subsys cpu
[ 0.000000] Initializing cgroup subsys cpuacct
[ 0.000000] Linux version 3.16.0-29-generic (buildd@tipua) (gcc version 4.9.1 (Ubuntu 4.9.1-16ubuntu6) ) #39-Ubuntu SMP Mon Dec 15 22:27:29 UTC 2014 (Ubuntu 3.16.0-29.39-generic 3.16.7-ckt2)
[ 0.000000] Command line: BOOT_IMAGE=/vmlinuz-3.16.0-29-generic.efi.signed root=/dev/mapper/ubuntu--vg-root ro rootflags=subvol=@ quiet splash
[ 0.000000] KERNEL supported cpus:
[ 0.000000] Intel GenuineIntel
[ 0.000000] AMD AuthenticAMD
[ 0.000000] Centaur CentaurHauls
[ 0.000000] e820: BIOS-provided physical RAM map:
@fcuny
fcuny / lspci
Created July 12, 2015 01:21
Dell XPS13 lspci
00:00.0 Host bridge: Intel Corporation Broadwell-U Host Bridge -OPI (rev 09)
Subsystem: Dell Device 0665
Control: I/O- Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx-
Status: Cap+ 66MHz- UDF- FastB2B+ ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort+ >SERR- <PERR- INTx-
Latency: 0
Capabilities: <access denied>
00:02.0 VGA compatible controller: Intel Corporation Broadwell-U Integrated Graphics (rev 09) (prog-if 00 [VGA controller])
Subsystem: Dell Device 0665
Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx+
#include <stdio.h>
int main() {
FILE *fh;
if ((fh = fopen("/etc/issue", "r")) == NULL) {
perror("fopen");
return 1;
}
$ strace ./test
execve("./test", ["./test"], [/* 31 vars */]) = 0
brk(0) = 0x25e0000
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f7f97a24000
access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=33297, ...}) = 0
mmap(NULL, 33297, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f7f97a1b000
close(3) = 0
$ gdb ./test
Reading symbols from ./test...done.
(gdb) break main
Breakpoint 1 at 0x4005c1
(gdb) run
Starting program: /home/fcuny/workspace/tmp/file/test
Breakpoint 1, 0x00000000004005c1 in main ()
(gdb) disassemble
Dump of assembler code for function main:
(gdb) disassemble fopen
Dump of assembler code for function _IO_new_fopen:
0x00007ffff7a82f65 <+5>: jmpq 0x7ffff7a82eb0 <__fopen_internal>
End of assembler dump.
(gdb) disassemble __fopen_internal
Dump of assembler code for function __fopen_internal:
0x00007ffff7a82ec8 <+24>: callq 0x7ffff7a33410 <memalign@plt>
0x00007ffff7a82ef8 <+72>: callq 0x7ffff7a90760 <_IO_no_init>
0x00007ffff7a82f0e <+94>: callq 0x7ffff7a8e640 <_IO_new_file_init>
0x00007ffff7a82f1f <+111>: callq 0x7ffff7a8e920 <_IO_new_file_fopen>
$ stat /etc/issue
File: ‘/etc/issue’
Size: 26 Blocks: 8 IO Block: 4096 regular file
Device: fd01h/64769d Inode: 679618 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 0/ root) Gid: ( 0/ root)
Access: 2014-11-16 20:04:27.655399999 -0800
Modify: 2014-07-22 08:33:52.000000000 -0700
Change: 2014-07-25 08:02:10.698239112 -0700
Birth: -
$ sudo debugfs /dev/vda1
debugfs 1.42.9 (4-Feb-2014)
debugfs: ncheck 679618 # check that the path is correct for that inode
Inode Pathname
679618 /etc/issue
debugfs: stat <679618> # display information for that inode
Inode: 679618 Type: regular Mode: 0644 Flags: 0x80000
Generation: 2438138670 Version: 0x00000000:00000001
$ valgrind --tool=callgrind --simulate-cache=yes ./test
$ callgrind_annotate --auto=yes callgrind.out.11015 test.c
--------------------------------------------------------------------------------
-- User-annotated source: test.c
--------------------------------------------------------------------------------
Ir Dr Dw I1mr D1mr D1mw ILmr DLmr DLmw
. . . . . . . . . #include <stdio.h>
. . . . . . . . .
3 0 1 1 0 0 1 . . int main() {