我正在使用gdb执行一个基本的C程序.我在开始时有一个断点main()
.运行代码后,gdb按预期在main()处中断.现在,如果我检查堆栈指针寄存器(rsp),我看到了
0x7fffffffe170: 0x00000000.
Run Code Online (Sandbox Code Playgroud)
当我使用cat /proc/17232/stat | cut -d" " -f29/proc
(其中17232是这个过程的pid)检索相同的信息时,我看到:
140737488347112 (which in hex is: 0x7fffffffdfe8).
Run Code Online (Sandbox Code Playgroud)
为什么我们看到来自gdb的当前堆栈指针的不同值.而且,为什么gdb将rsp的内容显示为NULL(0x00000000)?
谢谢.
我正在尝试了解使用RDTSC/RDTSCP测量时间时使用栅栏的正确方法.关于与此相关的SO的几个问题已经得到了精心解答.我经历了其中一些.我也经历过关于同一主题的非常有用的文章:http: //www.intel.com/content/dam/www/public/us/en/documents/white-papers/ia-32-ia-64-基准-代码执行-paper.pdf
但是,在另一个在线博客中,有一个在x86上使用LFENCE而不是CPUID的例子.我想知道LFENCE如何阻止早期商店污染RDTSC测量.例如
<Instr A>
LFENCE/CPUID
RDTSC
<Code to be benchmarked>
LFENCE/CPUID
RDTSC
Run Code Online (Sandbox Code Playgroud)
在上面的例子中,LFENCE确保它之前完成的所有早期加载(因为SDM说:LFENCE指令不能通过先前的读取.).但是早期的商店呢(比如,Instr A是商店)?我理解为什么CPUID有效,因为它是一个序列化指令,但LFENCE不是.
我发现的一个解释是在英特尔SDM VOL 3A第8.3节中,以下脚注:
LFENCE确实为指令排序提供了一些保证.它在本地完成所有先前指令之前不会执行,并且在LFENCE完成之前不会再执行指令.
所以LFENCE本质上就像一个MFENCE.在那种情况下,为什么我们需要两个单独的指令LFENCE和MFENCE?
我可能错过了一些东西.
提前致谢.
我有一个关于pthread_kill()行为的问题.
这是我正在尝试的一个小代码:
void my_handler1(int sig)
{
printf("my_handle1: Got signal %d, tid: %lu\n",sig,pthread_self());
//exit(0);
}
void *thread_func1(void *arg)
{
struct sigaction my_action;
my_action.sa_handler = my_handler1;
my_action.sa_flags = SA_RESTART;
sigaction(SIGUSR1, &my_action, NULL);
printf("thread_func1 exit\n");
}
void *thread_func2(void *arg)
{
int s;
s = pthread_kill(tid1_g,SIGUSR1);
if(s)
handle_error(s,"tfunc2: pthread_kill");
printf("thread_func2 exit\n");
}
int main()
{
int s = 0;
pthread_t tid1;
s = pthread_create(&tid1,NULL,thread_func1,NULL);
if(s)
handle_error(s,"pthread_create1");
tid1_g = tid1;
printf("tid1: %lu\n",tid1);
s = pthread_join(tid1,NULL);
if(s)
handle_error(s, "pthread_join");
printf("After join tid1\n");
pthread_t tid3;
s = …
Run Code Online (Sandbox Code Playgroud) 我正在尝试在我的Ubuntu系统上用rails 3.1编写的Q&A应用程序.运行服务器(rails服务器)后,在浏览器中输入localhost:3000 url,我收到以下错误:
/var/lib/gems/1.8/gems/jquery-rails-1.0.14/vendor/assets/javascripts/jquery.js isn't in paths:
(...."displays a list of paths including /$home/myapp/jquery-rails/ruby/1.9.1/gems/jquery-rails-1.0.14/vendor/assets/javascripts".....).
Run Code Online (Sandbox Code Playgroud)
我做了bundle update
,它在最后一个路径中安装了jquery.js和所有其他.js文件.但我仍然得到同样的错误.关于我在这里做错了什么的任何建议?
PS当我输入URL localhost:3000时,它实际上尝试打开URL:http:// localhost:3000/session/new.必须是一些应用程序特定的逻辑