What's your OSDev AWWWW YEAH! moment?

All off topic discussions go here. Everything from the funny thing your cat did to your favorite tv shows. Non-programming computer questions are ok too.
User avatar
bzt
Member
Member
Posts: 1584
Joined: Thu Oct 13, 2016 4:55 pm
Contact:

Re: What's your OSDev AWWWW YEAH! moment?

Post by bzt »

It seems GNU toolchain does not like me, but no worries, it's mutual and I'm not alone :-)

So, did you know that gdb sometimes fails to load symbols from an elf file correctly? What a shame...

I've googled a lot, but all I could find is unanswered questions, a few links:
http://stackoverflow.com/questions/3012 ... ct-address
http://stackoverflow.com/questions/2533 ... e-function
https://www.sourceware.org/ml/gdb/2004-07/msg00107.html

Here's an example to demonstrate:

Code: Select all

$ objdump -d ps2.so
0000000000000169 <irq1>:
 169:	66 b9 00 02          	mov    $0x200,%cx
    ....
As you can see, the symbol table is correct in the ELF, irq1 function is at 0x169. Now in gdb:

Code: Select all

(gdb) hbreak irq1
Hardware assisted breakpoint 1 at 0x205081
(gdb) disass *0x205169
No function contains specified address.
(gdb)
Right in the middle of the ELF header... And gdb refuses to disassemble the correct address. Nice, good job GNU developers! (Why can't I disassemble any arbitrary address, btw?)

Anyway if any of you face the same problem, the solution is simple, use 'add-symbol-file' instead of 'symbol-file' and add 0xe8 (the size of the ELF header) to the relocation address:

Code: Select all

(gdb) add-symbol-file bin/root/lib/sys/input/ps2.so 0x2050e8
add symbol table from file "bin/root/lib/sys/input/ps2.so" at
	.text_addr = 0x2050e8
(y or n) y
Reading symbols from bin/root/lib/sys/input/ps2.so...(no debugging symbols found)...done.
(gdb) hbreak irq1
Hardware assisted breakpoint 1 at 0x205169
(gdb) disass irq1
Dump of assembler code for function irq1:
       ...
Hope this saves someone a big headache some day.

Happy debugging!
User avatar
iansjack
Member
Member
Posts: 4685
Joined: Sat Mar 31, 2012 3:07 am
Location: Chichester, UK

Re: What's your OSDev AWWWW YEAH! moment?

Post by iansjack »

Before complaining about your toolchain you should learn to use it.

The "x" command allows you to disassemble at any address, even when the result is meaningless. The "disassemble" command is used to disassemble functions.
User avatar
bzt
Member
Member
Posts: 1584
Joined: Thu Oct 13, 2016 4:55 pm
Contact:

Re: What's your OSDev AWWWW YEAH! moment?

Post by bzt »

iansjack wrote:Before complaining about your toolchain you should learn to use it.

The "x" command allows you to disassemble at any address, even when the result is meaningless. The "disassemble" command is used to disassemble functions.
Maybe it passed your attention, but my complain was about gdb loading incorrect addresses from an elf. And yes, I know x/i works and thanks, I know GNU toolchain pretty well. It's just I haven't used in the last decade. Haven't changed much. It's the same non-intuitive bastard as it was back in my college days. One would expect that the command "disassemble" disassembles, but no. I've used many different systems, many different compilers, assemblers and linkers, and GNU is still the worst of all. Too bad that's the de facto standard. But I'm not surprised, the PC was always about the worst choices. But that's off topic.
I wrote that post so that people having the same issue could find it with google and have an "AWW YEAH!" moment. That's all.
User avatar
iansjack
Member
Member
Posts: 4685
Joined: Sat Mar 31, 2012 3:07 am
Location: Chichester, UK

Re: What's your OSDev AWWWW YEAH! moment?

Post by iansjack »

Why can't I disassemble any arbitrary address, btw?
If you can find better software then use it.
Peterbjornx
Member
Member
Posts: 116
Joined: Thu May 06, 2010 4:34 am
Libera.chat IRC: peterbjornx
Location: Leiden, The Netherlands
Contact:

Re: What's your OSDev AWWWW YEAH! moment?

Post by Peterbjornx »

This:
Image
User avatar
bzt
Member
Member
Posts: 1584
Joined: Thu Oct 13, 2016 4:55 pm
Contact:

Re: What's your OSDev AWWWW YEAH! moment?

Post by bzt »

And AWWW YEAH! Finally symbol lookup works!
oszdbg.png
It first tries to locate dynsym, and if that fails, it fallbacks to symtab. So it's bulletproof :-) :-) :-)
klange
Member
Member
Posts: 679
Joined: Wed Mar 30, 2011 12:31 am
Libera.chat IRC: klange
Discord: klange

Re: What's your OSDev AWWWW YEAH! moment?

Post by klange »

Image

A working native gcc 6.3!

Image

And I can build Python extensions with it!
User avatar
DixiumOS
Member
Member
Posts: 84
Joined: Tue Jan 10, 2017 3:19 pm
Libera.chat IRC: NunoLava1998

Re: What's your OSDev AWWWW YEAH! moment?

Post by DixiumOS »

klange wrote:Image

A working native gcc 6.3!

Image

And I can build Python extensions with it!
now compile a OS with it to be the only one to finish the challenge of making a OS self hosting then building a OS with that.
(not so frequently updated) Code is at:

https://github.com/NunoLava1998/DixiumOS-1
Kevin
Member
Member
Posts: 1071
Joined: Sun Feb 01, 2009 6:11 am
Location: Germany
Contact:

Re: What's your OSDev AWWWW YEAH! moment?

Post by Kevin »

DixiumOS wrote:now compile a OS with it to be the only one to finish the challenge of making a OS self hosting then building a OS with that.
I don't think Python will be particularly helpful in this challenge.

And he isn't the first or even only one to have a self-hosting OS, but I would assume he's already there.
Developer of tyndur - community OS of Lowlevel (German)
User avatar
DixiumOS
Member
Member
Posts: 84
Joined: Tue Jan 10, 2017 3:19 pm
Libera.chat IRC: NunoLava1998

Re: What's your OSDev AWWWW YEAH! moment?

Post by DixiumOS »

Kevin wrote:
DixiumOS wrote:now compile a OS with it to be the only one to finish the challenge of making a OS self hosting then building a OS with that.
I don't think Python will be particularly helpful in this challenge.

And he isn't the first or even only one to have a self-hosting OS, but I would assume he's already there.
"Woo, a working gcc 6.2!"
It's not python
(not so frequently updated) Code is at:

https://github.com/NunoLava1998/DixiumOS-1
Kevin
Member
Member
Posts: 1071
Joined: Sun Feb 01, 2009 6:11 am
Location: Germany
Contact:

Re: What's your OSDev AWWWW YEAH! moment?

Post by Kevin »

What he demonstrated isn't really gcc, but that he updated his gcc and used it to build a Python module.

Getting just gcc to work is easier than Python (and just some Python is easier than dynamically loading a module in Python).
Developer of tyndur - community OS of Lowlevel (German)
User avatar
DixiumOS
Member
Member
Posts: 84
Joined: Tue Jan 10, 2017 3:19 pm
Libera.chat IRC: NunoLava1998

Re: What's your OSDev AWWWW YEAH! moment?

Post by DixiumOS »

Kevin wrote:What he demonstrated isn't really gcc, but that he updated his gcc and used it to build a Python module.

Getting just gcc to work is easier than Python (and just some Python is easier than dynamically loading a module in Python).
No, i meant the ToaruOS developer should compile ToaruOS in gcc.

Y'know, that FIVE star challenge.
(not so frequently updated) Code is at:

https://github.com/NunoLava1998/DixiumOS-1
User avatar
SpyderTL
Member
Member
Posts: 1074
Joined: Sun Sep 19, 2010 10:05 pm

Re: What's your OSDev AWWWW YEAH! moment?

Post by SpyderTL »

AWWWW YEAH!

Software triangle rendering with vertex color and interpolation... Done!
Triangle.jpg
Next, make it spin!

I actually already have spinning color vertex triangles in hardware accelerated 3D in VMWare, so now I just need to make the interfaces identical so that I can switch between the two...
Project: OZone
Source: GitHub
Current Task: LIB/OBJ file support
"The more they overthink the plumbing, the easier it is to stop up the drain." - Montgomery Scott
Post Reply