这个错误信息是什么意思:Address not mapped to object

wangnijie8634 2010-10-24 03:26:31
(gdb) n
87 if ( XMLString::equals(loop->loc, ptr) && XMLString::equals(loop->nstr, ptr1) )
(gdb) print loop->loc
$1 = (unsigned short *) 0x5500540046002d
(gdb) print ptr
$2 = (unsigned short *) 0x6000000000038870
(gdb) print loop->nstr
$3 = (unsigned short *) 0x600000000001c4a0
(gdb) print ptr1
$4 = (unsigned short *) 0x6000000000038d30
(gdb) n

Program received signal SIGSEGV, Segmentation fault
si_code: 1 - SEGV_MAPERR - Address not mapped to object.
0x400000000002e2c0:0 in xercesc_2_5::SchemaStore::hasSchemaItem (
this=0x600000000001a530, schemaLoc=0x60000000000a3810,
schemaNstr=0x60000000000a3680) at SchemaStore.cpp:87
87 if ( XMLString::equals(loop->loc, ptr) && XMLString::equals(loop->nstr, ptr1) )


大家有什么思路吗?
...全文
5563 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
xqhrs232 2011-08-16
  • 打赏
  • 举报
回复
也有这样的问题!!!
ch19860304 2010-10-24
  • 打赏
  • 举报
回复
指针loop->loc的地址值不对,无法读出该地址指向的obj。
怎么两边都发了,这边人气旺。。。

如果想要gbd inline内的函数的话,有二个方法:
方法一,将inline去掉,再重新编译下。
方法二,或者加上-O0,取消优化,编译器会忽略inline。
gules 2010-10-24
  • 打赏
  • 举报
回复
从信息上看,重点检查loop->loc是否指向了合法的对象。
arong1234 2010-10-24
  • 打赏
  • 举报
回复
说明你指针的值非法,没有指向一个合法的对象,一般是指针未初始化或者内存访问越界引起[Quote=引用 2 楼 wangnijie8634 的回复:]
Address not mapped to object是Segmentation fault的原因吧,我想知道,这个信息说明了什么问题
[/Quote]
dskit 2010-10-24
  • 打赏
  • 举报
回复
去掉inline

你这个函数编译器是不会内联的,尽管你使用的inline指示关键字!
wangnijie8634 2010-10-24
  • 打赏
  • 举报
回复
我gdb调试时,进不了equals中,因为它是个inline,如下:

inline bool XMLString::equals( const XMLCh* const str1
, const XMLCh* const str2)
{
const XMLCh* psz1 = str1;
const XMLCh* psz2 = str2;

if (psz1 == 0 || psz2 == 0) {
if ((psz1 != 0 && *psz1) || (psz2 != 0 && *psz2))
return false;
else
return true;
}

while (*psz1 == *psz2)
{
// If either has ended, then they both ended, so equal
if (!*psz1)
return true;

// Move upwards for the next round
psz1++;
psz2++;
}
return false;
}

大家有什么办法,能让我进入inline中吗?
wangnijie8634 2010-10-24
  • 打赏
  • 举报
回复
Address not mapped to object是Segmentation fault的原因吧,我想知道,这个信息说明了什么问题
dskit 2010-10-24
  • 打赏
  • 举报
回复
Segmentation fault
才是关键,内存访问越界了,检查是否读写了不该读写的内存!

64,648

社区成员

发帖
与我相关
我的任务
社区描述
C++ 语言相关问题讨论,技术干货分享,前沿动态等
c++ 技术论坛(原bbs)
社区管理员
  • C++ 语言社区
  • encoderlee
  • paschen
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
  1. 请不要发布与C++技术无关的贴子
  2. 请不要发布与技术无关的招聘、广告的帖子
  3. 请尽可能的描述清楚你的问题,如果涉及到代码请尽可能的格式化一下

试试用AI创作助手写篇文章吧