Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sys: Initial import of analytical object dump (od) module #1884

Merged
merged 1 commit into from
Oct 30, 2014

Conversation

miri64
Copy link
Member

@miri64 miri64 commented Oct 27, 2014

I was fed up to always rewrite object dumps.This introduces a module for this. Might also be useful to analyse output in wireshark

@miri64 miri64 added this to the Release NEXT MAJOR milestone Oct 27, 2014
@miri64 miri64 added the Type: new feature The issue requests / The PR implemements a new feature for RIOT label Oct 27, 2014
@OlegHahm
Copy link
Member

I have no clue how this should be used. Can you provide a README?

@miri64
Copy link
Member Author

miri64 commented Oct 27, 2014

Isn't that what the doxygen documentation is for? Where it is unclear? The idea is to use it mainly for debug (and if we have something like a fs in the future to dump files in binary form). Just call

od(&var, sizeof(var), 0, 0);
/* or */
od_dump_hex(&var, sizeof(var), 0);

from whereever you need a quick overview of the bits'n'bytes in var

@miri64
Copy link
Member Author

miri64 commented Oct 27, 2014

This was motivated mainly to find the errors in the Neighbor Discovery more easily

@miri64
Copy link
Member Author

miri64 commented Oct 27, 2014

Also it's inspired by od(1), but in function form and not as command-line tool.

@OlegHahm
Copy link
Member

Doxygen says Dumps *data* to stdout (which can be basically said about every print function) and referring to a tool that talks about files.

So, it's printing a piece of memory in a octal representation?

@miri64
Copy link
Member Author

miri64 commented Oct 27, 2014

*data* refers to the variable, but okay I'll rework the doc a little bit more clearly tomorrow now.

So, it's printing a piece of memory in a octal representation?

Octal, decimal, hexadecimal, what ever you like ;-)

@miri64
Copy link
Member Author

miri64 commented Oct 27, 2014

better?

@OlegHahm
Copy link
Member

👍

@OlegHahm
Copy link
Member

(That's not an ACK yet.)

@miri64
Copy link
Member Author

miri64 commented Oct 27, 2014

(Did not take it for that) ;-)

@miri64
Copy link
Member Author

miri64 commented Oct 27, 2014

@N8Fear please comment in the PR's file changes, not the commits.

@OlegHahm
Copy link
Member

    char foo[128];
    od_hex_dump((void*) &foo, 128, 0); 

    foo[5] = 44; 
    od_hex_dump((void*) &foo, 128, 0);

on native:

000000 0000000000000000 0000000000000000 0000000000000000
000003 0000000000000000 0000000000000000 0000000000000000
000006 0000000000000000 0000000000000000 0000000000000000
000009 0000000000000000 0000000000000000 0000000000000000
00000c 0000000000000000 0000000000000000 0000000000000000
00000f 0000000000000000
000000 00002c0000000000 0000000000000000 0000000000000000
000003 0000000000000000 0000000000000000 0000000000000000
000006 0000000000000000 0000000000000000 0000000000000000
000009 0000000000000000 0000000000000000 0000000000000000
00000c 0000000000000000 0000000000000000 0000000000000000
00000f 0000000000000000

Looks okay.

On IoT-Lab_M3:

000000 000000000000000lx 000000000000000lx 000000000000000lx
000003 000000000000000lx 000000000000000lx 000000000000000lx
000006 000000000000000lx 000000000000000lx 000000000000000lx
000009 000000000000000lx 000000000000000lx 000000000000000lx
00000c 000000000000000lx 000000000000000lx 000000000000000lx
00000f 000000000000000lx
000000 000000000000000lx 000000000000000lx 000000000000000lx
000003 000000000000000lx 000000000000000lx 000000000000000lx
000006 000000000000000lx 000000000000000lx 000000000000000lx
000009 000000000000000lx 000000000000000lx 000000000000000lx
00000c 000000000000000lx 000000000000000lx 000000000000000lx
00000f 000000000000000lx

Broken formatter?

@miri64
Copy link
Member Author

miri64 commented Oct 28, 2014

This looks a little bit mind-bending to me right now. Will look into it (this time for real) tomorrow.

@miri64
Copy link
Member Author

miri64 commented Oct 28, 2014

printf for 64-bit numbers seems to be broken on iot-lab_M3. See #1891

@OlegHahm
Copy link
Member

ACK

#define __OD_H_

#include <stdint.h>

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

file does not have a C++ compatible header: 'sys/include/od.h'

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

öhm, how do I make this?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

git grep extern core

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

git grep cplusplus

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

got it

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@authmillenon got it ;)

@miri64
Copy link
Member Author

miri64 commented Oct 30, 2014

@OlegHahm re-ACK?

@OlegHahm
Copy link
Member

Yes, squash and go

miri64 added a commit that referenced this pull request Oct 30, 2014
sys: Initial import of analytical object dump (od) module
@miri64 miri64 merged commit 1dae583 into RIOT-OS:master Oct 30, 2014
@miri64 miri64 deleted the od branch October 30, 2014 15:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: new feature The issue requests / The PR implemements a new feature for RIOT
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants