Chinaunix首页 | 论坛 | 博客
  • 博客访问: 3902528
  • 博文数量: 534
  • 博客积分: 10470
  • 博客等级: 上将
  • 技术积分: 4800
  • 用 户 组: 普通用户
  • 注册时间: 2006-05-26 14:08
文章分类

全部博文(534)

文章存档

2021年(1)

2019年(1)

2017年(1)

2016年(2)

2013年(2)

2012年(10)

2011年(43)

2010年(10)

2009年(17)

2008年(121)

2007年(253)

2006年(73)

分类: C/C++

2008-03-06 09:34:03

有时候要计算一些简单运算,如: (124+325345)*23 怎么计算, 很简单。 如:
[gan@localhost gan]$ gdb
GNU gdb Red Hat Linux (5.3post-0.20021129.18rh)
Copyright 2003 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i386-redhat-linux-gnu".
(gdb) p (124+325345)*23
$1 = 7485787
(gdb)

今天想到把十进制怎么同十六进制之间怎么转换的呢? 看了gdb的print的用法

  print  variable        查看变量
  print  *array@len      查看数组(array是数组指针,len是需要数据长度)
  可以通过添加参数来设置输出格式:
    /x 按十六进制格式显示变量。
    /d 按十进制格式显示变量。
    /u 按十六进制格式显示无符号整型。
    /o 按八进制格式显示变量。
    /t 按二进制格式显示变量。
    /a 按十六进制格式显示变量。
    /c 按字符格式显示变量。
    /f 按浮点数格式显示变量。

自己实验以下:
(gdb) p /x 124234
$6 = 0x1e54a
阅读(3371) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~