LINUX.IE, website of the Irish Linux Users' Group
Tux rules!

   
Home
New Users
Articles
Download
Projects
Community
Vendors

  Print Version
Email to...
 
Archives:


planetILUG

Recent News

News Archive


Join the
ILUG
on FaceBook


Join the
ILUG
on LinkedIn


Join the
ILUG SETI
Group



















 
 :: Mailing Lists

[ILUG] GDB Macros of the day

[ILUG] GDB Macros of the day

paul at clubi.ie paul at clubi.ie
Thu Mar 4 15:58:14 GMT 2010


On Thu, 4 Mar 2010, Josh Glover wrote:

> Damn, Paul! I just suggested gdb because Frank mentioned it; were 
> it myself in need of a backtrace, I'd simply send SIGSEGV to the 
> offending process group and rip into the resulting core files with 
> a binary editor (hex is for sissies). That I wrote myself. In IA64 
> machine code. With unrolled loops. Using an Atari paddle controller 
> as a binary input device. Running at 400 baud on a serial port 
> driver that I wrote myself. Loaded at runtime into a kernel that I 
> wrote myself. In IA64 machine code...

Hehe, very good.

I myself prefer the method of "laying on hands", where one debugs 
SEGVs by connecting physically with the machine, being at one with 
the silicon and sensing the aura of its electro-magnetic emanations.

I find crystals help purify those auras and enhances the debugging 
process. Indeed, I can supply some, at a very good price (tastefully 
packaged together with an IC, stamped "Dallas Semiconductor" of 
course).

Also quite useful are macros. E.g. when debugging on big-endian 
machines (cause I'm not leet like those who do this in their heads):

define def_ntohs
  set $data = (char *)$arg0
  set $i = 0

  set $_  = $data[$i++] << 8
  set $_ += $data[$i++]
end
document def_ntohs
Read a 2-byte short at the given pointed to area as big-endian and
return it in $_

Argument: Pointer to a 2-byte, big-endian short word.
Returns: Integer value of that word in $_
end

define def_ntohl
  set $data = (char *)$arg0
  set $i = 0

  set $_  = $data[$i++] << 24
  set $_ += $data[$i++] << 16
  set $_ += $data[$i++] << 8
  set $_ += $data[$i++]
end
document def_ntohl
Read a 4-byte integer at the given pointed to area as big-endian and
return it in $_

Argument: Pointer to a big-endian 4-byte word.
Returns: Integer value of that word in $_
end

regards,
-- 
Paul Jakma	paul at jakma.org	Key ID: 64A2FF6A
Fortune:
The absurd is the essential concept and the first truth.
 		-- A. Camus


More information about the ILUG mailing list
Read this without the formatting.
                                                                                                    

 

Hosted by HEAnet


Maintained by the ILUG website team. The aim of Linux.ie is to support and help commercial and private users of Linux in Ireland. You can display ILUG news in your own webpages, read backend information to find out how. Networking services kindly provided by HEAnet, server kindly donated by Dell. Linux is a trademark of Linus Torvalds, used with permission. No penguins were harmed in the production or maintenance of this highly praised website. Looking for the Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!
RSS Version
Powered by Dell