xml地图|网站地图|网站标签 [设为首页] [加入收藏]
windbg及时调试,Linux文件属性上
分类:操作系统

Download opencv

当程序在测试或者老化的时候很有用,只要程序有异常抛出,就能启用windbg调试,这样就能及时的保存现场。

 

安装必要的依赖

sudo apt-get install build-essential
sudo apt-get install cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev
sudo apt-get install python-dev python-numpy libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libjasper-dev libdc1394-22-dev

程序崩溃时,windows系统会调用系统默认调试器,其设置在注册表

文件属性概述(ls -lhi)

linux里一切皆文件
Linux系统中的文件或目录的属性主要包括:索引节点(inode),文件类型,权限属性,链接数,所归属的用户和用户组,最近修改时间等内容:

图片 1

解释:

第一列: style="color: #ff0000;">inode索引节点编号(相当于人的身份证,全国唯一)
第二列:文件类型及权限
第二列共11个字符:其中第一个字符为文件类型,随后的9个字符为文件的对应权限, style="color: #ff0000;">最后一个字符点号“.”是和selinux有关的一个标识;
第三列: style="color: #ff0000;">硬链接个数(详细参看ln命令的讲解);
相当于超市的多个入口,可以从不同的文件入口进入文件,还可以互为备份(消防通道)
第四列:文件或目录所属的用户 文件的所有者( style="color: #ff0000;">属主);
linux里面文件和程序的存在必须要有用户和组满足相应的存在需求。
第五咧:文件或目录所属的组
第六列:文件或目录的大小;
第七八九列:文件或目录的修改时间:默认月日时分
第十列:实际的文件或目录名
文件名不算文件的属性

下面我们以chensiqi文件为例进行说明,具体列的内容参考下上面的图:

1736707 -rwx-xr-x- 1 root root 35 Oct 28 11:29 chensiqi

  • inode索引节点编号:1736707
  • 文件类型,文件类型是-,表示这是一个普通文件;
  • 文件权限:文件权限是rwxr-xr-x,表示文件属主可读,可写,可执行,文件归属的用户组可读可执行,其他用户可执行。
  • 硬链接个数:表示chensiqi这个文件没有其它的硬链接,因为连接数是1,就是他本身;
  • 文件属主:这个文件所属的用户,这里意思是chensiqi文件被root用户拥有,注意,是第一个root;
  • 文件属组:这个文件所属的用户组,在这里是root用户组,是显示信息里的第二个root
  • 文件大小:文件大小是35个字节
  • 文件修改时间:这里的时间是该文件最后被更新(包括文件创建,内容更新,文件名更新等)的时间,可用如下命令查看文件的修改,访问,创建的时间

 

Enter opencv dirctory and install

cd  XXXX/opencv2.4
mkdir Release
cd Release
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D WITH_TBB=ON -D BUILD_NEW_PYTHON_SUPPORT=ON -D WITH_V4L=ON -D INSTALL_C_EXAMPLES=ON -D INSTALL_PYTHON_EXAMPLES=ON -D BUILD_EXAMPLES=ON -D WITH_QT=ON -D WITH_GTK=ON -D WITH_OPENGL=ON ..

cmake 出错,报错如下

CMake Warning at cmake/OpenCVFindLibsGUI.cmake:18 (find_package):
  By not providing "FindQt5Core.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "Qt5Core", but
  CMake did not find one.

  Could not find a package configuration file provided by "Qt5Core" with any
  of the following names:

    Qt5CoreConfig.cmake
    qt5core-config.cmake

  Add the installation prefix of "Qt5Core" to CMAKE_PREFIX_PATH or set
  "Qt5Core_DIR" to a directory containing one of the above files.  If
  "Qt5Core" provides a separate development package or SDK, be sure it has
  been installed.
Call Stack (most recent call first):
  CMakeLists.txt:489 (include)


CMake Warning at cmake/OpenCVFindLibsGUI.cmake:19 (find_package):
  By not providing "FindQt5Gui.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "Qt5Gui", but
  CMake did not find one.

  Could not find a package configuration file provided by "Qt5Gui" with any
  of the following names:

    Qt5GuiConfig.cmake
    qt5gui-config.cmake

  Add the installation prefix of "Qt5Gui" to CMAKE_PREFIX_PATH or set
  "Qt5Gui_DIR" to a directory containing one of the above files.  If "Qt5Gui"
  provides a separate development package or SDK, be sure it has been
  installed.
Call Stack (most recent call first):
  CMakeLists.txt:489 (include)


CMake Warning at cmake/OpenCVFindLibsGUI.cmake:20 (find_package):
  By not providing "FindQt5Widgets.cmake" in CMAKE_MODULE_PATH this project
  has asked CMake to find a package configuration file provided by
  "Qt5Widgets", but CMake did not find one.

  Could not find a package configuration file provided by "Qt5Widgets" with
  any of the following names:

    Qt5WidgetsConfig.cmake
    qt5widgets-config.cmake

  Add the installation prefix of "Qt5Widgets" to CMAKE_PREFIX_PATH or set
  "Qt5Widgets_DIR" to a directory containing one of the above files.  If
  "Qt5Widgets" provides a separate development package or SDK, be sure it has
  been installed.
Call Stack (most recent call first):
  CMakeLists.txt:489 (include)


CMake Warning at cmake/OpenCVFindLibsGUI.cmake:21 (find_package):
  By not providing "FindQt5Test.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "Qt5Test", but
  CMake did not find one.

  Could not find a package configuration file provided by "Qt5Test" with any
  of the following names:

    Qt5TestConfig.cmake
    qt5test-config.cmake

  Add the installation prefix of "Qt5Test" to CMAKE_PREFIX_PATH or set
  "Qt5Test_DIR" to a directory containing one of the above files.  If
  "Qt5Test" provides a separate development package or SDK, be sure it has
  been installed.
Call Stack (most recent call first):
  CMakeLists.txt:489 (include)


CMake Warning at cmake/OpenCVFindLibsGUI.cmake:22 (find_package):
  By not providing "FindQt5Concurrent.cmake" in CMAKE_MODULE_PATH this
  project has asked CMake to find a package configuration file provided by
  "Qt5Concurrent", but CMake did not find one.

  Could not find a package configuration file provided by "Qt5Concurrent"
  with any of the following names:

    Qt5ConcurrentConfig.cmake
    qt5concurrent-config.cmake

  Add the installation prefix of "Qt5Concurrent" to CMAKE_PREFIX_PATH or set
  "Qt5Concurrent_DIR" to a directory containing one of the above files.  If
  "Qt5Concurrent" provides a separate development package or SDK, be sure it
  has been installed.
Call Stack (most recent call first):
  CMakeLists.txt:489 (include)


qmake: could not exec '/usr/lib/x86_64-linux-gnu/qt4/bin/qmake': No such file or directory
CMake Error at /usr/share/cmake-3.5/Modules/FindQt4.cmake:1326 (message):
  Found unsuitable Qt version "" from NOTFOUND, this code requires Qt 4.x
Call Stack (most recent call first):
  cmake/OpenCVFindLibsGUI.cmake:34 (find_package)
  CMakeLists.txt:489 (include)


-- Configuring incomplete, errors occurred!
See also "/home/feng/Documents/opencv-2.4/Release/CMakeFiles/CMakeOutput.log".
See also "/home/feng/Documents/opencv-2.4/Release/CMakeFiles/CMakeError.log".

根据报错信息,应该是qt没装
安装qt

sudo apt-get install libqt4-dev

cmake成功会生成如下文件

feng@mint ~/Documents/opencv-2.4/Release $ ls
3rdparty  CMakeCache.txt       cmake_uninstall.cmake  CPackSourceConfig.cmake  data     junk      modules             OpenCVConfig-version.cmake  unix-install
apps      CMakeFiles           CMakeVars.txt          CTestTestfile.cmake      doc      lib       opencv2             OpenCVModules.cmake         version_string.tmp
bin       cmake_install.cmake  CPackConfig.cmake      cvconfig.h               include  Makefile  OpenCVConfig.cmake  samples

make
sudo make install

HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindows NTCurrentVersionAeDebug
(注:64位windows的上的路径不同,在HKEY_LOCAL_MACHINESOFTWAREWow6432NodeMicrosoftWindows NTCurrentVersionAeDebugDebugger  )
这里面有2个主要的值:
Auto
 = 0 的时候,系统会弹出一个对话框,让你在几个调试器中选择(如果你的系统安装了多个调试器的话)
 = 1 的时候,系统会自动调用默认调试器
Debugger
  默认调试器的路径。
  比如windows自带的Dr.Watson : DRWTSN32 -p %ld -e %ld -g
  或者是WinDBG: windbg.exe" -p %ld -e %ld -g

索引节点inode

the whole installation tutorial

参考博客:

inode 概述

  • 硬盘要存储数据,首先要分区,然后格式化创建文件系统,最后挂载,才能存数据。
  • Inode,中文意思是索引节点(index node)。在每个linux存储设备或存储设备的分区(存储设备可以是硬盘,软盘,U盘...)被格式化为ext4(CentOS6.8)文件系统后,一般生成两部分:第一部分是Inode(很多个),第二部分是Block(很多个)。
  • 这个Block是用来存储实际数据用的,例如:照片,视频等普通文件数据。
  • 而inode就是用来存储这些数据属性信息的(也就是ls -l的结果),inode属性信息包括不限于文件大小,属主(用户),归属的用户组,文件权限,文件类型,修改时间,还包含指向文件实体的指针功能(inode节点--block的对应关系)等,但是,inode里面唯独不包含文件名本身。文件名不在inode里,一般在上级目录的block里

身份证号 ==== inode号

  • Inode除了记录文件属性的信息外,还会为每个文件进行信息索引,所以就有了inode的数值。操作系统根据指令,即可通过inode的值最快的找到相对应的文件实体。文件,inode,block之间的关系见下图:

图片 2

假如有一本书,存储设备和分区就相当于这本书,Block相当于书中的每一页内容,而inode就相当于这本书前面的目录,一本书有很多内容,一个知识点可能有多页,如果想查找某部分或某知识点的内容,我们一般先查书的目录,通过目录能更快的找到我们想要看的知识点的内容。虽然不太恰当,但还是比较形象。

当我们用ls查看某个目录或文件时,如果加上-i参数,就可以看到inode节点了:

【root@chengliang /】# ls -i

图片 3

  • 图第一列inode值259615;查看一个文件或目录的inode,通过ls命令的-i参数即可。
  • 因为inode要存放文件的属性信息,所以每个inode本身是有大小的,Centos5系列inode的默认大小是128字节,而Centos6系列inode的默认大小是256字节,inode的大小在分区被格式化创建文件系统之后定下来的,格式化以后就无法更改inode大小,格式化前可以通过参数指定inode的大小,但是一般企业工作环境没这个需求。
  • 不同Centos版本inode大小不同

图片 4

查看文件系统inode总量以及剩余量:df -i

查看磁盘使用量: df -h

图片 5

Inode:存放文件的属性+文件内容的位置(block的位置)

Block:存放实际数据

 

 企业案例模拟:模拟磁盘满的情况

磁盘满的一个特征(no space left on device)

本文由澳门新葡亰手机版发布于操作系统,转载请注明出处:windbg及时调试,Linux文件属性上

上一篇:计算机应用基础教程作业,正则表达式中常用的 下一篇:没有了
猜你喜欢
热门排行
精彩图文