【问题标题】:a mistake met in pthread_create [closed]pthread_create 中遇到的错误[关闭]
【发布时间】:2016-03-30 03:14:50
【问题描述】:

当我在 Linux 中使用gdb 逐步运行代码时出现错误,会发生这种情况。在(gdb) s之后, 我收到了这些消息:

__pthread_create_2_1 (newthread=0x7fffffffdcc0, attr=0x0,
start_routine=0x400cdf <sendMessage>, arg=0x7fffffffdcd0)
at pthread_create.c:472
472 pthread_create.c: No such file or directory.

我使用“gcc -pthread -Wall -o”来构建和链接我的 C 源文件,除了一些警告之外没有发生任何错误。 我不知道如何处理它。

【问题讨论】:

  • @AlterMann -pthread 是正确的。
  • 到底是什么问题?输入s 后,您希望发生什么?

标签: c linux gdb pthreads


【解决方案1】:

我认为这里没有问题。

您启动了程序,并在调用 pthread_create 之前设置了一个断点,因此调试器在此处暂停。

然后你尝试进入pthread_create。调试器对此很好。

调试器知道pthread_create 是在pthread_create.c 的第472 行定义的——但是,它实际上并没有pthread_create.c 的副本。所以它让你知道它无法显示源代码,这就是这条消息的意思:

472     pthread_create.c: No such file or directory.

您可能想要使用n (next) 而不是s (step) 来跳过pthread_create 调用。

【讨论】:

  • 非常感谢!我现在试试~~
  • 明白了!非常感谢~~
猜你喜欢
  • 2018-10-30
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2022-01-21
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多