3

I found three directories in /usr/share/gdb:

  • auto-load: this is used for auto-loaded scripts;
  • python: this is used for gdb python extension;
  • syscalls: this contains several xml files like amd64-linux.xml which I cannot find any information through google.

BTW: my OS is Fedora 13.

Could anyone please tell me what these xml files are used for? Thanks and regards!

2 Answers 2

4

Newer GDB's can break on system calls:

(gdb) help catch syscall
Catch system calls by their names and/or numbers.
Arguments say which system calls to catch.  If no arguments
are given, every system call will be caught.
Arguments, if given, should be one or more system call names
(if your system supports that), or system call numbers.

Example:

$ gdb /bin/true
(gdb) catch syscall exit_group 
Catchpoint 1 (syscall 'exit_group' [231])
(gdb) run
Starting program: /usr/bin/true 

Catchpoint 1 (call to syscall exit_group), 0x00000038464baa09 in __GI__exit (status=status@entry=0)
    at ../sysdeps/unix/sysv/linux/_exit.c:33
33        INLINE_SYSCALL (exit_group, 1, status);

The XML file supplies the syscall name to number mapping, e.g. exit_group is syscall number 231 on x86-64 Linux.

3

It's a very simple list which tells GDB what syscall numbers map to which syscalls on a particular system (since they are architecture-specific).

They are generated from the corresponding Linux kernel header (e.g. arch/x86/include/asm/unistd_32.h for linux-i386).

Example:

<syscalls_info>
  <syscall name="restart_syscall" number="0"/>
  <syscall name="exit" number="1"/>
  <syscall name="fork" number="2"/>
  <syscall name="read" number="3"/>
  <syscall name="write" number="4"/>
  <syscall name="open" number="5"/>
  ...
</syscalls_info>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.