2014年6月20日
摘要: 检查宏定义
WIN32
_DEBUG
_WINDOWS
_USRDLL
阅读全文
GDB笔记
概览
基础
用户态会话
调试模式
3种调试已有进程
gdb exe
.
gdb –args exe [args]
.
gdb
file exe
run [args]
.
gdb –args gcc a.c -o a
命令行参数
show args
set args 多次运行设置命令行参数
环境变量和执行路径
path directory
.
show paths
.
show environment [varname]
.
set environment varname[=value] 清除或者设置环境变量
工作目录
继承进入gdb工作目录
改变工作目录
cd dirctory
显示路径
pwd
输入输出
info terminal
run > a.txt
tty /dev/ttyb
远程调试可用这些辅助。
inferior 下层 多个进程调试
inferior gdb维护的一系列对象,每个inf对应一个调试目标进程。
info inferior 显示下层信息
NULL 程序没有跑或者已经终止
clone-inferior -copies 2 复制当前下层2份
(gdb) info inferiors
Num Description Executable
* 1 process 10087 /home/gao/code/a
(gdb) clone-inferior -copies 2
Added inferior 2.
Added inferior 3.
(gdb) info inferiors
Num Description Executable
3 程序没有跑或者已经终止 /home/gao/code/a
2 /home/gao/code/a
* 1 process 10087 /home/gao/code/a
(gdb)
切换下程
inferior 2 切换2这个下程。
进程号是0,没开始运行。
run 运行起来。
.
增加一个运行下层
add-inferior -exec executeable 增加一个运行下层
比如说调试一个服务端程序,一个客户端程序。
remove-inferior n 删掉一个下层
detach inferior 继续运行 quit
kill inferior 调试进程退了,但是inferior纪录还在。
Tab 帮助
(gdb) remove-
remove-inferiors remove-symbol-file
(gdb) remove-
remove-inferiors remove-symbol-file
(gdb) remove-
file 命令
file a.exe 可自行文件和符号文件是一个文件
可自行文件和符号文件分开
exec-file 指定目标文件
.
symbol-file 指定符号文件
run 开始运行
可以支持 run > >> < 重定向
set args 清理命令行参数
附加到进程
gdb –pid= pid
attach pid
终止调试进程
detach pid 分离进程继续运行
.
quit 进程退出
.
q
ctrl
+ D
执行控制
断点
软件断点
break 普通
tbreak 一次性
rbreak 正则表达式一批断点
- 基于cpu断点指令,x86 int3机器码0xcc。
- 替换断点位置的指令
- CPU自执行这里触发断点异常。
- 没有断点数量限制。
硬件断点
- 基于cpu调试寄存器,dr0~dr7,数量限制。x86可以设定4个断点。数量限制。
- 不修改代码,在只读内存上设置断点。EEPROM上的代码设置。
- 有数量限制。
location
- 行号
- -/+ 偏移
- 文件名 :行号
- 函数名
- 函数:标号
- 文件名:函数
标号
- -source linename
- -function function
- -label label
-line number
- address location
break * address
实践
file banner
b main 中断在main函数
info funciton useage 显示useage函数地址
info *0x88888e4 直接写地址设定断点
info b 显示所有断点
list usage 显示useage函数
b line.c:11
b +2 当前显示到14行+2行所以设定在17行
虚拟机设定硬件断点会失败.
(gdb)hbreak hd_ioctl
(gdb) info b
物理机可以设定.
(gdb) hbreak v
Hardware assisted breakpoint 2 at 0x40053a: v. (2 locations)
(gdb) info b
Num Type Disp Enb Address What
1 breakpoint keep y
breakpoint already hit 1 time
1.1 y 0x000000000040054f in main at a.c:10 inf 1
1.2 y 0x000000000040054f in main at a.c:10 inf 2
2 hw breakpoint keep y
2.1 y 0x000000000040053a in v at a.c:4 inf 1
2.2 y 0x000000000040053a in v at a.c:4 inf 2
(gdb)
管理断点
info b 显示断点
delete 1 删除
disable 1
enable 1
delete 删除所有的断点
clear sum 删除sum函数入口的所有断点
扩展断点
watchpoint 监视一个表达式,值变化中断。
watch a*b+c/d
watch *( int * )
watch fd 监控局部变量fd
c 继续运行
info b //
注意,x86硬件调试,写操作,执行过这一行,gdb显示下一行,要看上一行。hw watchpoint,在x86平台wachtpoint基于硬件实现,其他平台可能是基于软件实现。 vc6纯软件执行,执行目标速度低。
执行位置超过当前区域,无效监视点会被删除。
访问监视点
rwatch 读停下来。
awatch 读或写停下来。 awatch fd
watch -l
b hd_ioctl thread 1
info threads 带* 当前线程
繁忙函数解决方案
b hd_ioctl thread 1 if fd > 0
当断点,断了后执行命令
()command 12
()silent
()print “fd is %d\n”,fd
()continue
()end
动态ping不修改代码。
tracepoint 远程主机通讯调试,前端stub立刻恢复执行,但会记录下来。
catchpoint
执行控制
进入子函数内部。单步 step
汇编 stepi
stepi 4
类似nexti
不要进入子函数
next
继续执行
continue
跑起来直到3号断点命中
until 3
跑起来直到3号断点命中,快捷禁止其他断点。
恢复执行直到函数返回。
finish
调用函数!
gdb 杜撰代码调用函数。
call sum(1,2) …
强制返回
强制main函数 return。
return 1
触发中断
异常或断点进入调试器。
调试器发起中断,让程序中断下来。ctrl+C,app收到中断信号,进入调试器。
符号
调试器读区 调试符号。
二进制-调试符号-源码
linux dwarf 存储调试符号信息。gcc
readelf -h filename
里面如果有line location debug标示
readelf -w 导出调试文件
gcc -g 才能输出符号
ubuntu 符号服务器
< ddebs.ubuntu.com/pool/main/>
分离操作
strip
安装ubunte的linux 内核符号
https://askubuntu.com/questions/197016/how-to-install-a-package-that-contains-ubuntu-kernel-debug-symbols
安装libc符号
dpkg -s /lib/x86_64-linux-gun/libc-2.15.so
dpkg -s libc.so.6
sudo apt-get -c aptproxy.conf install libc6-dbg
libc 调试符号
sudo apt-get install libc6-dbg
符号路径
gdb 使用file 或 symbol-file 加载符号文件
自动搜索 path 路径
(gdb)i share
* 共享库没调试信息
搜索符号
info vaiables regex 类名/函数名/变量名
内存地址与符号互换
info addriess 函数名
info symbol 地址
(gdb) info address main
Symbol “main” is a function at address 0x400547.
(gdb) info symbol 0x400547
main in section .text of /home/gao/code/a
.
info os
查看加载的文件内存位置
info files
列出全局变量
info variable
info va
显示源码
list
list -
dir 源码路径
show dir
常用命令源码
安装系统工具源码和调试
apt-get source coreutils
sudo apt-get install coreutils-dbgsym
gdb /bin/ls
list main
dir ~/src/coreutils-7.4/src
list main
libc
sudo apt-get source libc6-dev
/home/ge/eglibc-2.15
dir 搜索路径 :分割
$cdir 编译路径
cwd 当前工作路径
查看调试目标
观察寄存器
info reg
栈
子函数返回地址
函数参数
局部变量
bt n 观察函数返回地址
frame n 切换栈帧
up n
down n
info frame [address]
info args
info locals
注意,切换栈帧之后可能会发生,本地变量值不准确,因为值存在寄存器中需要小心。
观察内存
print
p /f 表达式 表达式要打印位置
xduotcf
x
x /Nuf
N 打印几个单元
u 每个单元大小 b-1byte w-2byte h-4byte g-8byte
f s字符串i指令格式
x/s 0xfffff81946000 打印字符串
x /32bx arg bit 16禁制
(gdb) x /32bx &i
0x7fffffffc76c: 0x01 0x00 0x00 0x00 0x70 0x05 0x40 0x00
0x7fffffffc774: 0x00 0x00 0x00 0x00 0x40 0xfa 0xa2 0xf7
0x7fffffffc77c: 0xff 0x7f 0x00 0x00 0x58 0xc8 0xff 0xff
0x7fffffffc784: 0xff 0x7f 0x00 0x00 0x58 0xc8 0xff 0xff
(gdb)
p arg[0]
p arg[i]
p *&a[0]@10 a0数组开始的10个元素
反汇编
disas main main反汇编代码
x/5i schedule 这个地址开始的5条汇编指令。
gdb mov 从左往右赋值at&t汇编。
高级技巧
信号
stop 要不要中断下来看
printf 打印信息
pass 要不要传递给应用程序。
- handle 修改规则
handle signal act
print
noprint
stop
nostop
pass
nopass
handle SIGPIPE 不要中断下来,打印一个信息,网络程序常用
(gdb) handle SIGPIPE nostop
Signal Stop Print Pass to program Description
SIGPIPE No Yes Yes Broken pipe
Thread
info threads
LWP-light weight process 线程编号。
* gdb当前线程
切换当前线程
thread 2
打印所有线程
thread apply all bt 针对一群线程的命令避免切换来看。
线程改名字
thread name [name]
我自己经验 LWP 可以很好的观察线程负载情况。
摘要: 绘图控件重绘->其他操作->绘图控件重绘
进入了这样一个死循环,函数堆栈空间分配不足够.
阅读全文
eclipse 配置遇到 object 找不到问题 ?The type java.lang.object cannot be resolved - Eclipse buildpath not working
因为替换了 jvm版本.
解决办法: build->library -> add library->add jre library.tomcat部署问题.?1.清理 部署 重启. 2.先删掉部署项目,可以重新配置config.tomcat 找不到oracle 驱动程序?Tomcat error: java.sql.SQLException: No suitable driver found for jdbc
catalina_home/lib 中已经放入了jar文件后还是报错.请在 context.xml 中配置 <WatchedResource>WEB-INF/web.xml</WatchedResource>
<ResourceLink global="jdbc/oracle" name="jdbc/oracle" type="javax.sql.DataSource"/>
在 server.xml <Resource
name="jdbc/oracle"
auth="Container"
type="javax.sql.DataSource"
maxActive="100" maxIdle="30" maxWait="10000"
driverClassName="oracle.jdbc.OracleDriver"
url="jdbc:oracle:thin:@10.243.140.111:1521:test"
username="core"
password="core"/>
eclipse 项目属性, web deployment assembly设置 source: /webcontent deploypath: /
tomcat 开启gzip压缩
http://blog.csdn.net/hbcui1984/article/details/5666327
Setting property 'source' to 'org.eclipse.jst.jee.server 这个不是问题.
解决Setting property 'source' to 'org.eclipse.jst.jee.server的问题.
http://blog.csdn.net/foreversilent/article/details/11147847
测试代码的locality。
数组的读区方式不同,按照行读,被cache也是按行连续加载的。
如果按照列读区,那么效率很低,除非cache足够大,而且也要遍历所有的数据,并且cache hash算法也好,实现的硬件还是多路组相联的cache硬件实现。
** valgrind --tool=cachegrind ./test2**
code1:
#include <stdio.h>
#define MAXROW 8000
#define MAXCOL 8000
int main () {
int i,j;
static int x[MAXROW][MAXCOL];
printf ("Starting!\n");
for (i=0;i<MAXROW;i++)
for (j=0;j<MAXCOL;j++)
x[i][j] = i*j;
printf("Completed!\n");
return 0;
}
code2:
#include <stdio.h>
#define MAXROW 8000
#define MAXCOL 8000
int main () {
int i,j;
static int x[MAXROW][MAXCOL];
printf ("Starting!\n");
for (j=0;j<MAXCOL;j++)
for (i=0;i<MAXROW;i++)
x[i][j] = i*j;
printf("Completed!\n");
return 0;
}
```
##结果
Command: ./test1
Starting!
Completed!
I refs: 905,721,688
I1 misses: 4,177
LLi misses: 2,808
I1 miss rate: 0.00%
LLi miss rate: 0.00%
D refs: 514,830,867 (386,118,735 rd + 128,712,132 wr)
D1 misses: 4,025,828 ( 23,565 rd + 4,002,263 wr)
LLd misses: 4,008,456 ( 6,997 rd + 4,001,459 wr)
D1 miss rate: 0.8% ( 0.0% + 3.1% )
LLd miss rate: 0.8% ( 0.0% + 3.1% )
LL refs: 4,030,005 ( 27,742 rd + 4,002,263 wr)
LL misses: 4,011,264 ( 9,805 rd + 4,001,459 wr)
LL miss rate: 0.3% ( 0.0% + 3.1% )
gcc -o test2 test2.c
** valgrind --tool=cachegrind ./test2**
I refs: 905,720,801
I1 misses: 4,113
LLi misses: 2,811
I1 miss rate: 0.00%
LLi miss rate: 0.00%
D refs: 514,830,348 (386,118,427 rd + 128,711,921 wr)
D1 misses: 64,025,705 ( 23,462 rd + 64,002,243 wr)
LLd misses: 4,016,427 ( 6,977 rd + 4,009,450 wr)
D1 miss rate: 12.4% ( 0.0% + 49.7% )
LLd miss rate: 0.8% ( 0.0% + 3.1% )
LL refs: 64,029,818 ( 27,575 rd + 64,002,243 wr)
LL misses: 4,019,238 ( 9,788 rd + 4,009,450 wr)
LL miss rate: 0.3% ( 0.0% + 3.1% )
Starting!
Completed!
```
参考:
valgrind调试CPU缓存命中率和内存泄漏
http://laoxu.blog.51cto.com/4120547/1395236
摘要: <未完成>
容错系统的研究.
豆瓣可以搜索几本书.
阅读全文
摘要: wget https://raw.github.com/trapd00r/LS_COLORS/master/LS_COLORS -O $HOME/.dircolors
echo 'eval $(dircolors -b $HOME/.dircolors)' >> $HOME/.bashrc
. $HOME/.bashrc
阅读全文
摘要: typedef struct AA
{
AA * ptr;
}AA ;
阅读全文
摘要: EXEC sp_configure 'remote query timeout', 0 ;
GO
RECONFIGURE ;
GO
阅读全文
摘要: 1. 用户提交
2. 有1/3重做日志缓冲区未被写入磁盘
3. 有大于1M的重做日志缓冲区未被写入磁盘
4. 每隔3 秒钟
5. DBWR 需要写入的数据的SCN大于LGWR记录的SCN,DBWR 触发LGWR写入。
阅读全文
摘要: time dd if=/dev/zero bs=1024 count=1000000 of=./1Gb.file
dd if=./1Gb.file bs=64k |dd of=/dev/null
dd if=./1Gb.file bs=1MB |dd of=/dev/null
阅读全文
摘要: mac为什么主机名.local
搞不清楚为什么.也许区分本地网络,进程间通讯优化? 为了程序方便 /ect/hosts 添加127.0.0.1 指向主机名.
sudo vim /etc/hosts
阅读全文
摘要: #ifdef WIN32
WSADATA wsa_data;
WSAStartup(0x0201, &wsa_data);
#endif
阅读全文
摘要: 在windows上编译openssl 和 libevent.
libevent-2.0.22-stable
openssl-1.0.2c
阅读全文
libevent windows构建
warning LNK4098: 默认库“LIBCMT”与其他库的使用冲突
问题原因:
exe 是debug版本.
静态库是release版本.
编译libevent
C:\dev\mylibevent\libevent-2.0.22-stable>nmake /f Makefile.nmake
原来的修改 relase 版本多线程静态库 CFLAGS= /MT
编译的时候需要配置合适的线程库
拷贝出一个Makefile_D.nmake 多线程debug静态库
CFLAGS= .... /MTd
工程中链接对应的版本的lib文件.
参考:
https://msdn.microsoft.com/zh-cn/library/vstudio/abx4dbyh(v=vs.110).aspx
http://www.cnblogs.com/luxiaoxun/p/3603399.html
http://zyan.cc/libevent_windows/
摘要: 高性能Linux服务器构建实战:运维监控、性能调优与集群应用
构建高可用Linux服务器 2
阅读全文
摘要: 1.网络io文件大小未定,作为类库的设计者.
小文件太多,不好.IO性能差.
单个文件太大,如果都用memorybuffer,内存占用会非常的大.
设计者考虑2边的灵活性.
阅读全文
摘要: 8.8.8.8
114.114.114.114
223.5.5.5
223.6.6.6
阅读全文
摘要: xee下载地址
https://code.google.com/p/xee/downloads/detail?name=Xee2.2.zip&can=1&q=
自己开了一个分支
https://github.com/gddg/xee
阅读全文
摘要: 0.1000M 网络.
1.8口交换机
2.支持vlan
3.支持Qos
4.支持端口聚合.
Cisco SG200-08
5.POE 通过网线供电给USB CAM 功能.
阅读全文
Error running 'requirements_debian_libs_install gawk libreadline6-dev libssl-dev libyaml-dev libsqlite3-dev sqlite3 autoconf libgdbm-dev libncurses5-dev automake libtool',
showing last 15 lines of /home/gao/.rvm/log/1431136216_ruby-2.2.2/package_install_gawk_libreadline6-dev_libssl-dev_libyaml-dev_libsqlite3-dev_sqlite3_autoconf_libgdbm-dev_libncurses5-dev_automake_libtool.log
sudo:/var/lib/sudo 对非所有者可写(040777),模式应该为 0700
对不起,请重试。
正在读取软件包列表...
正在分析软件包的依赖关系树...
正在读取状态信息...
有一些软件包无法被安装。如果您用的是 unstable 发行版,这也许是
因为系统无法达到您要求的状态造成的。该版本中可能会有一些您需要的软件
包尚未被创建或是它们已被从新到(Incoming)目录移出。
下列信息可能会对解决问题有所帮助:
下列软件包有未满足的依赖关系:
libssl-dev : 依赖: libssl1.0.0 (= 1.0.1f-1ubuntu2) 但是 1.0.1f-1ubuntu2.4 正要被安装
E: 无法修正错误,因为您要求某些软件包保持现状,就是它们破坏了软件包间的依赖关系。
++ return 100
++ return 100
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
解决办法?
Jumping Into C++ 完整英文版
http://vdisk.weibo.com/s/lFnhClqHrmi
摘要: http://askubuntu.com/questions/50704/sudo-error-is-mode-0777-should-be-0440
阅读全文
摘要: iconv -f gb2312 -t utf-8 20150422_0.log >>a.log
阅读全文
摘要: echo "IRB.conf[:PROMPT_MODE] = :DEFAULT" > ~/.irbrc
或
echo "IRB.conf[:PROMPT_MODE] = :SIMPLE" > ~/.irbrc
阅读全文
摘要: 非常喜欢的一篇文章.介绍了execption c# 设计思路.
阅读全文
摘要: vim ~/.bash_profile
alias ls='ls -F'
alias cls='clear'
alias grep='grep --color=auto'
CLICOLOR="xterm-color"
LSCOLORS="gxfxcxdxcxegedabagacad"
export CLICOLOR LsCOLORS
阅读全文
摘要: 这个终端主题颜色配置很舒服.各种软件对应的主题都有.
http://ethanschoonover.com/solarized/files/solarized.zip
阅读全文
摘要: 技术树概览
http://html5ify.com/fks/#index_内容贡献者
前端文摘:Web 开发模式演变历史和趋势
http://www.cnblogs.com/lhb25/p/web-development-mode-evolve.html
A brief history of web design for designers
http://blog.froont.com/brief-history-of-web-design-for-designers/
阅读全文
摘要: http://tonybai.com/2010/12/14/create-libraries-with-libtool/
使用 GNU Libtool 创建库
https://www.ibm.com/developerworks/cn/aix/library/1007_wuxh_libtool/
阅读全文
摘要: Git Community Book 中文版
http://gitbook.liuhui998.com/1_1.html
台湾ihower写的
https://ihower.tw/git/
阅读全文
摘要: Ruby on Rails 實戰聖經
https://ihower.tw/rails4/
笨方法學 Ruby
http://lrthw.github.io/
阅读全文
摘要: brew install coreutils
gun tools 替换掉osx
PATH="/usr/local/opt/coreutils/libexec/gnubin:$PATH"
MANPATH="/usr/local/opt/coreutils/libexec/gnuman:$MANPATH"
阅读全文
摘要: 下载key替换工具 karabiner
control_L to command_L
option_R to delete
FN 键盘+F1 F2 如果你想替换成直接按F1就调用的话,可以macosx 键盘里面找到。发现FN键盘无法移到别的键上。
目前还没看出来mac上option,control 键的原生用途。
键程和windows很不一样。
阅读全文
摘要: brew install libtool
brew install autoconf
brew install automake
glibtool --help
sh autogen.sh
./configure
make
make check
阅读全文
摘要: Docroot is: /usr/local/var/www
/usr/local/etc/nginx/nginx.conf to 8080
ln -sfv /usr/local/opt/nginx/*.plist ~/Library/LaunchAgents
nginx
阅读全文
摘要: chmod -R 777 /usr/local/
GMac:~ XXXX$ brew install cmake
阅读全文
摘要: pmset -g
sudo pmset -a hibernatemode 3
阅读全文
摘要: Go to System Preferences -> Keyboard -> Keyboard tab -> Modifier keys
Swap the Control and Cmd keys
阅读全文
摘要: 目前知名的mq :
zeromq -- c++ 实现
ActiveMQ
JMS -- java的消息服务,j2ee 各家实现不同
MS Queue --
RabbitMQ
nanomsg
lightq
阅读全文
摘要: Sublime Text 2
安装插件:
https://gitcafe.com/ghosTM55/sublime-config
阅读全文
1.vc 编译
头文件
#include <omp.h
omp_set_num_threads(threadNumber);
#pragma omp parallel default(shared) private(i,riskId)
{
#pragma omp for
}
}
GCC配置
1. 编译
-fopenmp
设定线程数量 export OMP_NUM_THREADS=6
参考
通过 GCC 学习 OpenMP 框架
http://www.ibm.com/developerworks/cn/aix/library/au-aix-openmp-framework/
摘要: SQLnet.ora
DIAG_ADR_ENABLED=OFF
DIAG_SIGHANDLER_ENABLED=FALSE
DIAG_DDE_ENABLED=FALSE
阅读全文
摘要: 1.ms sql 的配置
安装了 sql- server2005 express ,安装默认会关闭网络连接的等.需要打开ip:1433端口.
账户密码需要使用,ms sql–server 登录登录.
2.sqlapi 的使用.
正确的sqlapi ++ ms sql server 串
char * dbname = "127.0.0.1\\SQL2005EXPRESS@master";
阅读全文
摘要: typedef unsigned short WORD;
#define WORD unsigned short
冲突
解决办法:
1.因为2个头文件来自不同项目. 修改源文件彻底解决掉这个问题.
2.先后引用位置 .
3.隐藏不必要的 .h文件,只有需要cpp才添加h引用.这样防止不必要的引用.
阅读全文
摘要: 关闭oracle api 异常侦测 sqlnet.ora
DIAG_ADR_ENABLED=FALSE
DIAG_DDE_ENABLED=FALSE
DIAG_SIGHANDLER_ENABLED=FALSE
DIAG_RESTRICTED=FALSE
阅读全文
打开root 用户
http://www.macx.cn/thread-2051799-1-1.html
http://support.apple.com/zh-cn/HT1528
太难找了,竟然在菜单里,打开root 。
su root
whoami
sudo su
密码不对
Mac OS X:sudo 命令需要非空的管理员密码
c# oledb odbc foxpro driver win 64 驱动不兼容.
解决办法:
c#工程里面选择 x86.
安装foxpro odbc驱动.
Intellij IDEA和Android Studio默认使用JDK6,所以你有如下选择:
1,安装JDK6
2,安装其他版本的JDK,然后修改IDE的指向。
如果选择2,那么修改方式为:
打开应用的.app包,然后在Contents这个目录下,有个文件info.plist,修改JVMVersion这个key对应的value,从1.6*修改为你安装的版本即可。
1 用文本编辑器打开
/Applications/IntelliJ IDEA 13.app/Contents/Info.plist
2 搜索JVMVersion,将其值改为1.7*
3 再次运行应用即可看到应用成功运行
from :
http://www.zhihu.com/question/26086376
摘要: 分析表空间
execute dbms_stats.gather_schema_stats('CORE');
阅读全文
摘要: 1.种方法
#define WIN32_LEAN_AND_MEAN
放在windows.h 之前.
2. 先引入socket2.h文件.
3. 项目 -> 属性 -> C/C++ -> 预处理器 -> 预处理器定义
在其中添加 : WIN32_LEAN_AND_MEAN
阅读全文
linux DNS 设置
sudo vim /etc/resolv.conf
http://www.alidns.com/setup/#linux
wget http://www.alidns.com/static/soft/SetAliDNS.sh -O SetAliDNS.sh && chmod +x SetAliDNS.sh && sudo ./SetAliDNS.sh
卸载
sudo ./SetAliDNS.sh restore
键盘修改
xmodmap -e "keycode 105=Delete"
先确保执行这个. win7 以上才支持 WER windows error report 功能 .
windows 弹出提示框, 然后进程管理器,右键手工导出也行.
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps]
"DumpFolder"="c:\\"
"DumpCount"=dword:00000030
"DumpType"=dword:00000002
"CustomDumpFlags"=dword:00000000
c++ debug版本 + pdb文件
另外需要注意不是所有情况都生成core.
windows 改了注册表不生成core的原因:
· Debugging dump files of optimized code can be confusing. For example, compiler inlining of functions can result in unexpected call stacks and other optimizations might change the lifetime of variables.
· Dump files from 64-bit machines must be debugged on an instance of Visual Studio that is running on a 64-bit computer.
· In versions of Visual Studio before VS 2013, dumps of 32-bit apps that were run on 64-bit machines that were collected by some tools (such as Task Manager and 64-bit WinDbg) could not be opened in Visual Studio. This limitation has been removed in VS 2013.
· Visual Studio can debug dump files of native apps from ARM devices. Visual Studio can also debug apps dump files of managed apps from ARM devices, but only in the native debugger.
· To debug kernel-mode dump files in Visual Studio 2013, download the Windows 8.1 Version of Debugging Tools for Windows. See Kernel Debugging in Visual Studio.
· Visual Studio can't debug dump files saved in the older dump format known as a full user-mode dump. Note that a full user-mode dump is not the same a dump with heap.
· To debug with the SOS.dll (SOS Debugging Extension) in Visual Studio, you must install the Debugging Tools for Windows that is part of the Windows Driver Kit (WDK). See Windows 8.1 Preview: Download kits, bits, and tools.
参考:
Collecting User-Mode Dumps --注册表
http://msdn.microsoft.com/en-us/library/windows/desktop/bb787181(v=vs.85).aspx
Crash Dump Analysis --- c++ 自己生成dump
http://msdn.microsoft.com/en-us/library/windows/desktop/ee416349(v=vs.85).aspx
Use Dump Files to Debug App Crashes and Hangs in Visual Studio
http://msdn.microsoft.com/en-us/library/d5zhxt22.aspx#bkmk_requirements_and_limitations
Attach to Running Processes with the Visual Studio Debugger
http://msdn.microsoft.com/en-us/library/3s68z0b3.aspx
Just-In-Time Debugging in Visual Studio ------- 还没看
http://msdn.microsoft.com/en-us/library/5hs4b7a6.aspx
The Discipline and Method Architecture for Reusable Libraries (2000)
Citations
1489 | The C++ Programming Language - Stroustrup - 1991 |
1437 | Object-Oriented Software Construction - Meyer - 1997 |
861 | Design Patterns - Gamma, Helm, et al. - 1995 |
303 | Purify: Fast detection of memory leaks and access errors - Hastings, Joyce - 1991 |
232 | Rational design process: how and why to fake it - Parnas, Clements - 1986 |
118 | The Art of Computer Programming, Volume 1 - Knuth - 1998 |
89 | Scalable software libraries - Batory, Singhal, et al. - 1993 |
67 | The Library Scaling Problem and the Limits of Concrete Component Reuse - Biggerstaff - 1994 |
57 | Algorithm-oriented generic libraries - Musser, Stepanov - 1994 |
47 | Vmalloc: A general and efficient memory allocator - Vo - 1996 |
37 | Algorithms, 2nd edition - Sedgewick - 1988 |
30 | An Empirical Study of Delta Algorithms - Hunt, Vo, et al. - 1996 |
27 | Empirical measurements of six allocation-intensive C programs - Zorn, Grunwald - 1992 |
19 | Porting Unix to Windows NT - Korn |
19 | Xept: A software instrumentation method for exception handling - Vo, Wang, et al. - 1997
|
18 | Worst case fragmentation of first fit and best fit storage allocation strategies - Robson - 1977 |
17 | libg++, the GNU C++ library - Lea - 1988 |
13 | On the external storage fragmentation produced by first-fit and best-fit allocation strategies - Shore - 1975 |
11 | C Interfaces and Implementation - Hanson - 1997 |
10 | National Standard for Information Systems { Programming Language C. Technical Report X3J11/89{159, ANSI Accredited Standards Committee, X3 Information Processing Systems - American - 1989 |
9 | Ksh - an extensible high level language - Korn - 1994 |
7 | Associative arrays - Koenig - 1988 |
5 | CDT: A Container Data Type Library - Vo - 1997 |
5 | Making a vector Fit for a Standard - Stroustrup - 1994 |
4 | Vdelta: Differencing and Compression - Korn, Vo - 1995 |
4 | Kiem-Phong Vo. Principles for Writing Reusable Library - Fowler, Korn - 1995 |
3 | Practical Reusable Unix Software - Krisnamurthy - 1995 |
2 | Negotiated Interfaces for Software Reuse - Clements, Parnas, et al. - 1992 |
1 | Concrete software libraries - Vo - 1998 |
1 | Sfio: A Buffered I/O Library. Software---Practice and Experience - Fowler, Korn, et al. - 199
|
#include <sys/stat.h>
long file_length(char *f)
{
struct stat st;
stat(f, &st);
return st.st_size;
}
If you have the file stream (FILE * f):
fseek(f, 0, SEEK_END); // seek to end of file
size = ftell(f); // get current file pointer
fseek(f, 0, SEEK_SET); // seek back to beginning of file
// proceed with allocating memory and reading the file
Or,
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
fd = fileno(f);
struct stat buf;
fstat(fd, &buf);
int size = buf.st_size;
Or, use stat, if you know the filename:
#include <sys/stat.h>
struct stat st;
stat(filename, &st);
size = st.st_size;
relocation error: multiget: symbol _Z23wxHandleFatalExceptionsb, version WXU_2.8 not defined in file libwx_baseu-2.8.so.0
下载地址:
http://www.codeblocks.org/downloads/26
http://sourceforge.net/projects/codeblocks/files/Binaries/13.12-RC1/Linux%20(64bit)/
codeblocks-13.12-1.el5.x86_64.tar.bz2
安装的关键
Note: On RedHat/CentOS 5 and older revisions of 6 (up to 6.2 as far as I know) you need to add repoforge (former rpmforge) to your repolist, to be able to install the needed wxGTK-package. Seehttp://repoforge.org/use for an instruction.
更新yum的源 很重要
http://repoforge.org/use/ 下载对应的rpm
cat /etc/redhat-release
uname –a
wget http://apt.sw.be/redhat/el6/en/x86_64/rpmforge/RPMS/rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm
rpm -ivh package-filename
# yum install gcc
# yum install gcc-c++
如果之前失败过 yum erase wxGTK
# yum install wxGTK
然后
]# ls
codeblocks-12.11-1.el6.i686.rpm
codeblocks-contrib-12.11-1.el6.i686.rpm
codeblocks-contrib-devel-12.11-1.el6.i686.rpm
codeblocks-devel-12.11-1.el6.i686.rpm
# rpm -ivh codeblocks*
1. 下载repo文件
下载地址:http://mirrors.163.com/.help/CentOS6-Base-163.repo
2. 备份并替换系统的repo文件
[root@localhost ~]# cd /etc/yum.repos.d/
[root@localhost ~]# mv CentOS-Base.repo CentOS-Base.repo.bak
[root@localhost ~]# mv /root/CentOS6-Base-163.repo CentOS-Base.repo
3. 执行yum源更新
[root@localhost ~]# yum clean all
[root@localhost ~]# yum makecache
[root@localhost ~]# yum update
yum install gcc gcc-g++ autoconfig automake
参考:
http://blog.csdn.net/dupei/article/details/6428346
http://www.cnblogs.com/magialmoon/archive/2013/05/05/3061108.html
sqlplus 外面执行正常.
tomcat调用老有问题.多调用几次久正常.
可能是包中的全局变量引起的.
If so, that's because your package is stateful:
The values of the variables, constants, and cursors that a package declares (in either its specification or body) comprise its package state. If a PL/SQL package declares at least one variable, constant, or cursor, then the package is stateful; otherwise, it is stateless.
When you recompile the state is lost:
If the body of an instantiated, stateful package is recompiled (either explicitly, with the "ALTER PACKAGE Statement", or implicitly), the next invocation of a subprogram in the package causes Oracle Database to discard the existing package state and raise the exception ORA-04068.
After PL/SQL raises the exception, a reference to the package causes Oracle Database to re-instantiate the package, which re-initializes it...
You can't avoid this if your package has state. I think it's fairly rare to really need a package to be stateful though, so you should revisit anything you have declared in the package, but outside a function or procedure, to see if it's really needed at that level. Since you're on 10g though, that includes constants, not just variables and cursors.
But the last paragraph from the quoted documentation means that the next time you reference the package in the same session, you won't get the error and it will work as normal (until you recompile again).
existing state of packages has been discarded
means, that your Package had some sort of state.
This is caused by a global variable (or constant) stored in your Package Body.
Since the package has already been used in your session, Oracle assumes that this state is relevant for you. Some of these variables might have different values now, and when you recompile the Body, the values are reset.
This exception is thrown, so that your clients know that they can't rely on those variables any more.
You could try to remove all global variables and constants from the Package Body, or close your session and reconnect before calling the package again.
参考:
http://stackoverflow.com/questions/2502722/pl-sql-package-invalidated
http://stackoverflow.com/questions/19376440/ora-06508-pl-sql-could-not-find-program-unit-being-called
监听器配置少了.
lsnrctl
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = XE )
(ORACLE_HOME = C:\oraclexe\app\oracle\product\11.2.0\server)
(SID_NAME =XE )
)
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = C:\oraclexe\app\oracle\product\11.2.0\server)
(PROGRAM = extproc)
)
(SID_DESC =
(SID_NAME = CLRExtProc)
(ORACLE_HOME = C:\oraclexe\app\oracle\product\11.2.0\server)
(PROGRAM = extproc)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
(ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 1521))
)
)
DEFAULT_SERVICE_LISTENER = (XE)
1.安装 vnc-server
找包
http://www.rpmfind.net/linux/rpm2html/search.php?query=libtermcap&submit=Search+...&system=centos&arch=
如果window
vncserver :1
输入密码
vnc登录后
xhost +
解决display问题.
vncserver -kill :1
vnc 如果进入以后3个 提示选择 allow clipboard .
修改/root/.vnc/xstartup文件,把最后一行 twm& 修改成"startkde &" 或者"gnome-session &"
不然的话连接linux时只出现了一个终端编辑器窗口。
exec gnome-session &
oracle 安装
http://blog.itpub.net/7719012/viewspace-1139996
http://lowendtalk.com/discussion/5396/how-to-install-vnc-on-centos
二:使用Xmanager实现xhost挂接图形
http://hi.baidu.com/hanyanlovejoy/item/564ed582accef0efe496e017
删除
:g/.*ABC/m
:g/kernel32/d
:[range]g[lobal]/{pattern}/[cmd] :help :g
vim 查找一个文章段落, 开头字符 结尾字符
/.*#tag1\(.\+\n\+\)\{-}#tag2.*
删除掉 :
g/.*#tag1\(.\+\n\)\{-}#tag2.*/d
这句话\(.\+\n\+\) 采用分组
.\+ .任意字符 + 一个或多个
\n\+ 回车 一个或多个
\+1 或更多
\{-} 0 或更多尽可能少. 任意字符
\n 换行符
为什么 /This\_.*text/ 不可以,因为\_. 是全缓冲区匹配模式的.
概念分组、捕获
http://i.linuxtoy.org/docs/guide/ch26s08.html#id3120909
abc123.456.def
\d{3}表示三个数字,(\d{3}\.)表示三个数字加“.”为一组,{2}表示这一组内容重复两次
参考:
http://vimcdoc.sourceforge.net/doc/pattern.html#search-pattern
^\(.\+\n\)\{-}#.*tag1
http://stackoverflow.com/questions/10076834/multi-line-regex-in-vim-filtering-out-blocks-of-text-in-a-file
Vim 中删除符合条件的行
http://timothyqiu.com/archives/delete-lines-matching-pattern-in-vim/ https://github.com/railsinstaller/railsinstaller-windows/releases