mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2026-02-10 07:00:53 +00:00
Updates
Sat Apr 30 15:44:12 2005 Søren Sandmann <sandmann@redhat.com> * TODO: Updates * sysprof-module.c (get_regs): Change the way we get registers for a task so that it works with 2.6.11
This commit is contained in:
committed by
Søren Sandmann Pedersen
parent
cd07b6f274
commit
914d8bf668
@ -1,3 +1,10 @@
|
|||||||
|
Sat Apr 30 15:44:12 2005 Søren Sandmann <sandmann@redhat.com>
|
||||||
|
|
||||||
|
* TODO: Updates
|
||||||
|
|
||||||
|
* sysprof-module.c (get_regs): Change the way we get registers for
|
||||||
|
a task so that it works with 2.6.11
|
||||||
|
|
||||||
Sat Apr 23 19:17:18 2005 Søren Sandmann <sandmann@redhat.com>
|
Sat Apr 23 19:17:18 2005 Søren Sandmann <sandmann@redhat.com>
|
||||||
|
|
||||||
* TODO: Updates
|
* TODO: Updates
|
||||||
|
|||||||
3
TODO
3
TODO
@ -112,6 +112,9 @@ Before 1.2:
|
|||||||
|
|
||||||
Later:
|
Later:
|
||||||
|
|
||||||
|
- Applications should be able to say "start profiling", "stop profiling"
|
||||||
|
so that you can limit the profiling to specific areas.
|
||||||
|
|
||||||
- Find out how to hack around gtk+ bug causing multiple double clicks
|
- Find out how to hack around gtk+ bug causing multiple double clicks
|
||||||
to get eaten.
|
to get eaten.
|
||||||
|
|
||||||
|
|||||||
@ -121,9 +121,9 @@ x_access_process_vm (struct task_struct *tsk,
|
|||||||
|
|
||||||
ret = get_user_pages(tsk, mm, addr, 1,
|
ret = get_user_pages(tsk, mm, addr, 1,
|
||||||
write, 1, &page, &vma);
|
write, 1, &page, &vma);
|
||||||
if (ret <= 0)
|
if (ret <= 0) {
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
bytes = len;
|
bytes = len;
|
||||||
offset = addr & (PAGE_SIZE-1);
|
offset = addr & (PAGE_SIZE-1);
|
||||||
if (bytes > PAGE_SIZE-offset)
|
if (bytes > PAGE_SIZE-offset)
|
||||||
@ -188,6 +188,8 @@ page_readable (userspace_reader *reader, unsigned long address)
|
|||||||
|
|
||||||
return result;
|
return result;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@ -208,8 +210,9 @@ read_user_space (userspace_reader *reader,
|
|||||||
r = x_access_process_vm (reader->task, cache_address,
|
r = x_access_process_vm (reader->task, cache_address,
|
||||||
reader->cache, PAGE_SIZE, 0);
|
reader->cache, PAGE_SIZE, 0);
|
||||||
|
|
||||||
if (r != PAGE_SIZE)
|
if (r != PAGE_SIZE) {
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
reader->cache_address = cache_address;
|
reader->cache_address = cache_address;
|
||||||
}
|
}
|
||||||
@ -250,6 +253,25 @@ read_frame (userspace_reader *reader, unsigned long addr, StackFrame *frame)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static struct pt_regs *
|
||||||
|
get_regs (struct task_struct *task)
|
||||||
|
{
|
||||||
|
/* This seems to work in Linux 2.6.11 */
|
||||||
|
void *stack_top = (void *)task->thread.esp0;
|
||||||
|
return stack_top - sizeof(struct pt_regs);
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
/* This used to work, but doesn't anymore */
|
||||||
|
return ((struct pt_regs *) (THREAD_SIZE + (unsigned long) task->thread_info)) - 1;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
/* One might suspect that this would work, but it doesn't
|
||||||
|
*/
|
||||||
|
return task_pt_regs (task);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
generate_stack_trace(struct task_struct *task,
|
generate_stack_trace(struct task_struct *task,
|
||||||
SysprofStackTrace *trace)
|
SysprofStackTrace *trace)
|
||||||
@ -259,7 +281,8 @@ generate_stack_trace(struct task_struct *task,
|
|||||||
#else
|
#else
|
||||||
# define START_OF_STACK 0xBFFFFFFF
|
# define START_OF_STACK 0xBFFFFFFF
|
||||||
#endif
|
#endif
|
||||||
struct pt_regs *regs = ((struct pt_regs *) (THREAD_SIZE + (unsigned long) task->thread_info)) - 1;
|
struct pt_regs *regs = get_regs (task); // task->thread.regs;
|
||||||
|
|
||||||
StackFrame frame;
|
StackFrame frame;
|
||||||
unsigned long addr;
|
unsigned long addr;
|
||||||
userspace_reader reader;
|
userspace_reader reader;
|
||||||
@ -276,6 +299,10 @@ generate_stack_trace(struct task_struct *task,
|
|||||||
|
|
||||||
addr = regs->ebp;
|
addr = regs->ebp;
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
printk (KERN_ALERT "ebp: %p\n", regs->ebp);
|
||||||
|
#endif
|
||||||
|
|
||||||
if (init_userspace_reader (&reader, task))
|
if (init_userspace_reader (&reader, task))
|
||||||
{
|
{
|
||||||
while (i < SYSPROF_MAX_ADDRESSES &&
|
while (i < SYSPROF_MAX_ADDRESSES &&
|
||||||
|
|||||||
Reference in New Issue
Block a user