首页 > 系统相关 >linux print_hex_dump()

linux print_hex_dump()

时间:2023-11-07 21:14:15浏览次数:26  
标签:dump DUMP hex prefix PREFIX print

linux print_hex_dump()



linux/lib/hexdump.c

/**
 * print_hex_dump - print a text hex dump to syslog for a binary blob of data
 * @level: kernel log level (e.g. KERN_DEBUG)
 * @prefix_str: string to prefix each line with;
 *  caller supplies trailing spaces for alignment if desired
 * @prefix_type: controls whether prefix of an offset, address, or none
 *  is printed (%DUMP_PREFIX_OFFSET, %DUMP_PREFIX_ADDRESS, %DUMP_PREFIX_NONE)
 * @rowsize: number of bytes to print per line; must be 16 or 32
 * @groupsize: number of bytes to print at a time (1, 2, 4, 8; default = 1)
 * @buf: data blob to dump
 * @len: number of bytes in the @buf
 * @ascii: include ASCII after the hex output
 *
 * Given a buffer of u8 data, print_hex_dump() prints a hex + ASCII dump
 * to the kernel log at the specified kernel log level, with an optional
 * leading prefix.
 *
 * print_hex_dump() works on one "line" of output at a time, i.e.,
 * 16 or 32 bytes of input data converted to hex + ASCII output.
 * print_hex_dump() iterates over the entire input @buf, breaking it into
 * "line size" chunks to format and print.
 *
 * E.g.:
 *   print_hex_dump(KERN_DEBUG, "raw data: ", DUMP_PREFIX_ADDRESS,
 *		    16, 1, frame->data, frame->len, true);
 *
 * Example output using %DUMP_PREFIX_OFFSET and 1-byte mode:
 * 0009ab42: 40 41 42 43 44 45 46 47 48 49 4a 4b 4c 4d 4e 4f  @ABCDEFGHIJKLMNO
 * Example output using %DUMP_PREFIX_ADDRESS and 4-byte mode:
 * ffffffff88089af0: 73727170 77767574 7b7a7978 7f7e7d7c  pqrstuvwxyz{|}~.
 */
void print_hex_dump(const char *level, const char *prefix_str, int prefix_type,
		    int rowsize, int groupsize,
		    const void *buf, size_t len, bool ascii)
{
...
}

enum {
DUMP_PREFIX_NONE,
DUMP_PREFIX_ADDRESS,
DUMP_PREFIX_OFFSET
};

标签:dump,DUMP,hex,prefix,PREFIX,print
From: https://www.cnblogs.com/WangYangkai/p/17816006.html

相关文章

  • 【C语言基础】 指针变量-printf %d和%p的含义
    1.指针变量的值是地址,地址通常用16进制表示2.inta=1;int*p=&a;printf("%d\n",p);和printf("%p\n",p);有什么区别呢,输出的都是p的值,%p是把指针变量p中存储的a的地址以十六进制形式输出,%d是吧p中存储的a的地址以十进制形式输出。输出的都是p的值,不要理解成%p,是把p的地址输出。......
  • BUUCTF_Crypto_WriteUp | Quoted-printable
    题目=E9=82=A3=E4=BD=A0=E4=B9=9F=E5=BE=88=E6=A3=92=E5=93=A6分析拿到题目的第一反应:好多等号!于是去大佬的编码密码总结帖子里找类似的格式,找到如下:Quoted-printable编码简述:它是多用途互联网邮件扩展(MIME)一种实现方式。有时候我们可以邮件头里面能够看到这样的编码;特......
  • python print 打印彩色字体
    全局说明演示了如何使用ANSI转义序列打印不同颜色的字体一、颜色说明\033[:开始颜色设置。1:字体加粗。32:文字颜色,绿色。41:背景颜色,红色。m:结束颜色设置。\033[0m:重置所有终端属性,包括颜色。二、输出示例#打印红色字体print("\033[1;31;40m这是红色的字体\033......
  • 配置rhel系统kdump安装RHEL的debuginfo软件包
    7.1.1.关于kdumpKdump是一种内核碰撞倾销机制,可将系统内存的内容保存以供以后分析。它依赖于kexec,它可以用来从另一个内核的上下文中启动Linux内核,绕过BIOS,并保留第一个内核内存的内容,否则会丢失。在系统崩溃的情况下,kdump使用kexec启动到第二个内核(捕获内核)。第二......
  • 如何使用 print() 打印类实例?
    内容来自DOChttps://q.houxu6.top/?s=如何使用print()打印类实例?当我尝试使用print()打印一个类的实例时,我得到的输出是这样的:>>>classTest():...def__init__(self):...self.a='foo'...>>>print(Test())<__main__.Testobjectat0x7fc9a9e36d......
  • mongo备份篇 mongoexport、mongoimport 以及mongodump、mongorestore
    系列导航一、linux单机版mongo安装(带密码验证)二、mongo集群搭建三、java连接mongo数据库四、java对mongo数据库增删改查操作五、mongo备份篇mongoexport、mongoimport以及mongodump、mongorestore如下是总结mongo数据库在执行备份和恢复中一些常用的语句。备份方面比较:1......
  • c++ 程序打印 core dump 信息
    linux环境下c++程序打印coredump信息linux信号机制c++打印堆栈信息#include<signal.h>#include<execinfo.h>#include<dlfcn.h>#include<cxxabi.h>#include<QFile>#include<QTextStream>//捕获信号,对于这些信号都执行coreDumpHandlesignal(SIG......
  • tcpdump抓包实例-syslog和ping
    在实际运维过程中经常遇到网络问题,比如发出去的包是否对端收到了,以下通过syslog和ping的两个例子看看tcpdump抓包过程。实例1:syslog测试主机A(本例中129.73)通过syslog发送信息:“123456”,给主机B日志服务器(本例中120.90,需要配置syslog服务514端口的tcp和udp打开),在日志服务器主机B上抓......
  • 抓包指令tcpdump和包处理editcap指令 使用
    editcap的使用按照时间范围进行截取包editcap-A'YYYY-MM-DDhh:mm:ss'-B'YYYY-MM-DDhh:mm:ss'infileoutfile 从infile文件中选取从A-B时间范围内的包输出到outfile中editcap-A'YYYY-MM-DDhh:mm:ss'infileoutfile从infile文件中选取A时间点之后的数据,输出......
  • 2.62 print("学号:3137")
     ......